2018-03-09 17:45:12 +01:00
|
|
|
import {
|
2018-03-30 10:06:17 +02:00
|
|
|
composeInput,
|
2018-04-08 22:42:31 +02:00
|
|
|
getNthComposeReplyInput, getNthPostPrivacyButton, getNthPostPrivacyOptionInDialog, getNthReplyButton,
|
|
|
|
getNthReplyContentWarningButton,
|
|
|
|
getNthReplyContentWarningInput, getNthReplyPostPrivacyButton,
|
2018-12-13 08:45:42 +01:00
|
|
|
getNthStatus, getNthStatusRelativeDate, getUrl, homeNavButton, notificationsNavButton, scrollToStatus
|
2018-03-09 17:45:12 +01:00
|
|
|
} from '../utils'
|
2018-05-26 22:51:41 +02:00
|
|
|
import { loginAsFoobar } from '../roles'
|
2018-11-12 21:59:47 +01:00
|
|
|
import { homeTimeline } from '../fixtures'
|
2018-03-09 17:45:12 +01:00
|
|
|
|
|
|
|
fixture`017-compose-reply.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('account handle populated correctly for replies', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthComposeReplyInput(1).value).eql('@quux ')
|
|
|
|
.typeText(getNthComposeReplyInput(1), 'hello quux', { paste: true })
|
|
|
|
.expect(getNthComposeReplyInput(1).value).eql('@quux hello quux')
|
2018-03-30 10:06:17 +02:00
|
|
|
.click(notificationsNavButton)
|
|
|
|
.expect(getUrl()).contains('/notifications')
|
|
|
|
.click(homeNavButton)
|
|
|
|
.expect(getUrl()).notContains('/notifications')
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthComposeReplyInput(1).value).eql('@quux hello quux')
|
2018-03-09 17:45:12 +01:00
|
|
|
.expect(composeInput.value).eql('')
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(3))
|
|
|
|
.hover(getNthStatus(5))
|
|
|
|
.click(getNthReplyButton(5))
|
|
|
|
.expect(getNthComposeReplyInput(5).value).eql('')
|
2018-03-09 17:45:12 +01:00
|
|
|
})
|
|
|
|
|
2018-03-10 07:31:26 +01:00
|
|
|
test('replying to posts with mentions', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(2))
|
|
|
|
.expect(getNthComposeReplyInput(2).value).eql('@admin ')
|
2018-03-09 17:45:12 +01:00
|
|
|
.navigateTo('/accounts/4')
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthComposeReplyInput(1).value).eql('@ExternalLinks @admin @quux ')
|
2018-03-09 17:45:12 +01:00
|
|
|
})
|
2018-03-30 19:04:35 +02:00
|
|
|
|
|
|
|
test('replies have same privacy as replied-to status by default', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
2021-01-25 03:26:40 +01:00
|
|
|
const unlistedIdx = homeTimeline.findIndex(_ => _.content === 'notification of unlisted message')
|
|
|
|
const privateIdx = homeTimeline.findIndex(_ => _.content === 'notification of followers-only message')
|
|
|
|
const publicIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
|
|
|
|
|
|
|
await t.hover(getNthStatus(1))
|
|
|
|
await scrollToStatus(t, 1 + unlistedIdx)
|
2018-05-26 22:51:41 +02:00
|
|
|
await t
|
2021-01-25 03:26:40 +01:00
|
|
|
.click(getNthReplyButton(1 + unlistedIdx))
|
|
|
|
.expect(getNthPostPrivacyButton(1 + unlistedIdx).getAttribute('aria-label')).eql(
|
|
|
|
'Adjust privacy (currently Unlisted)'
|
|
|
|
)
|
|
|
|
.click(getNthReplyButton(1 + unlistedIdx))
|
|
|
|
|
|
|
|
await scrollToStatus(t, 1 + privateIdx)
|
|
|
|
await t
|
|
|
|
.click(getNthReplyButton(1 + privateIdx))
|
|
|
|
.expect(getNthPostPrivacyButton(1 + privateIdx).getAttribute('aria-label')).eql(
|
|
|
|
'Adjust privacy (currently Followers-only)'
|
|
|
|
)
|
|
|
|
.click(getNthReplyButton(1 + privateIdx))
|
|
|
|
|
|
|
|
await scrollToStatus(t, 1 + publicIdx)
|
|
|
|
await t
|
|
|
|
.click(getNthReplyButton(1 + publicIdx))
|
|
|
|
.expect(getNthPostPrivacyButton(1 + publicIdx).getAttribute('aria-label')).eql(
|
|
|
|
'Adjust privacy (currently Public)'
|
|
|
|
)
|
|
|
|
.click(getNthReplyButton(1 + publicIdx))
|
2018-03-30 19:04:35 +02:00
|
|
|
})
|
2018-04-08 22:42:31 +02:00
|
|
|
|
|
|
|
test('replies have same CW as replied-to status', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
2019-08-03 22:49:37 +02:00
|
|
|
const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
2021-01-25 03:26:40 +01:00
|
|
|
await t.hover(getNthStatus(1))
|
2019-02-28 17:56:25 +01:00
|
|
|
await scrollToStatus(t, 1 + kittenIdx)
|
|
|
|
await t.click(getNthReplyButton(1 + kittenIdx))
|
|
|
|
.expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW')
|
|
|
|
.click(getNthStatusRelativeDate(1 + kittenIdx))
|
2018-12-13 08:45:42 +01:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthReplyContentWarningInput(1).value).eql('kitten CW')
|
2018-04-08 22:42:31 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
test('replies save deletions of CW', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
2019-08-03 22:49:37 +02:00
|
|
|
const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
2019-02-28 17:56:25 +01:00
|
|
|
await scrollToStatus(t, 1 + kittenIdx)
|
|
|
|
await t.click(getNthReplyButton(1 + kittenIdx))
|
|
|
|
.expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW')
|
|
|
|
.click(getNthReplyContentWarningButton(1 + kittenIdx))
|
|
|
|
.expect(getNthReplyContentWarningInput(1 + kittenIdx).exists).notOk()
|
|
|
|
.click(getNthStatusRelativeDate(1 + kittenIdx))
|
2018-12-13 08:45:42 +01:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthReplyContentWarningInput(1).exists).notOk()
|
2018-04-08 22:42:31 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
test('replies save changes to CW', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
2019-08-03 22:49:37 +02:00
|
|
|
const kittenIdx = homeTimeline.findIndex(_ => _.spoiler === 'kitten CW')
|
2019-02-28 17:56:25 +01:00
|
|
|
await scrollToStatus(t, 1 + kittenIdx)
|
|
|
|
await t.click(getNthReplyButton(1 + kittenIdx))
|
|
|
|
.expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW')
|
|
|
|
.typeText(getNthReplyContentWarningInput(1 + kittenIdx), ' yolo', { paste: true })
|
|
|
|
.expect(getNthReplyContentWarningInput(1 + kittenIdx).value).eql('kitten CW yolo')
|
|
|
|
.click(getNthStatusRelativeDate(1 + kittenIdx))
|
2018-12-13 08:45:42 +01:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthReplyContentWarningInput(1).value).eql('kitten CW yolo')
|
2018-04-08 22:42:31 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
test('replies save changes to post privacy', async t => {
|
2018-05-26 22:51:41 +02:00
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2018-04-08 22:42:31 +02:00
|
|
|
.hover(getNthStatus(1))
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(2))
|
|
|
|
.click(getNthReplyButton(2))
|
|
|
|
.expect(getNthPostPrivacyButton(2).getAttribute('aria-label')).eql('Adjust privacy (currently Unlisted)')
|
|
|
|
.click(getNthReplyPostPrivacyButton(2))
|
2018-04-08 22:42:31 +02:00
|
|
|
.click(getNthPostPrivacyOptionInDialog(1))
|
2019-02-28 17:56:25 +01:00
|
|
|
.expect(getNthPostPrivacyButton(2).getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
|
|
|
|
.click(getNthStatusRelativeDate(2))
|
2018-12-13 08:45:42 +01:00
|
|
|
.expect(getUrl()).contains('/statuses')
|
2019-02-28 17:56:25 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthPostPrivacyButton(1).getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
|
2018-12-13 08:45:42 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
test('replies are the same whatever thread they are in', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(1))
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(2))
|
|
|
|
.click(getNthReplyButton(2))
|
|
|
|
.typeText(getNthComposeReplyInput(2), 'this is a reply', { paste: true })
|
|
|
|
.expect(getNthComposeReplyInput(2).value).eql('@admin this is a reply')
|
|
|
|
.click(getNthStatusRelativeDate(2))
|
|
|
|
.expect(getUrl()).contains('/statuses')
|
2018-12-13 08:45:42 +01:00
|
|
|
.click(getNthReplyButton(1))
|
|
|
|
.expect(getNthComposeReplyInput(1).value).eql('@admin this is a reply')
|
2018-04-08 22:42:31 +02:00
|
|
|
})
|