From f169e0063d0d0b61ad126ff4060587af085419e1 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 31 Mar 2019 10:56:03 -0700 Subject: [PATCH] test: improve test flakiness (#1127) --- tests/spec/121-delete-and-redraft.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/spec/121-delete-and-redraft.js b/tests/spec/121-delete-and-redraft.js index f053e26..557c21f 100644 --- a/tests/spec/121-delete-and-redraft.js +++ b/tests/spec/121-delete-and-redraft.js @@ -13,7 +13,7 @@ import { getNthStatusSpoiler, composeModalContentWarningInput, dialogOptionsOption, - getNthReplyButton, getNthComposeReplyInput, getNthComposeReplyButton, getUrl + getNthReplyButton, getNthComposeReplyInput, getNthComposeReplyButton, getUrl, sleep } from '../utils' 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') .click(getNthStatus(1)) .expect(getUrl()).match(/statuses/) + await sleep(1000) + await t .expect(getNthStatusContent(1).innerText).contains('this is a thread') .click(getNthReplyButton(1)) + await sleep(1000) + await t .typeText(getNthComposeReplyInput(1), 'heyo', { paste: true }) .click(getNthComposeReplyButton(1)) + await sleep(1000) + await t .expect(getNthStatus(2).innerText).contains('@admin heyo') .click(getNthStatusOptionsButton(2)) + await sleep(500) + await t .click(dialogOptionsOption.withText('Delete and redraft')) + await sleep(500) + await t .expect(modalDialog.hasAttribute('aria-hidden')).notOk() .typeText(composeModalInput, ' update!', { paste: true }) + await sleep(1000) + await t .click(composeModalComposeButton) + await sleep(1000) + await t .expect(modalDialog.exists).notOk() .expect(getNthStatusContent(2).innerText).match(/@admin heyo\s+update!/, { timeout: 30000 }) - .expect(getNthStatus(3).exists).notOk() }) test('multiple paragraphs', async t => {