2018-04-21 13:06:46 -07:00
|
|
|
import {
|
|
|
|
authorizeInput, emailInput, getUrl, instanceInput, mastodonLogInButton,
|
2018-05-24 20:01:34 -07:00
|
|
|
passwordInput,
|
|
|
|
sleep
|
2018-04-21 13:06:46 -07:00
|
|
|
} from './utils'
|
2018-04-28 14:19:39 -07:00
|
|
|
import { users } from './users'
|
2018-02-19 17:18:40 -08:00
|
|
|
|
2018-05-24 20:01:34 -07:00
|
|
|
async function login (t, username, password) {
|
|
|
|
await sleep(500)
|
|
|
|
await t.typeText(instanceInput, 'localhost:3000', {paste: true})
|
|
|
|
await sleep(500)
|
|
|
|
return t
|
|
|
|
.pressKey('enter')
|
2018-04-21 14:57:02 -07:00
|
|
|
.expect(getUrl()).eql('http://localhost:3000/auth/sign_in', {timeout: 30000})
|
2018-02-28 22:45:42 -08:00
|
|
|
.typeText(emailInput, username, {paste: true})
|
|
|
|
.typeText(passwordInput, password, {paste: true})
|
2018-04-21 13:06:46 -07:00
|
|
|
.click(mastodonLogInButton)
|
2018-02-19 17:18:40 -08:00
|
|
|
.expect(getUrl()).contains('/oauth/authorize')
|
2018-02-28 22:45:42 -08:00
|
|
|
.click(authorizeInput)
|
2018-04-21 14:57:02 -07:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/', {timeout: 30000})
|
2018-02-19 17:18:40 -08:00
|
|
|
}
|
|
|
|
|
2018-05-26 13:51:41 -07:00
|
|
|
// 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 t.navigateTo('/settings/instances/add')
|
2018-04-28 14:19:39 -07:00
|
|
|
await login(t, users.foobar.email, users.foobar.password)
|
2018-05-26 13:51:41 -07:00
|
|
|
}
|
2018-04-28 14:19:39 -07:00
|
|
|
|
2018-05-26 13:51:41 -07:00
|
|
|
export async function loginAsLockedAccount (t) {
|
|
|
|
await t.navigateTo('/settings/instances/add')
|
2018-04-28 14:19:39 -07:00
|
|
|
await login(t, users.LockedAccount.email, users.LockedAccount.password)
|
2018-05-26 13:51:41 -07:00
|
|
|
}
|