pinafore/tests/spec/014-compose-post-privacy.js
Nolan Lawson 8fc8108454
fix: back button dismisses the modal dialog (#826)
* fix: back button dismisses the modal dialog

fixes #60

* try to manage nested modals

* seems working now

* fix modal timing issue

* fix test flakiness

* improve test flakiness again

* fix muting timing issue

* Revert "fix muting timing issue"

* remove setTimeout from MediaDialog

* refactor
2019-03-24 15:08:34 -07:00

36 lines
1.3 KiB
JavaScript

import {
composeButton,
composeModalPostPrivacyButton,
getNthPostPrivacyOptionInDialog,
postPrivacyButton, postPrivacyDialogButtonUnlisted,
scrollToStatus,
sleep
} from '../utils'
import { loginAsFoobar } from '../roles'
fixture`014-compose-post-privacy.js`
.page`http://localhost:4002`
test('Changes post privacy', async t => {
await loginAsFoobar(t)
await t
.expect(postPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Public)')
.click(postPrivacyButton)
.click(getNthPostPrivacyOptionInDialog(2))
.expect(postPrivacyButton.getAttribute('aria-label')).eql('Adjust privacy (currently Unlisted)')
.click(postPrivacyButton)
.click(getNthPostPrivacyOptionInDialog(1))
.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)')
})