pinafore/tests/spec/108-compose-dialog.js
Nolan Lawson 0022286b46
fix: first stab at i18n, extract English strings, add French (#1904)
* first attempt

* progress

* working

* working

* test timeago

* rm

* get timeago working

* reduce size

* fix whitespace

* more intl stuff

* more effort

* more work

* more progress

* more work

* more intl

* set lang=LOCALE

* flatten

* more work

* add ltr/rtl

* more work

* add comments

* yet more work

* still more work

* more work

* fix tests

* more test and string fixes

* fix test

* fix test

* fix test

* fix some more strings, add test

* fix snackbar

* fix }

* fix typo

* fix english

* measure perf

* start on french

* more work on french

* more french

* more french

* finish french

* fix some missing translations

* update readme

* fix test
2020-11-29 14:13:27 -08:00

63 lines
2 KiB
JavaScript

import {
composeButton,
getNthStatus,
scrollToStatus,
modalDialog,
sleep,
notificationsNavButton,
getUrl,
getNthStatusSelector,
composeModalEmojiButton,
composeModalInput,
composeModalComposeButton, emojiSearchInput, firstEmojiInPicker
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
fixture`108-compose-dialog.js`
.page`http://localhost:4002`
test('can compose using a dialog', async t => {
await loginAsFoobar(t)
await scrollToStatus(t, 16)
await t.expect(modalDialog.exists).notOk()
.expect(composeButton.getAttribute('aria-label')).eql('Compose toot')
await sleep(2000)
await t.click(composeButton)
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
.typeText(composeModalInput, 'hello from the modal')
.click(composeModalComposeButton)
.expect(modalDialog.exists).notOk()
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.navigateTo('/')
.hover(getNthStatus(1))
.expect(getNthStatus(1).innerText).contains('hello from the modal', { timeout: 20000 })
})
// Skipped because TestCafé seems to believe the elements are not visible when they are.
// Tested manually and it's fine; probably a TestCafé bug.
test.skip('can use emoji dialog within compose dialog', async t => {
await loginAsFoobar(t)
await scrollToStatus(t, 16)
await t.expect(composeButton.getAttribute('aria-label')).eql('Compose toot')
await sleep(2000)
await t.click(composeButton)
await sleep(1000)
await t
.click(composeModalEmojiButton)
await sleep(1000)
await t
.typeText(emojiSearchInput, 'blobpats')
await sleep(1000)
await t
.click(firstEmojiInPicker)
.expect(composeModalInput.value).eql(':blobpats: ')
.click(composeModalComposeButton)
.expect(modalDialog.exists).notOk()
.click(notificationsNavButton)
.expect(getUrl()).contains('/notifications')
.navigateTo('/')
await t.expect($(`${getNthStatusSelector(1)} img[alt=":blobpats:"]`).exists).ok({ timeout: 20000 })
})