travis: fix flaky test

This commit is contained in:
Nolan Lawson 2018-04-10 22:38:10 -07:00
parent 9bfa2cf013
commit 44dafb591e

View file

@ -1,6 +1,6 @@
import { import {
composeButton, getNthStatus, scrollToStatus, scrollToTopOfTimeline, modalDialog, sleep, showMoreButton, composeButton, getNthStatus, scrollToStatus, modalDialog, sleep,
scrollContainerToTop notificationsNavButton, getUrl
} from '../utils' } from '../utils'
import { foobarRole } from '../roles' import { foobarRole } from '../roles'
import { Selector as $ } from 'testcafe' import { Selector as $ } from 'testcafe'
@ -19,14 +19,11 @@ test('can compose using a dialog', async t => {
.typeText(modalDialog.find('.compose-box-input'), 'hello from the modal') .typeText(modalDialog.find('.compose-box-input'), 'hello from the modal')
.click(modalDialog.find('.compose-box-button-compose')) .click(modalDialog.find('.compose-box-button-compose'))
.expect(modalDialog.exists).notOk() .expect(modalDialog.exists).notOk()
await sleep(5000) .click(notificationsNavButton)
await scrollToTopOfTimeline(t) .expect(getUrl()).contains('/notifications')
await t.hover(getNthStatus(0)) .navigateTo('/')
await scrollContainerToTop() .hover(getNthStatus(0))
await t .expect(getNthStatus(0).innerText).contains('hello from the modal', {timeout: 20000})
.expect(showMoreButton.innerText).contains('Show 1 more', {timeout: 30000})
.click(showMoreButton)
await t.expect(getNthStatus(0).innerText).contains('hello from the modal', {timeout: 20000})
}) })
test('can use emoji dialog within compose dialog', async t => { test('can use emoji dialog within compose dialog', async t => {
@ -40,12 +37,8 @@ test('can use emoji dialog within compose dialog', async t => {
.expect(modalDialog.find('.compose-box-input').value).eql(':blobpats: ') .expect(modalDialog.find('.compose-box-input').value).eql(':blobpats: ')
.click(modalDialog.find('.compose-box-button-compose')) .click(modalDialog.find('.compose-box-button-compose'))
.expect(modalDialog.exists).notOk() .expect(modalDialog.exists).notOk()
await sleep(5000) .click(notificationsNavButton)
await scrollToTopOfTimeline(t) .expect(getUrl()).contains('/notifications')
await t.hover(getNthStatus(0)) .navigateTo('/')
await scrollContainerToTop()
await t
.expect(showMoreButton.innerText).contains('Show 1 more')
.click(showMoreButton)
await t.expect(getNthStatus(0).find('img[alt=":blobpats:"]').exists).ok({timeout: 20000}) await t.expect(getNthStatus(0).find('img[alt=":blobpats:"]').exists).ok({timeout: 20000})
}) })