2018-05-26 20:51:41 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-06-09 04:54:21 +00:00
|
|
|
import {
|
2018-11-12 20:59:47 +00:00
|
|
|
getNthStatus, getUrl, homeNavButton, notificationsNavButton
|
2018-06-09 04:54:21 +00:00
|
|
|
} from '../utils'
|
2018-11-12 20:59:47 +00:00
|
|
|
import { favoriteStatusAs, postAs } from '../serverActions'
|
2018-02-25 05:27:32 +00:00
|
|
|
|
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-11-12 20:59:47 +00:00
|
|
|
let { id } = await postAs('foobar', 'somebody please favorite this to validate me')
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-02-25 05:27:32 +00:00
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
2018-11-12 20:59:47 +00:00
|
|
|
await favoriteStatusAs('admin', id)
|
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)')
|
2018-11-12 20:59:47 +00:00
|
|
|
.expect(getNthStatus(0).innerText).contains('somebody please favorite this to validate me')
|
|
|
|
.expect(getNthStatus(0).innerText).match(/admin\s+favorited your status/)
|
2018-02-25 05:27:32 +00:00
|
|
|
await t
|
|
|
|
.click(homeNavButton)
|
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
|
|
|
})
|