test: fix flakey test (#1957)
This commit is contained in:
parent
5b04db8442
commit
b451093ece
|
@ -1,7 +1,8 @@
|
||||||
import {
|
import {
|
||||||
accountProfileFollowButton,
|
accountProfileFollowButton,
|
||||||
accountProfileMoreOptionsButton, closeDialogButton,
|
accountProfileMoreOptionsButton, closeDialogButton,
|
||||||
getNthDialogOptionsOption
|
getNthDialogOptionsOption,
|
||||||
|
sleep
|
||||||
} from '../utils'
|
} from '../utils'
|
||||||
import { loginAsFoobar } from '../roles'
|
import { loginAsFoobar } from '../roles'
|
||||||
import { unfollowAs } from '../serverActions'
|
import { unfollowAs } from '../serverActions'
|
||||||
|
@ -16,19 +17,33 @@ test('Can follow and unfollow an account from the profile page', async t => {
|
||||||
.navigateTo('/accounts/5')
|
.navigateTo('/accounts/5')
|
||||||
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
||||||
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(accountProfileMoreOptionsButton)
|
.click(accountProfileMoreOptionsButton)
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.expect(getNthDialogOptionsOption(1).innerText).contains('Mention @baz')
|
.expect(getNthDialogOptionsOption(1).innerText).contains('Mention @baz')
|
||||||
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(getNthDialogOptionsOption(2))
|
.click(getNthDialogOptionsOption(2))
|
||||||
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
|
||||||
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow')
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(accountProfileMoreOptionsButton)
|
.click(accountProfileMoreOptionsButton)
|
||||||
.expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @baz')
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Unfollow @baz')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(getNthDialogOptionsOption(2))
|
.click(getNthDialogOptionsOption(2))
|
||||||
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
||||||
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(accountProfileMoreOptionsButton)
|
.click(accountProfileMoreOptionsButton)
|
||||||
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
.expect(getNthDialogOptionsOption(2).innerText).contains('Follow @baz')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
.click(closeDialogButton)
|
.click(closeDialogButton)
|
||||||
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Follow')
|
||||||
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
.expect(accountProfileFollowButton.getAttribute('title')).eql('Follow')
|
||||||
|
|
Loading…
Reference in New Issue