tests: try to make tests less flaky (#1292)
This commit is contained in:
parent
c034b4c0c5
commit
ea220c32d3
|
@ -129,31 +129,27 @@ test('delete and redraft reply within thread', async t => {
|
|||
.expect(getNthStatusContent(1).innerText).contains('this is a thread')
|
||||
.click(getNthStatus(1))
|
||||
.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', { timeout: 30000 })
|
||||
.click(getNthReplyButton(1))
|
||||
await sleep(1000)
|
||||
await sleep(2000)
|
||||
await t
|
||||
.typeText(getNthComposeReplyInput(1), 'heyo', { paste: true })
|
||||
.click(getNthComposeReplyButton(1))
|
||||
await sleep(1000)
|
||||
await t
|
||||
.expect(getNthStatus(2).innerText).contains('@admin heyo')
|
||||
.expect(getNthStatus(2).innerText).contains('@admin heyo', { timeout: 30000 })
|
||||
.click(getNthStatusOptionsButton(2))
|
||||
await sleep(500)
|
||||
await sleep(2000)
|
||||
await t
|
||||
.click(dialogOptionsOption.withText('Delete and redraft'))
|
||||
await sleep(500)
|
||||
await t
|
||||
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
|
||||
.expect(modalDialog.hasAttribute('aria-hidden')).notOk({ timeout: 30000 })
|
||||
.typeText(composeModalInput, ' update!', { paste: true })
|
||||
await sleep(1000)
|
||||
await sleep(2000)
|
||||
await t
|
||||
.click(composeModalComposeButton)
|
||||
await sleep(1000)
|
||||
await t
|
||||
.expect(modalDialog.exists).notOk()
|
||||
.expect(modalDialog.exists).notOk({ timeout: 20000 })
|
||||
.expect(getNthStatusContent(2).innerText).match(/@admin heyo\s+update!/, {
|
||||
timeout: 30000
|
||||
})
|
||||
|
|
|
@ -71,8 +71,9 @@ test('Can update poll results', async t => {
|
|||
})
|
||||
|
||||
test('Poll results refresh everywhere', async t => {
|
||||
await loginAsFoobar(t)
|
||||
await createPollAs('admin', 'another poll', ['yes', 'no'], false)
|
||||
await sleep(2000)
|
||||
await loginAsFoobar(t)
|
||||
await t
|
||||
.expect(getNthStatusContent(1).innerText).contains('another poll')
|
||||
.click(getNthStatusRelativeDate(1))
|
||||
|
|
|
@ -7,7 +7,7 @@ import {
|
|||
getComposePollNthInput,
|
||||
composePoll,
|
||||
composePollMultipleChoice,
|
||||
composePollExpiry, composePollAddButton, getComposePollRemoveNthButton, postStatusButton, composeInput
|
||||
composePollExpiry, composePollAddButton, getComposePollRemoveNthButton, postStatusButton, composeInput, sleep
|
||||
} from '../utils'
|
||||
import { loginAsFoobar } from '../roles'
|
||||
import { POLL_EXPIRY_DEFAULT } from '../../src/routes/_static/polls'
|
||||
|
@ -42,20 +42,28 @@ test('Can add and remove poll options', async t => {
|
|||
.expect(composePoll.exists).ok()
|
||||
.typeText(getComposePollNthInput(1), 'first', { paste: true })
|
||||
.typeText(getComposePollNthInput(2), 'second', { paste: true })
|
||||
await sleep(1000)
|
||||
await t
|
||||
.click(composePollAddButton)
|
||||
.typeText(getComposePollNthInput(3), 'third', { paste: true })
|
||||
.expect(getComposePollNthInput(1).value).eql('first')
|
||||
.expect(getComposePollNthInput(2).value).eql('second')
|
||||
.expect(getComposePollNthInput(3).value).eql('third')
|
||||
.expect(getComposePollNthInput(4).exists).notOk()
|
||||
await sleep(1000)
|
||||
await t
|
||||
.click(getComposePollRemoveNthButton(2))
|
||||
.expect(getComposePollNthInput(1).value).eql('first')
|
||||
.expect(getComposePollNthInput(2).value).eql('third')
|
||||
.expect(getComposePollNthInput(3).exists).notOk()
|
||||
.expect(getComposePollNthInput(4).exists).notOk()
|
||||
await sleep(1000)
|
||||
await t
|
||||
.click(composePollAddButton)
|
||||
.typeText(getComposePollNthInput(3), 'fourth', { paste: true })
|
||||
.typeText(composeInput, 'Vote on my poll!!!', { paste: true })
|
||||
await sleep(1000)
|
||||
await t
|
||||
.click(postStatusButton)
|
||||
.expect(getNthStatusContent(1).innerText).contains('Vote on my poll!!!')
|
||||
.expect(getNthStatusPollForm(1).exists).notOk()
|
||||
|
|
Loading…
Reference in New Issue