1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-12 10:16:16 +01:00
Pinafore-Web-Client-Frontend/tests/spec/028-report-ui.js
2019-03-23 18:16:20 -07:00

40 lines
1.3 KiB
JavaScript

import {
accountProfileMoreOptionsButton,
confirmationDialogCancelButton, getNthStatus,
getNthStatusOptionsButton,
modalDialog
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
fixture`028-report-ui.js`
.page`http://localhost:4002`
test('Can open a report UI from a status', async t => {
await loginAsFoobar(t)
await t
.hover(getNthStatus(1))
.click(getNthStatusOptionsButton(1))
.click($('.modal-dialog button').withText('Report'))
.expect(modalDialog.innerText).contains('You are reporting @quux')
.expect(modalDialog.find('.recent-statuses').innerText).contains('pinned toot 2', {
timeout: 30000
})
.click(confirmationDialogCancelButton)
.expect(modalDialog.exists).notOk()
})
test('Can open a report UI from an account', async t => {
await loginAsFoobar(t)
await t
.navigateTo('/accounts/3')
.click(accountProfileMoreOptionsButton)
.click($('.modal-dialog button').withText('Report'))
.expect(modalDialog.innerText).contains('You are reporting @quux')
.expect(modalDialog.find('.recent-statuses').innerText).contains('pinned toot 2', {
timeout: 30000
})
.click(confirmationDialogCancelButton)
.expect(modalDialog.exists).notOk()
})