aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/video-watch.po.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/po/video-watch.po.ts')
-rw-r--r--client/e2e/src/po/video-watch.po.ts49
1 files changed, 27 insertions, 22 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 0f37e3e33..19d02ff51 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,7 +1,7 @@
1import { by, element, browser } from 'protractor' 1import { by, element, browser } from 'protractor'
2 2
3export class VideoWatchPage { 3export class VideoWatchPage {
4 async goOnVideosList (isIphoneDevice: boolean) { 4 async goOnVideosList (isIphoneDevice: boolean, isSafari: boolean) {
5 let url: string 5 let url: string
6 6
7 if (isIphoneDevice === true) { 7 if (isIphoneDevice === true) {
@@ -12,11 +12,16 @@ export class VideoWatchPage {
12 } 12 }
13 13
14 await browser.get(url) 14 await browser.get(url)
15 return browser.wait(browser.ExpectedConditions.elementToBeClickable(element(this.getFirstVideoListSelector()))) 15
16 // Waiting the following element does not work on Safari...
17 if (isSafari === true) return browser.sleep(3000)
18
19 const elem = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
20 return browser.wait(browser.ExpectedConditions.visibilityOf(elem))
16 } 21 }
17 22
18 getVideosListName () { 23 getVideosListName () {
19 return element.all(this.getFirstVideoListSelector()) 24 return element.all(by.css('.videos .video-miniature .video-miniature-name'))
20 .getText() 25 .getText()
21 .then((texts: any) => texts.map(t => t.trim())) 26 .then((texts: any) => texts.map(t => t.trim()))
22 } 27 }
@@ -33,19 +38,19 @@ export class VideoWatchPage {
33 .then(seconds => parseInt(seconds, 10)) 38 .then(seconds => parseInt(seconds, 10))
34 } 39 }
35 40
36 async pauseVideo (pauseAfterMs: number, isMobileDevice: boolean, isIphoneDevice: boolean) { 41 async pauseVideo (pauseAfterMs: number, isAutoplay: boolean, isSafari: boolean) {
37 if (isMobileDevice === true) { 42 if (isAutoplay === false) {
38 if (isIphoneDevice === false) { 43 const playButton = element(by.css('.vjs-big-play-button'))
39 const playButton = element(by.css('.vjs-big-play-button')) 44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
40 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 45 await playButton.click()
41 await playButton.click() 46 }
42 } else { 47
43 const playButton = element(by.css('video')) 48 if (isSafari === true) {
44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 49 await browser.sleep(1000)
45 await playButton.click() 50 await element(by.css('.vjs-play-control')).click()
46 }
47 } 51 }
48 52
53 await browser.sleep(1000)
49 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 54 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
50 55
51 const el = element(by.css('div.video-js')) 56 const el = element(by.css('div.video-js'))
@@ -53,11 +58,7 @@ export class VideoWatchPage {
53 58
54 await browser.sleep(pauseAfterMs) 59 await browser.sleep(pauseAfterMs)
55 60
56 if (isIphoneDevice === true) { 61 return el.click()
57 // document.webkitCancelFullScreen()
58 } else {
59 return el.click()
60 }
61 } 62 }
62 63
63 async clickOnVideo (videoName: string) { 64 async clickOnVideo (videoName: string) {
@@ -69,7 +70,7 @@ export class VideoWatchPage {
69 } 70 }
70 71
71 async clickOnFirstVideo () { 72 async clickOnFirstVideo () {
72 const video = element(by.css('.videos .video-miniature:first-child .video-miniature-name')) 73 const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
73 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video)) 74 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
74 const textToReturn = video.getText() 75 const textToReturn = video.getText()
75 76
@@ -79,7 +80,11 @@ export class VideoWatchPage {
79 return textToReturn 80 return textToReturn
80 } 81 }
81 82
82 private getFirstVideoListSelector () { 83 async goOnAssociatedEmbed () {
83 return by.css('.videos .video-miniature-name') 84 let url = await browser.getCurrentUrl()
85 url = url.replace('/watch/', '/embed/')
86 url = url.replace(':3333', ':9001')
87
88 return browser.get(url)
84 } 89 }
85} 90}