2018-02-20 02:04:37 +01:00
|
|
|
import { Selector as $ } from 'testcafe'
|
2018-05-26 22:51:41 +02:00
|
|
|
import {
|
|
|
|
communityNavButton,
|
|
|
|
getFirstVisibleStatus, getNthStatus, getUrl, localTimelineNavButton, notificationsNavButton,
|
|
|
|
validateTimeline
|
|
|
|
} from '../utils'
|
2019-04-13 20:04:39 +02:00
|
|
|
import { homeTimeline, notifications, localTimeline, favorites, directMessages } from '../fixtures'
|
2018-05-26 22:51:41 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-02-20 02:04:37 +01:00
|
|
|
|
2018-03-07 06:32:51 +01:00
|
|
|
fixture`003-basic-timeline-spec.js`
|
2018-02-20 03:25:59 +01:00
|
|
|
.page`http://localhost:4002`
|
2018-02-20 02:04:37 +01:00
|
|
|
|
|
|
|
test('Shows the home timeline', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-06-09 06:53:45 +02:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
|
|
|
.hover(getNthStatus(1))
|
2018-02-24 23:49:28 +01:00
|
|
|
.expect(getFirstVisibleStatus().exists).ok()
|
|
|
|
.expect(getFirstVisibleStatus().hasAttribute('aria-setsize')).ok()
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getFirstVisibleStatus().getAttribute('aria-posinset')).eql('1')
|
2018-02-20 02:04:37 +01:00
|
|
|
|
|
|
|
await validateTimeline(t, homeTimeline)
|
|
|
|
|
2018-11-12 21:59:47 +01:00
|
|
|
await t.expect(getFirstVisibleStatus().getAttribute('aria-setsize')).eql('47')
|
2018-02-20 02:04:37 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows notifications', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-06-09 06:53:45 +02:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
2018-05-26 22:51:41 +02:00
|
|
|
.click(notificationsNavButton)
|
2018-02-20 02:04:37 +01:00
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
|
|
|
|
await validateTimeline(t, notifications)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows the local timeline', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-06-09 06:53:45 +02:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
2018-05-26 22:51:41 +02:00
|
|
|
.click(localTimelineNavButton)
|
2018-02-20 02:18:40 +01:00
|
|
|
.expect(getUrl()).contains('/local')
|
2018-02-20 02:04:37 +01:00
|
|
|
|
|
|
|
await validateTimeline(t, localTimeline)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Shows the federated timeline', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-06-09 06:53:45 +02:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
2018-05-26 22:51:41 +02:00
|
|
|
.click(communityNavButton)
|
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-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-06-09 06:53:45 +02:00
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
2018-05-26 22:51:41 +02:00
|
|
|
.click(communityNavButton)
|
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
|
|
|
})
|
2019-04-13 20:04:39 +02:00
|
|
|
|
|
|
|
test('Shows direct messages', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
|
|
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
|
|
|
.click(communityNavButton)
|
|
|
|
.click($('a').withText('Direct messages'))
|
|
|
|
.expect(getUrl()).contains('/direct')
|
|
|
|
|
|
|
|
await validateTimeline(t, directMessages)
|
|
|
|
})
|