1
0
mirror of https://github.com/nolanlawson/pinafore synced 2025-02-02 22:57:36 +01:00
Pinafore-Web-Client-Frontend/tests/spec/108-compose-dialog.js

45 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-03-27 00:02:55 -07:00
import {
2018-04-10 22:38:10 -07:00
composeButton, getNthStatus, scrollToStatus, modalDialog, sleep,
notificationsNavButton, getUrl
2018-03-27 00:02:55 -07:00
} from '../utils'
import { foobarRole } from '../roles'
import { Selector as $ } from 'testcafe'
2018-03-27 00:02:55 -07:00
fixture`108-compose-dialog.js`
.page`http://localhost:4002`
test('can compose using a dialog', async t => {
await t.useRole(foobarRole)
2018-04-10 21:42:29 -07:00
await scrollToStatus(t, 15)
2018-03-31 22:08:24 -07:00
await t.expect(modalDialog.exists).notOk()
2018-03-30 08:19:18 -07:00
.expect(composeButton.getAttribute('aria-label')).eql('Compose')
await sleep(2000)
2018-03-27 08:38:40 -07:00
await t.click(composeButton)
2018-03-27 00:02:55 -07:00
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
.typeText(modalDialog.find('.compose-box-input'), 'hello from the modal')
.click(modalDialog.find('.compose-box-button-compose'))
2018-03-31 22:08:24 -07:00
.expect(modalDialog.exists).notOk()
2018-04-10 22:38:10 -07:00
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.navigateTo('/')
.hover(getNthStatus(0))
.expect(getNthStatus(0).innerText).contains('hello from the modal', {timeout: 20000})
2018-03-27 00:02:55 -07:00
})
test('can use emoji dialog within compose dialog', async t => {
await t.useRole(foobarRole)
2018-04-10 21:42:29 -07:00
await scrollToStatus(t, 15)
await t.expect(composeButton.getAttribute('aria-label')).eql('Compose')
await sleep(2000)
await t.click(composeButton)
.click(modalDialog.find('.compose-box-toolbar button:nth-child(1)'))
.click($('button img[title=":blobpats:"]'))
.expect(modalDialog.find('.compose-box-input').value).eql(':blobpats: ')
.click(modalDialog.find('.compose-box-button-compose'))
.expect(modalDialog.exists).notOk()
2018-04-10 22:38:10 -07:00
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.navigateTo('/')
await t.expect(getNthStatus(0).find('img[alt=":blobpats:"]').exists).ok({timeout: 20000})
})