2018-05-26 21:51:41 +01:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-03-19 17:09:05 +00:00
|
|
|
import {
|
2019-07-21 23:31:26 +01:00
|
|
|
forceOffline,
|
|
|
|
forceOnline,
|
2019-07-29 03:38:34 +01:00
|
|
|
getNthStatus,
|
|
|
|
homeNavButton,
|
|
|
|
localTimelineNavButton,
|
|
|
|
notificationBadge,
|
|
|
|
notificationsNavButton,
|
|
|
|
sleep,
|
|
|
|
times,
|
|
|
|
validateTimeline
|
2018-03-19 17:09:05 +00:00
|
|
|
} from '../utils'
|
|
|
|
import {
|
|
|
|
postAs
|
|
|
|
} from '../serverActions'
|
|
|
|
|
|
|
|
fixture`107-streaming-gap.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
2019-07-21 23:31:26 +01:00
|
|
|
const timeout = 30000
|
2018-03-19 17:09:05 +00:00
|
|
|
|
2019-07-21 23:31:26 +01:00
|
|
|
test('fills timeline gap while away from local timeline', async t => {
|
2018-05-26 21:51:41 +01:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-03-19 17:09:05 +00:00
|
|
|
.click(localTimelineNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout })
|
|
|
|
.hover(getNthStatus(1))
|
2018-03-19 17:09:05 +00:00
|
|
|
await postAs('admin', 'heyo')
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).contains('heyo', { timeout })
|
2018-03-19 17:09:05 +00:00
|
|
|
.click(homeNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
2018-03-19 17:09:05 +00:00
|
|
|
await postAs('admin', 'posted this while you were away!')
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).contains('posted this while you were away!', { timeout })
|
2018-03-19 17:09:05 +00:00
|
|
|
.click(localTimelineNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(1).innerText).contains('posted this while you were away!', { timeout })
|
|
|
|
.expect(getNthStatus(2).innerText).contains('heyo', { timeout })
|
2019-07-21 23:31:26 +01:00
|
|
|
await sleep(2000)
|
2018-03-19 17:09:05 +00:00
|
|
|
await postAs('admin', 'posted this while you were watching')
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).contains('posted this while you were watching', { timeout })
|
2018-03-19 17:09:05 +00:00
|
|
|
})
|
2019-07-21 23:31:26 +01:00
|
|
|
|
|
|
|
test('fills timeline gap while away from home timeline', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout })
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
await postAs('admin', 'hello world')
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('hello world', { timeout })
|
|
|
|
await forceOffline()
|
|
|
|
await sleep(1000)
|
|
|
|
await postAs('admin', 'posted this while you were offline')
|
|
|
|
await sleep(1000)
|
|
|
|
await forceOnline()
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('posted this while you were offline', { timeout })
|
|
|
|
})
|
|
|
|
|
|
|
|
test('fills timeline gap while away from notifications timeline', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout })
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
await postAs('admin', '@foobar yo yo yo')
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('yo yo yo', { timeout })
|
|
|
|
await forceOffline()
|
|
|
|
await sleep(1000)
|
|
|
|
await postAs('admin', '@foobar mentioning you while you are offline!')
|
|
|
|
await sleep(1000)
|
|
|
|
await forceOnline()
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('mentioning you while you are offline!', { timeout })
|
|
|
|
})
|
|
|
|
|
|
|
|
test('fills timeline gap while away from notifications timeline - badge updates', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout })
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
await postAs('admin', '@foobar hi hi hi')
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('hi hi hi', { timeout })
|
|
|
|
await forceOffline()
|
|
|
|
await sleep(1000)
|
|
|
|
await postAs('admin', '@foobar sneaky mention!')
|
|
|
|
await sleep(1000)
|
|
|
|
await forceOnline()
|
|
|
|
await t
|
|
|
|
.expect(notificationBadge.innerText).eql('1', { timeout })
|
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(notificationBadge.exists).notOk()
|
|
|
|
.expect(getNthStatus(1).innerText).contains('sneaky mention!', { timeout })
|
|
|
|
})
|
2019-07-29 03:38:34 +01:00
|
|
|
|
|
|
|
test('fills a large gap while away from home timeline', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout })
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
await postAs('admin', 'hello hello world')
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains('hello hello world', { timeout })
|
|
|
|
await forceOffline()
|
|
|
|
await sleep(1000)
|
|
|
|
const GAP_SIZE = 60
|
|
|
|
for (let i = 0; i < GAP_SIZE; i++) {
|
|
|
|
await postAs('admin', `posted while offline #${i + 1}`)
|
|
|
|
}
|
|
|
|
await sleep(1000)
|
|
|
|
await forceOnline()
|
|
|
|
await t.expect(getNthStatus(1).innerText).contains(`posted while offline #${GAP_SIZE}`, {
|
|
|
|
timeout: timeout * 2
|
|
|
|
})
|
|
|
|
const expected = times(GAP_SIZE, i => ({ content: `posted while offline #${GAP_SIZE - i}` }))
|
|
|
|
.concat([{ content: 'hello hello world' }])
|
|
|
|
await validateTimeline(t, expected)
|
|
|
|
})
|