2018-02-20 02:04:37 +01:00
|
|
|
import { Selector as $ } from 'testcafe'
|
2018-02-20 03:25:59 +01:00
|
|
|
import { getUrl, validateTimeline } from '../utils'
|
2018-02-20 02:04:37 +01:00
|
|
|
import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures'
|
2018-02-20 02:18:40 +01:00
|
|
|
import { foobarRole } from '../roles'
|
2018-02-20 02:04:37 +01:00
|
|
|
|
2018-02-20 03:25:59 +01:00
|
|
|
fixture`03-basic-timeline-spec.js`
|
|
|
|
.page`http://localhost:4002`
|
2018-02-20 02:04:37 +01:00
|
|
|
|
|
|
|
const firstArticle = $('.virtual-list-item[aria-hidden=false] .status-article')
|
|
|
|
|
|
|
|
test('Shows the home timeline', async t => {
|
2018-02-20 02:18:40 +01:00
|
|
|
await t.useRole(foobarRole)
|
2018-02-20 02:04:37 +01:00
|
|
|
.expect(firstArticle.hasAttribute('aria-setsize')).ok()
|
|
|
|
.expect(firstArticle.getAttribute('aria-posinset')).eql('0')
|
|
|
|
|
|
|
|
await validateTimeline(t, homeTimeline)
|
|
|
|
|
|
|
|
await t.expect(firstArticle.getAttribute('aria-setsize')).eql('49')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows notifications', async t => {
|
2018-02-20 02:18:40 +01:00
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click($('nav a[aria-label=Notifications]'))
|
2018-02-20 02:04:37 +01:00
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
|
|
|
|
await validateTimeline(t, notifications)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows the local timeline', async t => {
|
2018-02-20 02:18:40 +01:00
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click($('nav a[aria-label=Local]'))
|
|
|
|
.expect(getUrl()).contains('/local')
|
2018-02-20 02:04:37 +01:00
|
|
|
|
|
|
|
await validateTimeline(t, localTimeline)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows the federated timeline', async t => {
|
2018-02-20 02:18:40 +01:00
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click($('nav a[aria-label=Community]'))
|
2018-02-20 02:04:37 +01:00
|
|
|
.expect(getUrl()).contains('/community')
|
|
|
|
.click($('a').withText('Federated'))
|
|
|
|
.expect(getUrl()).contains('/federated')
|
|
|
|
|
|
|
|
await validateTimeline(t, localTimeline) // local is same as federated in this case
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows favorites', async t => {
|
2018-02-20 02:18:40 +01:00
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click($('nav a[aria-label=Community]'))
|
2018-02-20 02:04:37 +01:00
|
|
|
.expect(getUrl()).contains('/community')
|
|
|
|
.click($('a').withText('Favorites'))
|
|
|
|
.expect(getUrl()).contains('/favorites')
|
|
|
|
|
|
|
|
await validateTimeline(t, favorites)
|
2018-02-20 03:25:59 +01:00
|
|
|
})
|