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