pinafore/tests/spec/08-status-media.js

35 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-02-21 18:26:22 +01:00
import { closeDialogButton, getNthStatus, modalDialogContents, scrollToStatus } from '../utils'
2018-02-20 18:05:53 +01:00
import { foobarRole } from '../roles'
fixture`08-status-media.js`
.page`http://localhost:4002`
2018-02-20 18:42:55 +01:00
test('shows sensitive images and videos', async t => {
2018-02-20 18:05:53 +01:00
await t.useRole(foobarRole)
2018-02-21 18:26:22 +01:00
await scrollToStatus(t, 7)
await t.expect(getNthStatus(7).find('.status-media img').exists).notOk()
2018-02-21 06:08:26 +01:00
.click(getNthStatus(7).find('.status-sensitive-media-button'))
.expect(getNthStatus(7).find('.status-media img').getAttribute('alt')).eql('kitten')
.expect(getNthStatus(7).find('.status-media img').hasAttribute('src')).ok()
.hover(getNthStatus(8))
.expect(getNthStatus(8).find('.status-media .play-video-button').exists).notOk()
.click(getNthStatus(8).find('.status-sensitive-media-button'))
.expect(getNthStatus(8).find('.status-media .play-video-button').exists).ok()
2018-02-20 18:05:53 +01:00
})
2018-02-20 18:42:55 +01:00
test('click and close image and video modals', async t => {
await t.useRole(foobarRole)
2018-02-21 18:26:22 +01:00
await scrollToStatus(t, 9)
await t.expect(modalDialogContents.exists).notOk()
2018-02-21 06:08:26 +01:00
.click(getNthStatus(9).find('.play-video-button'))
2018-02-20 18:42:55 +01:00
.expect(modalDialogContents.exists).ok()
.click(closeDialogButton)
.expect(modalDialogContents.exists).notOk()
2018-02-21 06:08:26 +01:00
.hover(getNthStatus(11))
.hover(getNthStatus(12))
.click(getNthStatus(12).find('.show-image-button'))
2018-02-20 18:42:55 +01:00
.expect(modalDialogContents.exists).ok()
.click(closeDialogButton)
.expect(modalDialogContents.exists).notOk()
2018-02-21 06:30:16 +01:00
})