pinafore/tests/spec/003-basic-timeline-spec.js

75 lines
2.3 KiB
JavaScript
Raw Normal View History

2018-02-20 01:04:37 +00:00
import { Selector as $ } from 'testcafe'
import {
communityNavButton,
getFirstVisibleStatus, getNthStatus, getUrl, localTimelineNavButton, notificationsNavButton,
validateTimeline
} from '../utils'
2018-02-20 01:04:37 +00:00
import { homeTimeline, notifications, localTimeline, favorites } from '../fixtures'
import { loginAsFoobar } from '../roles'
2018-02-20 01:04:37 +00:00
2018-03-07 05:32:51 +00:00
fixture`003-basic-timeline-spec.js`
2018-02-20 02:25:59 +00:00
.page`http://localhost:4002`
2018-02-20 01:04:37 +00:00
test('Shows the home timeline', async t => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).exists).ok({timeout: 30000})
2018-03-04 20:46:46 +00:00
.hover(getNthStatus(0))
2018-02-24 22:49:28 +00:00
.expect(getFirstVisibleStatus().exists).ok()
.expect(getFirstVisibleStatus().hasAttribute('aria-setsize')).ok()
.expect(getFirstVisibleStatus().getAttribute('aria-posinset')).eql('0')
2018-02-20 01:04:37 +00:00
await validateTimeline(t, homeTimeline)
2018-02-24 22:49:28 +00:00
await t.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql('49')
2018-02-20 01:04:37 +00:00
})
test('Shows notifications', async t => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).exists).ok({timeout: 30000})
.click(notificationsNavButton)
2018-02-20 01:04:37 +00:00
.expect(getUrl()).contains('/notifications')
await validateTimeline(t, notifications)
})
test('Shows the local timeline', async t => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).exists).ok({timeout: 30000})
.click(localTimelineNavButton)
2018-02-20 01:18:40 +00:00
.expect(getUrl()).contains('/local')
2018-02-20 01:04:37 +00:00
await validateTimeline(t, localTimeline)
})
test('Shows the federated timeline', async t => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).exists).ok({timeout: 30000})
.click(communityNavButton)
2018-02-20 01:04:37 +00: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 => {
await loginAsFoobar(t)
await t
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(0).exists).ok({timeout: 30000})
.click(communityNavButton)
2018-02-20 01:04:37 +00:00
.expect(getUrl()).contains('/community')
.click($('a').withText('Favorites'))
.expect(getUrl()).contains('/favorites')
await validateTimeline(t, favorites)
2018-02-20 02:25:59 +00:00
})