From b451093ecebb0a0c3bb48f96b34fc02078ee861e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 15 Feb 2021 16:45:46 -0800 Subject: [PATCH] test: fix flakey test (#1957) --- tests/spec/115-follow-unfollow.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/spec/115-follow-unfollow.js b/tests/spec/115-follow-unfollow.js index b2cfaf08..07ceaf36 100644 --- a/tests/spec/115-follow-unfollow.js +++ b/tests/spec/115-follow-unfollow.js @@ -1,7 +1,8 @@ import { accountProfileFollowButton, accountProfileMoreOptionsButton, closeDialogButton, - getNthDialogOptionsOption + getNthDialogOptionsOption, + sleep } from '../utils' import { loginAsFoobar } from '../roles' import { unfollowAs } from '../serverActions' @@ -16,19 +17,33 @@ test('Can follow and unfollow an account from the profile page', async t => { .navigateTo('/accounts/5') .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow') .expect(accountProfileFollowButton.getAttribute('title')).eql('Follow') + await sleep(500) + await t .click(accountProfileMoreOptionsButton) + await sleep(500) + await t .expect(getNthDialogOptionsOption(1).innerText).contains('Mention @baz') .expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz') + await sleep(500) + await t .click(getNthDialogOptionsOption(2)) .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow') .expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow') + await sleep(500) + await t .click(accountProfileMoreOptionsButton) .expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @baz') + await sleep(500) + await t .click(getNthDialogOptionsOption(2)) .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow') .expect(accountProfileFollowButton.getAttribute('title')).eql('Follow') + await sleep(500) + await t .click(accountProfileMoreOptionsButton) .expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz') + await sleep(500) + await t .click(closeDialogButton) .expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow') .expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')