0964442815
* chore(travis): update to mastodon v2.6.1 * check if mastodon v2.6.1 has a race condition * apparently in 2.6.1 direct messages no longer appear in home timeline * Revert "check if mastodon v2.6.1 has a race condition" This reverts commit dde8ef8be58eda0563170e6b73165fdcbea54f6b. * try to fix tests * fix more tests
46 lines
2.1 KiB
JavaScript
46 lines
2.1 KiB
JavaScript
import { closeDialogButton, getNthStatus, getNthStatusSelector, modalDialogContents, scrollToStatus } from '../utils'
|
|
import { loginAsFoobar } from '../roles'
|
|
import { Selector as $ } from 'testcafe'
|
|
import { homeTimeline } from '../fixtures'
|
|
import { indexWhere } from '../../routes/_utils/arrays'
|
|
|
|
fixture`008-status-media.js`
|
|
.page`http://localhost:4002`
|
|
|
|
test('shows sensitive images and videos', async t => {
|
|
await loginAsFoobar(t)
|
|
|
|
let kittenIdx = indexWhere(homeTimeline, _ => _.spoiler === 'kitten CW')
|
|
let videoIdx = indexWhere(homeTimeline, _ => _.content === 'secret video')
|
|
|
|
await scrollToStatus(t, kittenIdx)
|
|
await t.expect($(`${getNthStatusSelector(kittenIdx)} .status-media img`).exists).notOk()
|
|
.click($(`${getNthStatusSelector(kittenIdx)} .status-sensitive-media-button`))
|
|
.expect($(`${getNthStatusSelector(kittenIdx)} .status-media img`).getAttribute('alt')).eql('kitten')
|
|
.expect($(`${getNthStatusSelector(kittenIdx)} .status-media img`).hasAttribute('src')).ok()
|
|
.hover(getNthStatus(videoIdx))
|
|
.expect($(`${getNthStatusSelector(videoIdx)} .status-media .play-video-button`).exists).notOk()
|
|
.click($(`${getNthStatusSelector(videoIdx)} .status-sensitive-media-button`))
|
|
.expect($(`${getNthStatusSelector(videoIdx)} .status-media .play-video-button`).exists).ok()
|
|
})
|
|
|
|
test('click and close image and video modals', async t => {
|
|
await loginAsFoobar(t)
|
|
|
|
let videoIdx = indexWhere(homeTimeline, _ => _.content === "here's a video")
|
|
let kittenIdx = indexWhere(homeTimeline, _ => _.content === "here's an animated kitten gif")
|
|
|
|
await scrollToStatus(t, videoIdx)
|
|
await t.expect(modalDialogContents.exists).notOk()
|
|
.click($(`${getNthStatusSelector(videoIdx)} .play-video-button`))
|
|
.expect(modalDialogContents.exists).ok()
|
|
.click(closeDialogButton)
|
|
.expect(modalDialogContents.exists).notOk()
|
|
.hover(getNthStatus(kittenIdx - 1))
|
|
.hover(getNthStatus(kittenIdx))
|
|
.click($(`${getNthStatusSelector(kittenIdx)} .show-image-button`))
|
|
.expect(modalDialogContents.exists).ok()
|
|
.click(closeDialogButton)
|
|
.expect(modalDialogContents.exists).notOk()
|
|
})
|