Pinafore-Web-Client-Frontend/tests/spec/114-mute-unmute.js

55 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2018-04-15 07:18:48 +02:00
import {
accountProfileFollowButton,
accountProfileMoreOptionsButton,
communityNavButton,
getNthSearchResult,
getNthStatus,
getNthStatusOptionsButton,
getUrl,
modalDialog,
closeDialogButton,
2022-04-28 17:18:50 +02:00
confirmationDialogOKButton, sleep, getDialogOptionWithText
2018-04-15 07:18:48 +02:00
} from '../utils'
import { Selector as $ } from 'testcafe'
import { loginAsFoobar } from '../roles'
2018-04-15 07:18:48 +02:00
import { postAs } from '../serverActions'
fixture`114-mute-unmute.js`
.page`http://localhost:4002`
test('Can mute and unmute an account', async t => {
await loginAsFoobar(t)
2019-08-03 22:49:37 +02:00
const post = 'blah blah blah'
2018-04-15 07:18:48 +02:00
await postAs('admin', post)
await t.expect(getNthStatus(1).innerText).contains(post, { timeout: 20000 })
.click(getNthStatusOptionsButton(1))
await sleep(1000)
await t
2022-04-28 17:18:50 +02:00
.click(getDialogOptionWithText('Mute @admin'))
await sleep(1000)
await t
.click(confirmationDialogOKButton)
2018-04-15 07:18:48 +02:00
.expect(modalDialog.exists).notOk()
await sleep(1000)
await t
2018-04-15 07:18:48 +02:00
.click(communityNavButton)
.click($('a[href="/muted"]'))
.expect(getNthSearchResult(1).innerText).contains('@admin')
.click(getNthSearchResult(1))
.expect(getUrl()).contains('/accounts/1')
.click(accountProfileMoreOptionsButton)
await sleep(1000)
await t
2022-04-28 17:18:50 +02:00
.click(getDialogOptionWithText('Unmute @admin'))
await sleep(1000)
await t
2018-04-15 07:18:48 +02:00
.click(accountProfileMoreOptionsButton)
2022-04-28 17:18:50 +02:00
.expect(getDialogOptionWithText('Mute @admin').exists).ok()
await sleep(1000)
await t
2018-04-19 18:34:49 +02:00
.click(closeDialogButton)
.expect(accountProfileFollowButton.getAttribute('aria-label')).eql('Unfollow')
.expect(accountProfileFollowButton.getAttribute('title')).eql('Unfollow')
2018-04-15 07:18:48 +02:00
})