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-09-20 09:45:11 -04:00
|
|
|
await browser.waitForAngularEnabled(false)
|
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'
|
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 () => {
|
2018-06-08 05:25:12 -04:00
|
|
|
await videoWatchPage.pauseVideo(!isMobileDevice, isMobileDevice)
|
2018-05-22 10:02:29 -04:00
|
|
|
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
|
|
|
|
})
|
|
|
|
|
|
|
|
it('Should watch the associated embed video', async () => {
|
|
|
|
await videoWatchPage.goOnAssociatedEmbed()
|
|
|
|
|
2018-06-08 05:25:12 -04:00
|
|
|
await videoWatchPage.pauseVideo(false, isMobileDevice)
|
2018-05-17 04:55:01 -04:00
|
|
|
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
|
|
|
|
})
|
|
|
|
})
|