forked from cybrespace/pinafore
fix flaky login tests (#209)
This commit is contained in:
parent
095be79525
commit
209b36c73b
|
@ -1,13 +1,17 @@
|
|||
import { Role } from 'testcafe'
|
||||
import { authorizeInput, emailInput, getUrl, instanceInput, passwordInput } from './utils'
|
||||
import {
|
||||
addInstanceButton,
|
||||
authorizeInput, emailInput, getUrl, instanceInput, mastodonLogInButton,
|
||||
passwordInput
|
||||
} from './utils'
|
||||
|
||||
function login (t, username, password) {
|
||||
return t.typeText(instanceInput, 'localhost:3000', {paste: true})
|
||||
.pressKey('enter')
|
||||
.click(addInstanceButton)
|
||||
.expect(getUrl()).eql('http://localhost:3000/auth/sign_in')
|
||||
.typeText(emailInput, username, {paste: true})
|
||||
.typeText(passwordInput, password, {paste: true})
|
||||
.pressKey('enter')
|
||||
.click(mastodonLogInButton)
|
||||
.expect(getUrl()).contains('/oauth/authorize')
|
||||
.click(authorizeInput)
|
||||
.expect(getUrl()).eql('http://localhost:4002/', {timeout: 20000})
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { Selector as $ } from 'testcafe'
|
||||
import {
|
||||
addInstanceButton,
|
||||
authorizeInput, emailInput, formError, getFirstVisibleStatus, getUrl, instanceInput, logInToInstanceLink,
|
||||
mastodonLogInButton,
|
||||
passwordInput,
|
||||
settingsButton
|
||||
} from '../utils'
|
||||
|
@ -12,11 +14,11 @@ function manualLogin (t, username, password) {
|
|||
return t.click(logInToInstanceLink)
|
||||
.expect(getUrl()).contains('/settings/instances/add')
|
||||
.typeText(instanceInput, 'localhost:3000')
|
||||
.pressKey('enter')
|
||||
.click(addInstanceButton)
|
||||
.expect(getUrl()).eql('http://localhost:3000/auth/sign_in')
|
||||
.typeText(emailInput, username, {paste: true})
|
||||
.typeText(passwordInput, password, {paste: true})
|
||||
.pressKey('enter')
|
||||
.click(mastodonLogInButton)
|
||||
.expect(getUrl()).contains('/oauth/authorize')
|
||||
.click(authorizeInput)
|
||||
.expect(getUrl()).eql('http://localhost:4002/')
|
||||
|
@ -26,7 +28,7 @@ test('Cannot log in to a fake instance', async t => {
|
|||
await t.click(logInToInstanceLink)
|
||||
.expect(getUrl()).contains('/settings/instances/add')
|
||||
.typeText(instanceInput, 'fake.nolanlawson.com', {paste: true})
|
||||
.pressKey('enter')
|
||||
.click(addInstanceButton)
|
||||
.expect(formError.exists).ok()
|
||||
.expect(formError.innerText).contains('Is this a valid Mastodon instance?')
|
||||
.typeText(instanceInput, '.biz', {paste: true})
|
||||
|
|
|
@ -37,6 +37,8 @@ export const accountProfileFollowedBy = $('.account-profile .account-profile-fol
|
|||
export const accountProfileFollowButton = $('.account-profile .account-profile-follow button')
|
||||
export const goBackButton = $('.dynamic-page-go-back')
|
||||
export const accountProfileMoreOptionsButton = $('.account-profile-more-options button')
|
||||
export const addInstanceButton = $('#submitButton')
|
||||
export const mastodonLogInButton = $('button[type="submit"]')
|
||||
|
||||
export const favoritesCountElement = $('.status-favs-reblogs:nth-child(3)').addCustomDOMProperties({
|
||||
innerCount: el => parseInt(el.innerText, 10)
|
||||
|
|
Loading…
Reference in New Issue