2018-05-26 20:51:41 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-02-25 05:27:32 +00:00
|
|
|
import { getNthStatus, getUrl, homeNavButton, notificationsNavButton, validateTimeline } from '../utils'
|
2018-03-16 17:06:02 +00:00
|
|
|
import { favoriteStatusAs } from '../serverActions'
|
2018-02-25 05:27:32 +00:00
|
|
|
import { notifications } from '../fixtures'
|
|
|
|
|
2018-03-07 05:32:51 +00:00
|
|
|
fixture`102-notifications.js`
|
2018-02-25 05:27:32 +00:00
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('shows unread notifications', async t => {
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-02-25 05:27:32 +00:00
|
|
|
.hover(getNthStatus(0))
|
2018-03-07 04:44:05 +00:00
|
|
|
.hover(getNthStatus(2))
|
|
|
|
.hover(getNthStatus(4))
|
|
|
|
.hover(getNthStatus(5))
|
2018-02-25 05:27:32 +00:00
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
2018-03-07 04:44:05 +00:00
|
|
|
let statusId = (await getNthStatus(5).find('.status-relative-date').getAttribute('href'))
|
|
|
|
.split('/').slice(-1)[0]
|
2018-03-16 17:06:02 +00:00
|
|
|
await favoriteStatusAs('admin', statusId)
|
2018-02-25 05:27:32 +00:00
|
|
|
await t
|
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (1)')
|
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (current page)')
|
|
|
|
await validateTimeline(t, [
|
|
|
|
{
|
|
|
|
favoritedBy: 'admin',
|
|
|
|
content: 'this is followers-only'
|
|
|
|
}
|
|
|
|
].concat(notifications))
|
|
|
|
await t
|
|
|
|
.click(homeNavButton)
|
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
|
|
|
})
|