semaphore/tests/spec/108-compose-dialog.js

52 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-03-27 08:02:55 +01:00
import {
composeButton, getNthStatus, scrollToStatus, scrollToTopOfTimeline, modalDialog, sleep, showMoreButton,
scrollContainerToTop
} from '../utils'
import { foobarRole } from '../roles'
import { Selector as $ } from 'testcafe'
2018-03-27 08:02:55 +01:00
fixture`108-compose-dialog.js`
.page`http://localhost:4002`
test('can compose using a dialog', async t => {
await t.useRole(foobarRole)
2018-04-11 05:19:29 +01:00
await scrollToStatus(t, 20)
2018-04-01 06:08:24 +01:00
await t.expect(modalDialog.exists).notOk()
2018-03-30 16:19:18 +01:00
.expect(composeButton.getAttribute('aria-label')).eql('Compose')
await sleep(2000)
2018-03-27 16:38:40 +01:00
await t.click(composeButton)
2018-03-27 08:02:55 +01: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-04-01 06:08:24 +01:00
.expect(modalDialog.exists).notOk()
2018-04-11 05:19:29 +01:00
await sleep(10000)
2018-03-27 08:02:55 +01:00
await scrollToTopOfTimeline(t)
await t.hover(getNthStatus(0))
await scrollContainerToTop()
await t
.expect(showMoreButton.innerText).contains('Show 1 more')
.click(showMoreButton)
await t.expect(getNthStatus(0).innerText).contains('hello from the modal', {timeout: 20000})
})
test('can use emoji dialog within compose dialog', async t => {
await t.useRole(foobarRole)
2018-04-11 05:19:29 +01:00
await scrollToStatus(t, 20)
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-11 05:19:29 +01:00
await sleep(10000)
await scrollToTopOfTimeline(t)
await t.hover(getNthStatus(0))
await scrollContainerToTop()
await t
.expect(showMoreButton.innerText).contains('Show 1 more')
.click(showMoreButton)
await t.expect(getNthStatus(0).find('img[alt=":blobpats:"]').exists).ok({timeout: 20000})
})