pinafore/tests/spec/014-compose-post-privacy.js

39 lines
1.4 KiB
JavaScript
Raw Normal View History

import {
composeButton,
composeModalPostPrivacyButton,
getNthPostPrivacyOptionInDialog,
postPrivacyButton, postPrivacyDialogButtonUnlisted,
scrollToStatus,
sleep
} from '../utils'
import { loginAsFoobar } from '../roles'
2018-03-03 21:23:26 +00:00
2018-03-07 05:32:51 +00:00
fixture`014-compose-post-privacy.js`
2018-03-03 21:23:26 +00:00
.page`http://localhost:4002`
test('Changes post privacy', async t => {
await loginAsFoobar(t)
await sleep(2000)
await t
2018-03-03 21:23:26 +00:00
.expect(postPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
.click(postPrivacyButton)
.expect(getNthPostPrivacyOptionInDialog(2).exists).ok({ timeout: 30000 })
2018-04-08 20:42:31 +00:00
.click(getNthPostPrivacyOptionInDialog(2))
2018-03-03 21:23:26 +00:00
.expect(postPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Unlisted)')
.click(postPrivacyButton)
.expect(getNthPostPrivacyOptionInDialog(1).exists).ok({ timeout: 30000 })
2018-04-08 20:42:31 +00:00
.click(getNthPostPrivacyOptionInDialog(1))
2018-03-03 21:23:26 +00:00
.expect(postPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
})
test('can use privacy dialog within compose dialog', async t => {
await loginAsFoobar(t)
await scrollToStatus(t, 16)
await t.expect(composeButton.getAttribute('aria-label')).eql('Compose')
await sleep(2000)
await t.click(composeButton)
.click(composeModalPostPrivacyButton)
.click(postPrivacyDialogButtonUnlisted)
.expect(composeModalPostPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Unlisted)')
})