]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix e2e tests
authorChocobozzz <me@florianbigard.com>
Fri, 8 Jun 2018 09:25:12 +0000 (11:25 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 8 Jun 2018 09:25:12 +0000 (11:25 +0200)
client/e2e/protractor.conf.js
client/e2e/src/po/video-watch.po.ts
client/e2e/src/videos.e2e-spec.ts
client/src/app/app.component.ts
client/src/app/core/routing/redirect.service.ts
client/src/standalone/videos/embed.ts

index 60b0ad9044732e87fa6d0a206a71d43fc5ec1557..c5c913a4a6189aa489f67b9bf76e2f325de3760d 100644 (file)
@@ -18,35 +18,42 @@ exports.config = {
   multiCapabilities: [
     {
       browserName: 'Chrome',
-      version: '66'
+      version: '66',
+      name: 'Latest Chrome Desktop'
     },
     {
       browserName: 'Safari',
-      version: '11.1'
+      version: '11.1',
+      name: 'Safari Desktop'
     },
     {
       browserName: 'Firefox',
-      version: '52' // ESR
+      version: '52', // ESR,
+      name: 'Old Firefox ESR Desktop'
     },
     {
       browserName: 'Firefox',
-      version: '60'
+      version: '60',
+      name: 'Latest Firefox Desktop'
     },
     {
       browserName: 'Edge',
-      version: '16'
+      version: '16',
+      name: 'Latest Edge Desktop'
     },
     {
       browserName: 'Chrome',
       device: 'Google Nexus 6',
       realMobile: 'true',
-      os_version: '5.0'
+      os_version: '5.0',
+      name: 'Latest Chrome Android'
     },
     {
       browserName: 'Safari',
       device: 'iPhone SE',
       realMobile: 'true',
-      os_version: '11.2'
+      os_version: '11.2',
+      name: 'Latest Safari iPhone'
     }
   ],
 
index 5bb7e5694163a945b2c8fa80e1423258c78000a0..fce8a6c3df06eadbb6f609ebbedb4c3b3c2d0fc0 100644 (file)
@@ -41,7 +41,7 @@ export class VideoWatchPage {
       .then(seconds => parseInt(seconds, 10))
   }
 
-  async pauseVideo (isAutoplay: boolean) {
+  async pauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
     if (isAutoplay === false) {
       const playButton = element(by.css('.vjs-big-play-button'))
       await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
index b15c031987268bdf29e8b27d9976374b2d51a6e7..3d4d46292cf7dede9500e94a833620af970b566b 100644 (file)
@@ -66,14 +66,14 @@ describe('Videos workflow', () => {
   })
 
   it('Should play the video', async () => {
-    await videoWatchPage.pauseVideo(!isMobileDevice)
+    await videoWatchPage.pauseVideo(!isMobileDevice, isMobileDevice)
     expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
   })
 
   it('Should watch the associated embed video', async () => {
     await videoWatchPage.goOnAssociatedEmbed()
 
-    await videoWatchPage.pauseVideo(false)
+    await videoWatchPage.pauseVideo(false, isMobileDevice)
     expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
   })
 })
index 6087dbf8038bf337022495dde014f3e4336458f9..0bfe9f91685cd982d88f7999d595fe10191eab38 100644 (file)
@@ -55,7 +55,7 @@ export class AppComponent implements OnInit {
       if (e instanceof NavigationEnd) {
         const pathname = window.location.pathname
         if (!pathname || pathname === '/' || is18nPath(pathname)) {
-          this.redirectService.redirectToHomepage()
+          this.redirectService.redirectToHomepage(true)
         }
       }
     })
index b7803cce2f9f6df0946cbc9adce5e5e45b1dffea..1881be117e4a9d20bc4a9e87ee25241474a26468 100644 (file)
@@ -28,10 +28,10 @@ export class RedirectService {
         })
   }
 
-  redirectToHomepage () {
+  redirectToHomepage (skipLocationChange = false) {
     console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
 
-    this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange: true })
+    this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
         .catch(() => {
           console.error(
             'Cannot navigate to %s, resetting default route to %s.',
@@ -40,7 +40,7 @@ export class RedirectService {
           )
 
           RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
-          return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange: true })
+          return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
         })
 
   }
index 4f6fae8aa2c839f72bc7a89be1293a38e920819e..e28d964de64543f39ccfd94c838d68a2f6935c7d 100644 (file)
@@ -21,7 +21,6 @@ import * as videojs from 'video.js'
 
 import { VideoDetails } from '../../../../shared'
 import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player'
-import { environment } from '../../environments/environment'
 
 function getVideoUrl (id: string) {
   return window.location.origin + '/api/v1/videos/' + id
@@ -62,7 +61,7 @@ const urlParts = window.location.href.split('/')
 const lastPart = urlParts[urlParts.length - 1]
 const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[0]
 
-loadLocale(environment.apiUrl, videojs, navigator.language)
+loadLocale(window.location.origin, videojs, navigator.language)
   .then(() => loadVideoInfo(videoId))
   .then(async response => {
     const videoContainerId = 'video-container'