aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-06-08 11:25:12 +0200
committerChocobozzz <me@florianbigard.com>2018-06-08 11:25:12 +0200
commit7cf26f433f5d93fb5325495bc87bdef87260aada (patch)
tree675e45abf0d63f20e3b6da9293ed5a32e0d1b1a4
parentdbe868c07080135cf62ecb8ad556d471c1e6c2ca (diff)
downloadPeerTube-7cf26f433f5d93fb5325495bc87bdef87260aada.tar.gz
PeerTube-7cf26f433f5d93fb5325495bc87bdef87260aada.tar.zst
PeerTube-7cf26f433f5d93fb5325495bc87bdef87260aada.zip
Fix e2e tests
-rw-r--r--client/e2e/protractor.conf.js21
-rw-r--r--client/e2e/src/po/video-watch.po.ts2
-rw-r--r--client/e2e/src/videos.e2e-spec.ts4
-rw-r--r--client/src/app/app.component.ts2
-rw-r--r--client/src/app/core/routing/redirect.service.ts6
-rw-r--r--client/src/standalone/videos/embed.ts3
6 files changed, 22 insertions, 16 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js
index 60b0ad904..c5c913a4a 100644
--- a/client/e2e/protractor.conf.js
+++ b/client/e2e/protractor.conf.js
@@ -18,35 +18,42 @@ exports.config = {
18 multiCapabilities: [ 18 multiCapabilities: [
19 { 19 {
20 browserName: 'Chrome', 20 browserName: 'Chrome',
21 version: '66' 21 version: '66',
22 name: 'Latest Chrome Desktop'
22 }, 23 },
23 { 24 {
24 browserName: 'Safari', 25 browserName: 'Safari',
25 version: '11.1' 26 version: '11.1',
27 name: 'Safari Desktop'
26 }, 28 },
27 { 29 {
28 browserName: 'Firefox', 30 browserName: 'Firefox',
29 version: '52' // ESR 31 version: '52', // ESR,
32 name: 'Old Firefox ESR Desktop'
30 }, 33 },
31 { 34 {
32 browserName: 'Firefox', 35 browserName: 'Firefox',
33 version: '60' 36 version: '60',
37 name: 'Latest Firefox Desktop'
34 }, 38 },
35 { 39 {
36 browserName: 'Edge', 40 browserName: 'Edge',
37 version: '16' 41 version: '16',
42 name: 'Latest Edge Desktop'
38 }, 43 },
39 { 44 {
40 browserName: 'Chrome', 45 browserName: 'Chrome',
41 device: 'Google Nexus 6', 46 device: 'Google Nexus 6',
42 realMobile: 'true', 47 realMobile: 'true',
43 os_version: '5.0' 48 os_version: '5.0',
49 name: 'Latest Chrome Android'
44 }, 50 },
45 { 51 {
46 browserName: 'Safari', 52 browserName: 'Safari',
47 device: 'iPhone SE', 53 device: 'iPhone SE',
48 realMobile: 'true', 54 realMobile: 'true',
49 os_version: '11.2' 55 os_version: '11.2',
56 name: 'Latest Safari iPhone'
50 } 57 }
51 ], 58 ],
52 59
diff --git a/client/e2e/src/po/video-watch.po.ts b/client/e2e/src/po/video-watch.po.ts
index 5bb7e5694..fce8a6c3d 100644
--- a/client/e2e/src/po/video-watch.po.ts
+++ b/client/e2e/src/po/video-watch.po.ts
@@ -41,7 +41,7 @@ export class VideoWatchPage {
41 .then(seconds => parseInt(seconds, 10)) 41 .then(seconds => parseInt(seconds, 10))
42 } 42 }
43 43
44 async pauseVideo (isAutoplay: boolean) { 44 async pauseVideo (isAutoplay: boolean, isMobileDevice: boolean) {
45 if (isAutoplay === false) { 45 if (isAutoplay === false) {
46 const playButton = element(by.css('.vjs-big-play-button')) 46 const playButton = element(by.css('.vjs-big-play-button'))
47 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton)) 47 await browser.wait(browser.ExpectedConditions.elementToBeClickable(playButton))
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts
index b15c03198..3d4d46292 100644
--- a/client/e2e/src/videos.e2e-spec.ts
+++ b/client/e2e/src/videos.e2e-spec.ts
@@ -66,14 +66,14 @@ describe('Videos workflow', () => {
66 }) 66 })
67 67
68 it('Should play the video', async () => { 68 it('Should play the video', async () => {
69 await videoWatchPage.pauseVideo(!isMobileDevice) 69 await videoWatchPage.pauseVideo(!isMobileDevice, isMobileDevice)
70 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) 70 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
71 }) 71 })
72 72
73 it('Should watch the associated embed video', async () => { 73 it('Should watch the associated embed video', async () => {
74 await videoWatchPage.goOnAssociatedEmbed() 74 await videoWatchPage.goOnAssociatedEmbed()
75 75
76 await videoWatchPage.pauseVideo(false) 76 await videoWatchPage.pauseVideo(false, isMobileDevice)
77 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) 77 expect(videoWatchPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2)
78 }) 78 })
79}) 79})
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts
index 6087dbf80..0bfe9f916 100644
--- a/client/src/app/app.component.ts
+++ b/client/src/app/app.component.ts
@@ -55,7 +55,7 @@ export class AppComponent implements OnInit {
55 if (e instanceof NavigationEnd) { 55 if (e instanceof NavigationEnd) {
56 const pathname = window.location.pathname 56 const pathname = window.location.pathname
57 if (!pathname || pathname === '/' || is18nPath(pathname)) { 57 if (!pathname || pathname === '/' || is18nPath(pathname)) {
58 this.redirectService.redirectToHomepage() 58 this.redirectService.redirectToHomepage(true)
59 } 59 }
60 } 60 }
61 }) 61 })
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index b7803cce2..1881be117 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -28,10 +28,10 @@ export class RedirectService {
28 }) 28 })
29 } 29 }
30 30
31 redirectToHomepage () { 31 redirectToHomepage (skipLocationChange = false) {
32 console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE) 32 console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
33 33
34 this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange: true }) 34 this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
35 .catch(() => { 35 .catch(() => {
36 console.error( 36 console.error(
37 'Cannot navigate to %s, resetting default route to %s.', 37 'Cannot navigate to %s, resetting default route to %s.',
@@ -40,7 +40,7 @@ export class RedirectService {
40 ) 40 )
41 41
42 RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE 42 RedirectService.DEFAULT_ROUTE = RedirectService.INIT_DEFAULT_ROUTE
43 return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange: true }) 43 return this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
44 }) 44 })
45 45
46 } 46 }
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts
index 4f6fae8aa..e28d964de 100644
--- a/client/src/standalone/videos/embed.ts
+++ b/client/src/standalone/videos/embed.ts
@@ -21,7 +21,6 @@ import * as videojs from 'video.js'
21 21
22import { VideoDetails } from '../../../../shared' 22import { VideoDetails } from '../../../../shared'
23import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player' 23import { addContextMenu, getVideojsOptions, loadLocale } from '../../assets/player/peertube-player'
24import { environment } from '../../environments/environment'
25 24
26function getVideoUrl (id: string) { 25function getVideoUrl (id: string) {
27 return window.location.origin + '/api/v1/videos/' + id 26 return window.location.origin + '/api/v1/videos/' + id
@@ -62,7 +61,7 @@ const urlParts = window.location.href.split('/')
62const lastPart = urlParts[urlParts.length - 1] 61const lastPart = urlParts[urlParts.length - 1]
63const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[0] 62const videoId = lastPart.indexOf('?') === -1 ? lastPart : lastPart.split('?')[0]
64 63
65loadLocale(environment.apiUrl, videojs, navigator.language) 64loadLocale(window.location.origin, videojs, navigator.language)
66 .then(() => loadVideoInfo(videoId)) 65 .then(() => loadVideoInfo(videoId))
67 .then(async response => { 66 .then(async response => {
68 const videoContainerId = 'video-container' 67 const videoContainerId = 'video-container'