pinafore/tests/spec/005-status-types.js

47 lines
3 KiB
JavaScript
Raw Normal View History

2018-02-21 05:08:26 +00:00
import { getNthStatus } from '../utils'
import { loginAsFoobar } from '../roles'
2018-02-20 02:24:22 +00:00
2018-03-07 05:32:51 +00:00
fixture`005-status-types.js`
2018-02-20 02:25:59 +00:00
.page`http://localhost:4002`
2018-02-20 02:24:22 +00:00
test('shows direct vs followers-only vs regular', async t => {
await loginAsFoobar(t)
await t
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(1).getAttribute('aria-label')).eql('Status by admin')
.expect(getNthStatus(1).find('.status-content').innerText).contains('notification of unlisted message')
.expect(getNthStatus(1).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-04-19 03:43:13 +00:00
.eql('Boost')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(1).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).notOk()
.expect(getNthStatus(2).getAttribute('aria-label')).eql('Status by admin')
.expect(getNthStatus(2).find('.status-content').innerText).contains('notification of followers-only message')
.expect(getNthStatus(2).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-04-19 03:43:13 +00:00
.eql('Cannot be boosted because this is followers-only')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(2).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).ok()
.expect(getNthStatus(3).getAttribute('aria-label')).eql('Direct message by admin')
.expect(getNthStatus(3).find('.status-content').innerText).contains('notification of direct message')
.expect(getNthStatus(3).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-04-19 03:43:13 +00:00
.eql('Cannot be boosted because this is a direct message')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(3).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).ok()
2018-02-20 02:24:22 +00:00
})
test('shows direct vs followers-only vs regular in notifications', async t => {
await loginAsFoobar(t)
await t
2018-02-20 02:24:22 +00:00
.navigateTo('/notifications')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(2).getAttribute('aria-label')).eql('Status by admin')
.expect(getNthStatus(2).find('.status-content').innerText).contains('notification of unlisted message')
.expect(getNthStatus(2).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-02-20 02:24:22 +00:00
.eql('Boost')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(2).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).notOk()
.expect(getNthStatus(3).getAttribute('aria-label')).eql('Status by admin')
.expect(getNthStatus(3).find('.status-content').innerText).contains('notification of followers-only message')
.expect(getNthStatus(3).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-02-20 02:24:22 +00:00
.eql('Cannot be boosted because this is followers-only')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(3).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).ok()
.expect(getNthStatus(4).getAttribute('aria-label')).eql('Direct message by admin')
.expect(getNthStatus(4).find('.status-content').innerText).contains('notification of direct message')
.expect(getNthStatus(4).find('.status-toolbar button:nth-child(2)').getAttribute('aria-label'))
2018-02-20 02:24:22 +00:00
.eql('Cannot be boosted because this is a direct message')
2018-02-21 05:08:26 +00:00
.expect(getNthStatus(4).find('.status-toolbar button:nth-child(2)').hasAttribute('disabled')).ok()
2018-02-20 02:24:22 +00:00
})