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