2019-10-13 03:06:04 +02:00
|
|
|
import {
|
|
|
|
composeInput, getNthAutosuggestionResult, sleep
|
|
|
|
} from '../utils'
|
|
|
|
import { loginAsFoobar } from '../roles'
|
|
|
|
import { postAs } from '../serverActions'
|
|
|
|
|
|
|
|
fixture`131-compose-autosuggest.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
const timeout = 30000
|
|
|
|
|
|
|
|
test('autosuggests hashtags', async t => {
|
|
|
|
await postAs('admin', 'hello #blank and hello #blanka')
|
|
|
|
await sleep(1000)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.hover(composeInput)
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
2020-05-03 03:02:29 +02:00
|
|
|
.typeText(composeInput, 'hey #blank')
|
2019-10-13 03:06:04 +02:00
|
|
|
.expect(getNthAutosuggestionResult(1).innerText).contains('blank', { timeout })
|
2019-11-10 05:01:32 +01:00
|
|
|
.expect(getNthAutosuggestionResult(1).find('.sr-only').innerText).contains('#blank', { timeout })
|
2019-10-13 03:06:04 +02:00
|
|
|
.click(getNthAutosuggestionResult(1), { timeout })
|
|
|
|
.expect(composeInput.value).eql('hey #blank ')
|
2021-01-25 03:26:40 +01:00
|
|
|
.typeText(composeInput, 'and also #blank')
|
2019-10-13 03:06:04 +02:00
|
|
|
.click(getNthAutosuggestionResult(1), { timeout })
|
|
|
|
.expect(composeInput.value).eql('hey #blank and also #blank ')
|
|
|
|
.typeText(composeInput, 'and also #blanka')
|
|
|
|
.expect(getNthAutosuggestionResult(1).innerText).contains('blanka', { timeout })
|
|
|
|
.pressKey('enter')
|
|
|
|
.expect(composeInput.value).eql('hey #blank and also #blank and also #blanka ')
|
|
|
|
})
|