2018-05-26 20:51:41 +00:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-03-11 04:24:07 +00:00
|
|
|
import {
|
|
|
|
clickToNotificationsAndBackHome, forceOffline, forceOnline, getNthStatus, getUrl, homeNavButton,
|
2018-03-21 00:41:39 +00:00
|
|
|
notificationsNavButton
|
2018-03-11 04:24:07 +00:00
|
|
|
} from '../utils'
|
2018-03-16 17:06:02 +00:00
|
|
|
import { deleteAs, postAs, postReplyAs } from '../serverActions'
|
2018-03-11 00:21:10 +00:00
|
|
|
|
|
|
|
fixture`105-deletes.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('deleted statuses are removed from the timeline', async t => {
|
2019-08-03 20:49:37 +00:00
|
|
|
const timeout = 20000
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
2019-08-03 20:49:37 +00:00
|
|
|
const status = await postAs('admin', "I'm gonna delete this")
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).contains("I'm gonna delete this", { timeout })
|
2018-03-16 17:06:02 +00:00
|
|
|
await deleteAs('admin', status.id)
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).notContains("I'm gonna delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
await clickToNotificationsAndBackHome(t)
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).notContains("I'm gonna delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
await t.navigateTo('/notifications')
|
|
|
|
await forceOffline()
|
|
|
|
await t.click(homeNavButton)
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).notContains("I'm gonna delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
await forceOnline()
|
|
|
|
await t
|
|
|
|
.navigateTo('/')
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(1).innerText).notContains("I'm gonna delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
test('deleted statuses are removed from threads', async t => {
|
2019-08-03 20:49:37 +00:00
|
|
|
const timeout = 20000
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
2019-08-03 20:49:37 +00:00
|
|
|
const status = await postAs('admin', "I won't delete this")
|
|
|
|
const reply = await postReplyAs('admin', 'But I will delete this', status.id)
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(1).innerText).contains('But I will delete this', { timeout })
|
|
|
|
.expect(getNthStatus(2).innerText).contains("I won't delete this", { timeout })
|
|
|
|
.click(getNthStatus(2))
|
2018-03-11 04:24:07 +00:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(1).innerText).contains("I won't delete this", { timeout })
|
|
|
|
.expect(getNthStatus(2).innerText).contains('But I will delete this', { timeout })
|
2018-03-16 17:06:02 +00:00
|
|
|
await deleteAs('admin', reply.id)
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.expect(getNthStatus(2).exists).notOk()
|
|
|
|
.expect(getNthStatus(1).innerText).contains("I won't delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
await t.navigateTo('/')
|
|
|
|
await forceOffline()
|
2019-02-28 16:56:25 +00:00
|
|
|
await t.click(getNthStatus(1))
|
2018-03-11 04:24:07 +00:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatus(2).exists).notOk()
|
|
|
|
.expect(getNthStatus(1).innerText).contains("I won't delete this", { timeout })
|
2018-03-11 04:24:07 +00:00
|
|
|
await forceOnline()
|
2018-03-11 00:21:10 +00:00
|
|
|
})
|
2018-03-11 05:05:00 +00:00
|
|
|
|
|
|
|
test('deleted statuses result in deleted notifications', async t => {
|
2019-08-03 20:49:37 +00:00
|
|
|
const timeout = 20000
|
2018-05-26 20:51:41 +00:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.hover(getNthStatus(1))
|
2018-03-11 05:05:00 +00:00
|
|
|
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
2019-08-03 20:49:37 +00:00
|
|
|
const status = await postAs('admin', "@foobar yo yo foobar what's up")
|
2018-12-30 22:51:03 +00:00
|
|
|
await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (1 notification)', { timeout })
|
2018-03-16 17:06:02 +00:00
|
|
|
await deleteAs('admin', status.id)
|
2018-08-30 04:42:57 +00:00
|
|
|
await t.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications', { timeout })
|
2018-03-11 05:05:00 +00:00
|
|
|
})
|