fedilove-ui/tests/spec/102-notifications.js

27 lines
1.1 KiB
JavaScript
Raw Normal View History

import { loginAsFoobar } from '../roles'
import {
getNthStatus, getUrl, homeNavButton, notificationsNavButton
} from '../utils'
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 => {
let { id } = await postAs('foobar', 'somebody please favorite this to validate me')
await loginAsFoobar(t)
await t
2018-02-25 05:27:32 +00:00
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
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)')
.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')
})