]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/e2e/src/po/video-watch.po.ts
Merge remote-tracking branch 'origin/pr/1785' into develop
[github/Chocobozzz/PeerTube.git] / client / e2e / src / po / video-watch.po.ts
index 5bb7e5694163a945b2c8fa80e1423258c78000a0..5f61d566883b1bd7c7a1e4e46347acbda2083e57 100644 (file)
@@ -23,11 +23,14 @@ export class VideoWatchPage {
   getVideosListName () {
     return element.all(by.css('.videos .video-miniature .video-miniature-name'))
                   .getText()
-                  .then((texts: any) => texts.map(t => t.trim()))
+                  .then((texts: any) => texts.map((t: any) => t.trim()))
   }
 
-  waitWatchVideoName (videoName: string, isSafari: boolean) {
-    const elem = element(by.css('.video-info .video-info-name'))
+  waitWatchVideoName (videoName: string, isMobileDevice: boolean, isSafari: boolean) {
+    // On mobile we display the first node, on desktop the second
+    const index = isMobileDevice ? 0 : 1
+
+    const elem = element.all(by.css('.video-info .video-info-name')).get(index)
 
     if (isSafari) return browser.sleep(5000)
 
@@ -41,7 +44,7 @@ export class VideoWatchPage {
       .then(seconds => parseInt(seconds, 10))
   }
 
-  async pauseVideo (isAutoplay: boolean) {
+  async playAndPauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
     if (isAutoplay === false) {
       const playButton = element(by.css('.vjs-big-play-button'))
       await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
@@ -54,6 +57,12 @@ export class VideoWatchPage {
     const videojsEl = element(by.css('div.video-js'))
     await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl))
 
+    // On Android, we need to click twice on "play" (BrowserStack particularity)
+    if (isMobileDevice) {
+      await browser.sleep(3000)
+      await videojsEl.click()
+    }
+
     await browser.sleep(7000)
 
     return videojsEl.click()
@@ -88,4 +97,8 @@ export class VideoWatchPage {
 
     return browser.get(url)
   }
+
+  async goOnP2PMediaLoaderEmbed () {
+    return browser.get('https://peertube2.cpy.re/videos/embed/969bf103-7818-43b5-94a0-de159e13de50?mode=p2p-media-loader')
+  }
 }