1
0
Fork 0
peertube/client/e2e/src/videos.e2e-spec.ts

101 lines
3.2 KiB
TypeScript
Raw Normal View History

2018-05-17 04:55:01 -04:00
import { VideoWatchPage } from './po/video-watch.po'
import { VideoUploadPage } from './po/video-upload.po'
import { LoginPage } from './po/login.po'
import { browser } from 'protractor'
describe('Videos workflow', () => {
let videoWatchPage: VideoWatchPage
let pageUploadPage: VideoUploadPage
let loginPage: LoginPage
const videoName = new Date().getTime() + ' video'
2018-05-19 07:58:29 -04:00
let isMobileDevice = false
2018-05-22 10:02:29 -04:00
let isSafari = false
2018-05-19 07:58:29 -04:00
beforeEach(async () => {
2018-05-17 04:55:01 -04:00
videoWatchPage = new VideoWatchPage()
pageUploadPage = new VideoUploadPage()
loginPage = new LoginPage()
2018-05-19 07:58:29 -04:00
const caps = await browser.getCapabilities()
isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true
2018-05-22 10:02:29 -04:00
isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
2019-02-21 05:24:07 -05:00
if (isMobileDevice) {
console.log('Mobile device detected.')
}
if (isSafari) {
console.log('Safari detected.')
}
2018-05-17 04:55:01 -04:00
})
it('Should log in', () => {
2018-05-24 03:05:58 -04:00
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
2018-05-19 07:58:29 -04:00
return
}
2018-05-17 04:55:01 -04:00
return loginPage.loginAsRootUser()
})
it('Should upload a video', async () => {
2018-05-24 03:05:58 -04:00
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
2018-05-19 07:58:29 -04:00
return
}
2018-05-22 10:02:29 -04:00
await pageUploadPage.navigateTo()
2018-05-17 04:55:01 -04:00
await pageUploadPage.uploadVideo()
return pageUploadPage.validSecondUploadStep(videoName)
})
it('Should list the video', async () => {
2018-05-24 03:05:58 -04:00
await videoWatchPage.goOnVideosList(isMobileDevice, isSafari)
2018-05-19 07:58:29 -04:00
2018-05-24 03:05:58 -04:00
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
2018-05-19 07:58:29 -04:00
return
}
2018-05-17 04:55:01 -04:00
const videoNames = videoWatchPage.getVideosListName()
expect(videoNames).toContain(videoName)
})
it('Should go on video watch page', async () => {
2018-05-19 07:58:29 -04:00
let videoNameToExcept = videoName
2018-05-24 03:05:58 -04:00
if (isMobileDevice || isSafari) videoNameToExcept = await videoWatchPage.clickOnFirstVideo()
2018-05-19 07:58:29 -04:00
else await videoWatchPage.clickOnVideo(videoName)
2018-05-17 04:55:01 -04:00
2018-09-20 09:45:11 -04:00
return videoWatchPage.waitWatchVideoName(videoNameToExcept, isMobileDevice, isSafari)
2018-05-17 04:55:01 -04:00
})
it('Should play the video', async () => {
2019-02-21 05:24:07 -05:00
await videoWatchPage.playAndPauseVideo(true, isMobileDevice)
2018-05-22 10:02:29 -04:00
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
})
it('Should watch the associated embed video', async () => {
2019-02-21 05:24:07 -05:00
await browser.waitForAngularEnabled(false)
2018-05-22 10:02:29 -04:00
await videoWatchPage.goOnAssociatedEmbed()
2019-02-21 05:24:07 -05:00
await videoWatchPage.playAndPauseVideo(false, isMobileDevice)
2018-05-17 04:55:01 -04:00
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
2019-02-21 05:24:07 -05:00
await browser.waitForAngularEnabled(true)
})
it('Should watch the p2p media loader embed video', async () => {
await browser.waitForAngularEnabled(false)
await videoWatchPage.goOnP2PMediaLoaderEmbed()
await videoWatchPage.playAndPauseVideo(false, isMobileDevice)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
await browser.waitForAngularEnabled(true)
2018-05-17 04:55:01 -04:00
})
})