1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
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'
let isMobileDevice = false
let isSafari = false
beforeEach(async () => {
videoWatchPage = new VideoWatchPage()
pageUploadPage = new VideoUploadPage()
loginPage = new LoginPage()
const caps = await browser.getCapabilities()
isMobileDevice = caps.get('realMobile') === 'true' || caps.get('realMobile') === true
isSafari = caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
if (isMobileDevice) {
console.log('Mobile device detected.')
}
if (isSafari) {
console.log('Safari detected.')
}
})
it('Should log in', () => {
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
return loginPage.loginAsRootUser()
})
it('Should upload a video', async () => {
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
await pageUploadPage.navigateTo()
await pageUploadPage.uploadVideo()
return pageUploadPage.validSecondUploadStep(videoName)
})
it('Should list the video', async () => {
await videoWatchPage.goOnVideosList(isMobileDevice, isSafari)
if (isMobileDevice || isSafari) {
console.log('Skipping because we are on a real device or Safari and BrowserStack does not support file upload.')
return
}
const videoNames = videoWatchPage.getVideosListName()
expect(videoNames).toContain(videoName)
})
it('Should go on video watch page', async () => {
let videoNameToExcept = videoName
if (isMobileDevice || isSafari) videoNameToExcept = await videoWatchPage.clickOnFirstVideo()
else await videoWatchPage.clickOnVideo(videoName)
return videoWatchPage.waitWatchVideoName(videoNameToExcept, isMobileDevice, isSafari)
})
it('Should play the video', async () => {
await videoWatchPage.playAndPauseVideo(true, isMobileDevice)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
})
it('Should watch the associated embed video', async () => {
await browser.waitForAngularEnabled(false)
await videoWatchPage.goOnAssociatedEmbed()
await videoWatchPage.playAndPauseVideo(false, isMobileDevice)
expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
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)
})
})
|