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.ts36
1 files changed, 21 insertions, 15 deletions
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 19d02ff51..ec3d16c3b 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -1,11 +1,11 @@
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, isSafari: boolean) { 4 async goOnVideosList (isMobileDevice: boolean, isSafari: boolean) {
5 let url: string 5 let url: string
6 6
7 if (isIphoneDevice === true) { 7 // We did not upload a file on a mobile device
8 // Local testing is buggy :/ 8 if (isMobileDevice === true || isSafari === true) {
9 url = 'https://peertube2.cpy.re/videos/local' 9 url = 'https://peertube2.cpy.re/videos/local'
10 } else { 10 } else {
11 url = '/videos/recently-added' 11 url = '/videos/recently-added'
@@ -26,8 +26,11 @@ export class VideoWatchPage {
26 .then((texts: any) => texts.map(t => t.trim())) 26 .then((texts: any) => texts.map(t => t.trim()))
27 } 27 }
28 28
29 waitWatchVideoName (videoName: string) { 29 waitWatchVideoName (videoName: string, isSafari: boolean) {
30 const elem = element(by.css('.video-info .video-info-name')) 30 const elem = element(by.css('.video-info .video-info-name'))
31
32 if (isSafari) return browser.sleep(5000)
33
31 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName)) 34 return browser.wait(browser.ExpectedConditions.textToBePresentInElement(elem, videoName))
32 } 35 }
33 36
@@ -38,27 +41,27 @@ export class VideoWatchPage {
38 .then(seconds => parseInt(seconds, 10)) 41 .then(seconds => parseInt(seconds, 10))
39 } 42 }
40 43
41 async pauseVideo (pauseAfterMs: number, isAutoplay: boolean, isSafari: boolean) { 44 async pauseVideo (isAutoplay: boolean, isDesktopSafari: boolean) {
42 if (isAutoplay === false) { 45 if (isAutoplay === false) {
43 const playButton = element(by.css('.vjs-big-play-button')) 46 const playButton = element(by.css('.vjs-big-play-button'))
44 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 47 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
45 await playButton.click() 48 await playButton.click()
46 } 49 }
47 50
48 if (isSafari === true) { 51 // if (isDesktopSafari === true) {
49 await browser.sleep(1000) 52 // await browser.sleep(1000)
50 await element(by.css('.vjs-play-control')).click() 53 // await element(by.css('.vjs-play-control')).click()
51 } 54 // }
52 55
53 await browser.sleep(1000) 56 await browser.sleep(1000)
54 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) 57 await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner'))))
55 58
56 const el = element(by.css('div.video-js')) 59 const videojsEl = element(by.css('div.video-js'))
57 await browser.wait(browser.ExpectedConditions.elementToBeClickable(el)) 60 await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
58 61
59 await browser.sleep(pauseAfterMs) 62 await browser.sleep(7000)
60 63
61 return el.click() 64 return videojsEl.click()
62 } 65 }
63 66
64 async clickOnVideo (videoName: string) { 67 async clickOnVideo (videoName: string) {
@@ -70,10 +73,13 @@ export class VideoWatchPage {
70 } 73 }
71 74
72 async clickOnFirstVideo () { 75 async clickOnFirstVideo () {
73 const video = element.all(by.css('.videos .video-miniature .video-miniature-name')).first() 76 const video = element.all(by.css('.videos .video-miniature .video-thumbnail')).first()
77 const videoName = element.all(by.css('.videos .video-miniature .video-miniature-name')).first()
78
79 // Don't know why but the expectation fails on Safari
74 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video)) 80 await browser.wait(browser.ExpectedConditions.elementToBeClickable(video))
75 const textToReturn = video.getText()
76 81
82 const textToReturn = videoName.getText()
77 await video.click() 83 await video.click()
78 84
79 await browser.wait(browser.ExpectedConditions.urlContains('/watch/')) 85 await browser.wait(browser.ExpectedConditions.urlContains('/watch/'))