roles.js 908 B

1234567891011121314151617181920212223242526
  1. import { getUrl } from './utils'
  2. import { users } from './users'
  3. // quick login using a secret page and a known access token (makes tests run faster)
  4. async function login (t, user) {
  5. await t.navigateTo(`/?instanceName=localhost:3000&accessToken=${user.accessToken}`)
  6. .expect(getUrl()).eql('http://localhost:4002/', { timeout: 30000 })
  7. }
  8. // roles appear not to be working anymore :(
  9. // export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => {
  10. // await login(t, users.foobar.email, users.foobar.password)
  11. // })
  12. //
  13. // export const lockedAccountRole = Role('http://localhost:4002/settings/instances/add', async t => {
  14. // await login(t, users.LockedAccount.email, users.LockedAccount.password)
  15. // })
  16. export async function loginAsFoobar (t) {
  17. await login(t, users.foobar)
  18. }
  19. export async function loginAsLockedAccount (t) {
  20. await login(t, users.LockedAccount)
  21. }