pinafore/tests/spec/09-threads.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-02-21 05:08:26 +00:00
import { Selector as $ } from 'testcafe'
import { getNthStatus, getUrl, validateTimeline, scrollToBottomOfTimeline } from '../utils'
import { foobarRole } from '../roles'
import { quuxThread } from '../fixtures'
fixture`09-threads.js`
.page`http://localhost:4002`
test('Shows a thread', async t => {
await t.useRole(foobarRole)
.click($('a').withText('quux'))
await scrollToBottomOfTimeline(t)
await t
.click(getNthStatus(26))
2018-03-06 06:36:54 +00:00
.expect(getUrl()).contains('/statuses/')
2018-02-21 05:08:26 +00:00
await validateTimeline(t, quuxThread)
await t.expect(getNthStatus(24).getAttribute('aria-setsize')).eql('25')
})
test('Scrolls to proper point in thread', async t => {
await t.useRole(foobarRole)
.click($('a').withText('quux'))
.hover(getNthStatus(0))
.hover(getNthStatus(2))
.hover(getNthStatus(4))
.hover(getNthStatus(6))
.hover(getNthStatus(8))
.hover(getNthStatus(10))
.click(getNthStatus(10))
2018-03-06 06:36:54 +00:00
.expect(getUrl()).contains('/statuses/')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(16).innerText).contains('unlisted thread 17')
.expect(Math.round(getNthStatus(16).boundingClientRect.top))
.eql(Math.round($('.container').boundingClientRect.top))
2018-02-21 05:30:16 +00:00
})