2018-03-27 07:02:55 +00:00
|
|
|
import {
|
2018-12-04 07:23:29 +00:00
|
|
|
composeButton,
|
|
|
|
getNthStatus,
|
|
|
|
scrollToStatus,
|
|
|
|
modalDialog,
|
|
|
|
sleep,
|
|
|
|
notificationsNavButton,
|
|
|
|
getUrl,
|
|
|
|
getNthStatusSelector,
|
|
|
|
composeModalEmojiButton,
|
|
|
|
composeModalInput,
|
|
|
|
composeModalComposeButton
|
2018-03-27 07:02:55 +00:00
|
|
|
} from '../utils'
|
2018-05-26 20:51:41 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-04-08 23:56:20 +00:00
|
|
|
import { Selector as $ } from 'testcafe'
|
2018-03-27 07:02:55 +00:00
|
|
|
|
|
|
|
fixture`108-compose-dialog.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('can compose using a dialog', async t => {
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
2018-04-11 04:42:29 +00:00
|
|
|
await scrollToStatus(t, 15)
|
2018-04-01 05:08:24 +00:00
|
|
|
await t.expect(modalDialog.exists).notOk()
|
2018-03-30 15:19:18 +00:00
|
|
|
.expect(composeButton.getAttribute('aria-label')).eql('Compose')
|
|
|
|
await sleep(2000)
|
2018-03-27 15:38:40 +00:00
|
|
|
await t.click(composeButton)
|
2018-03-27 07:02:55 +00:00
|
|
|
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
|
2018-12-04 07:23:29 +00:00
|
|
|
.typeText(composeModalInput, 'hello from the modal')
|
|
|
|
.click(composeModalComposeButton)
|
2018-04-01 05:08:24 +00:00
|
|
|
.expect(modalDialog.exists).notOk()
|
2018-04-11 05:38:10 +00:00
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
.navigateTo('/')
|
|
|
|
.hover(getNthStatus(0))
|
2018-08-30 04:42:57 +00:00
|
|
|
.expect(getNthStatus(0).innerText).contains('hello from the modal', { timeout: 20000 })
|
2018-03-27 07:02:55 +00:00
|
|
|
})
|
2018-04-08 23:56:20 +00:00
|
|
|
|
|
|
|
test('can use emoji dialog within compose dialog', async t => {
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
2018-04-11 04:42:29 +00:00
|
|
|
await scrollToStatus(t, 15)
|
2018-04-08 23:56:20 +00:00
|
|
|
await t.expect(composeButton.getAttribute('aria-label')).eql('Compose')
|
|
|
|
await sleep(2000)
|
|
|
|
await t.click(composeButton)
|
2018-12-04 07:23:29 +00:00
|
|
|
.click(composeModalEmojiButton)
|
2018-04-08 23:56:20 +00:00
|
|
|
.click($('button img[title=":blobpats:"]'))
|
2018-12-04 07:23:29 +00:00
|
|
|
.expect(composeModalInput.value).eql(':blobpats: ')
|
|
|
|
.click(composeModalComposeButton)
|
2018-04-08 23:56:20 +00:00
|
|
|
.expect(modalDialog.exists).notOk()
|
2018-04-11 05:38:10 +00:00
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
.navigateTo('/')
|
2018-08-30 04:42:57 +00:00
|
|
|
await t.expect($(`${getNthStatusSelector(0)} img[alt=":blobpats:"]`).exists).ok({ timeout: 20000 })
|
2018-04-10 01:30:15 +00:00
|
|
|
})
|