pinafore/tests/roles.js
Nolan Lawson e8d2cd9ffc
tests: quicker login, tweak test setup (#372)
* make tests faster by logging in directly

* downgrade testcafe

* Revert "downgrade testcafe"

This reverts commit 0f78f5ef63f25b6428de2faba476a353a338c695.

* try a delay

* the delay does not do anything

* disable concurrency in testcafe

* make setup script less noisy

* try transparency of 2?

* Revert "the delay does not do anything"

This reverts commit 438b3519a4e0c325e89f0c2a0eff6a7a4ae11ebd.

* try a delay of 400ms

* okay fine delay of 1s

* try concurrency of 4 again
2018-06-08 09:00:20 -07:00

26 lines
926 B
JavaScript

import { getUrl } from './utils'
import { users } from './users'
// quick login using a secret page and a known access token (makes tests run faster)
async function login (t, user) {
await t.navigateTo(`/settings/quick-login?instanceName=localhost:3000&accessToken=${user.accessToken}`)
.expect(getUrl()).eql('http://localhost:4002/', {timeout: 30000})
}
// roles appear not to be working anymore :(
// export const foobarRole = Role('http://localhost:4002/settings/instances/add', async t => {
// await login(t, users.foobar.email, users.foobar.password)
// })
//
// export const lockedAccountRole = Role('http://localhost:4002/settings/instances/add', async t => {
// await login(t, users.LockedAccount.email, users.LockedAccount.password)
// })
export async function loginAsFoobar (t) {
await login(t, users.foobar)
}
export async function loginAsLockedAccount (t) {
await login(t, users.LockedAccount)
}