test: improve test flakiness (#1127)

This commit is contained in:
Nolan Lawson 2019-03-31 10:56:03 -07:00 committed by GitHub
parent 9553c74799
commit f169e0063d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,7 +13,7 @@ import {
getNthStatusSpoiler, getNthStatusSpoiler,
composeModalContentWarningInput, composeModalContentWarningInput,
dialogOptionsOption, dialogOptionsOption,
getNthReplyButton, getNthComposeReplyInput, getNthComposeReplyButton, getUrl getNthReplyButton, getNthComposeReplyInput, getNthComposeReplyButton, getUrl, sleep
} from '../utils' } from '../utils'
import { postAs, postEmptyStatusWithMediaAs, postWithSpoilerAndPrivacyAs } from '../serverActions' import { postAs, postEmptyStatusWithMediaAs, postWithSpoilerAndPrivacyAs } from '../serverActions'
@ -129,21 +129,34 @@ test('delete and redraft reply within thread', async t => {
.expect(getNthStatusContent(1).innerText).contains('this is a thread') .expect(getNthStatusContent(1).innerText).contains('this is a thread')
.click(getNthStatus(1)) .click(getNthStatus(1))
.expect(getUrl()).match(/statuses/) .expect(getUrl()).match(/statuses/)
await sleep(1000)
await t
.expect(getNthStatusContent(1).innerText).contains('this is a thread') .expect(getNthStatusContent(1).innerText).contains('this is a thread')
.click(getNthReplyButton(1)) .click(getNthReplyButton(1))
await sleep(1000)
await t
.typeText(getNthComposeReplyInput(1), 'heyo', { paste: true }) .typeText(getNthComposeReplyInput(1), 'heyo', { paste: true })
.click(getNthComposeReplyButton(1)) .click(getNthComposeReplyButton(1))
await sleep(1000)
await t
.expect(getNthStatus(2).innerText).contains('@admin heyo') .expect(getNthStatus(2).innerText).contains('@admin heyo')
.click(getNthStatusOptionsButton(2)) .click(getNthStatusOptionsButton(2))
await sleep(500)
await t
.click(dialogOptionsOption.withText('Delete and redraft')) .click(dialogOptionsOption.withText('Delete and redraft'))
await sleep(500)
await t
.expect(modalDialog.hasAttribute('aria-hidden')).notOk() .expect(modalDialog.hasAttribute('aria-hidden')).notOk()
.typeText(composeModalInput, ' update!', { paste: true }) .typeText(composeModalInput, ' update!', { paste: true })
await sleep(1000)
await t
.click(composeModalComposeButton) .click(composeModalComposeButton)
await sleep(1000)
await t
.expect(modalDialog.exists).notOk() .expect(modalDialog.exists).notOk()
.expect(getNthStatusContent(2).innerText).match(/@admin heyo\s+update!/, { .expect(getNthStatusContent(2).innerText).match(/@admin heyo\s+update!/, {
timeout: 30000 timeout: 30000
}) })
.expect(getNthStatus(3).exists).notOk()
}) })
test('multiple paragraphs', async t => { test('multiple paragraphs', async t => {