make tests less flaky

This commit is contained in:
Nolan Lawson 2018-03-04 12:46:46 -08:00
parent ff9ffc2308
commit 456c865a09
3 changed files with 6 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import { Selector as $ } from 'testcafe' import { Selector as $ } from 'testcafe'
import { import {
authorizeInput, emailInput, formError, getUrl, instanceInput, passwordInput, authorizeInput, emailInput, formError, getFirstVisibleStatus, getUrl, instanceInput, passwordInput,
settingsButton settingsButton
} from '../utils' } from '../utils'
@ -37,6 +37,8 @@ test('Cannot log in to a fake instance', async t => {
test('Logs in and logs out of localhost:3000', async t => { test('Logs in and logs out of localhost:3000', async t => {
await manualLogin(t, 'foobar@localhost:3000', 'foobarfoobar') await manualLogin(t, 'foobar@localhost:3000', 'foobarfoobar')
.expect(getUrl()).eql('http://localhost:4002/')
.hover(getFirstVisibleStatus())
.expect($('article.status-article').exists).ok() .expect($('article.status-article').exists).ok()
.click(settingsButton) .click(settingsButton)
.click($('a').withText('Instances')) .click($('a').withText('Instances'))

View file

@ -1,5 +1,5 @@
import { Selector as $ } from 'testcafe' import { Selector as $ } from 'testcafe'
import { getFirstVisibleStatus, getUrl, validateTimeline } from '../utils' import { getFirstVisibleStatus, getNthStatus, getUrl, validateTimeline } from '../utils'
import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures' import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures'
import { foobarRole } from '../roles' import { foobarRole } from '../roles'
@ -8,6 +8,7 @@ fixture`03-basic-timeline-spec.js`
test('Shows the home timeline', async t => { test('Shows the home timeline', async t => {
await t.useRole(foobarRole) await t.useRole(foobarRole)
.hover(getNthStatus(0))
.expect(getFirstVisibleStatus().exists).ok() .expect(getFirstVisibleStatus().exists).ok()
.expect(getFirstVisibleStatus().hasAttribute('aria-setsize')).ok() .expect(getFirstVisibleStatus().hasAttribute('aria-setsize')).ok()
.expect(getFirstVisibleStatus().getAttribute('aria-posinset')).eql('0') .expect(getFirstVisibleStatus().getAttribute('aria-posinset')).eql('0')

View file

@ -2,7 +2,7 @@ import { ClientFunction as exec, Selector as $ } from 'testcafe'
import * as images from './images' import * as images from './images'
import * as blobUtils from './blobUtils' import * as blobUtils from './blobUtils'
const SCROLL_INTERVAL = 3 const SCROLL_INTERVAL = 2
export const settingsButton = $('nav a[aria-label=Settings]') export const settingsButton = $('nav a[aria-label=Settings]')
export const instanceInput = $('#instanceInput') export const instanceInput = $('#instanceInput')