diff options
Diffstat (limited to 'client/e2e')
-rw-r--r-- | client/e2e/protractor.conf.js | 6 | ||||
-rw-r--r-- | client/e2e/src/po/player.po.ts | 29 | ||||
-rw-r--r-- | client/e2e/src/utils.ts | 8 | ||||
-rw-r--r-- | client/e2e/src/videos.e2e-spec.ts | 17 |
4 files changed, 33 insertions, 27 deletions
diff --git a/client/e2e/protractor.conf.js b/client/e2e/protractor.conf.js index 47585afc5..be303bce4 100644 --- a/client/e2e/protractor.conf.js +++ b/client/e2e/protractor.conf.js | |||
@@ -5,7 +5,7 @@ const {SpecReporter} = require('jasmine-spec-reporter') | |||
5 | 5 | ||
6 | exports.config = { | 6 | exports.config = { |
7 | allScriptsTimeout: 25000, | 7 | allScriptsTimeout: 25000, |
8 | specs: ['./src/**/*.e2e-spec.ts'], | 8 | specs: [ './src/**/*.e2e-spec.ts' ], |
9 | 9 | ||
10 | seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub', | 10 | seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub', |
11 | commonCapabilities: { | 11 | commonCapabilities: { |
@@ -85,7 +85,9 @@ exports.config = { | |||
85 | require('ts-node').register({ | 85 | require('ts-node').register({ |
86 | project: require('path').join(__dirname, './tsconfig.e2e.json') | 86 | project: require('path').join(__dirname, './tsconfig.e2e.json') |
87 | }) | 87 | }) |
88 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })) | 88 | jasmine.getEnv().addReporter(new SpecReporter({ |
89 | spec: { displayStacktrace: 'raw' } | ||
90 | })) | ||
89 | } | 91 | } |
90 | } | 92 | } |
91 | 93 | ||
diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts index bc61704fb..d18d81f16 100644 --- a/client/e2e/src/po/player.po.ts +++ b/client/e2e/src/po/player.po.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { browser, by, element, ExpectedConditions } from 'protractor' | 1 | import { browser, by, element } from 'protractor' |
2 | import { browserSleep, isIOS, isMobileDevice } from '../utils' | 2 | import { browserSleep, isIOS, isMobileDevice, isSafari } from '../utils' |
3 | 3 | ||
4 | export class PlayerPage { | 4 | export class PlayerPage { |
5 | 5 | ||
@@ -17,27 +17,22 @@ export class PlayerPage { | |||
17 | } | 17 | } |
18 | 18 | ||
19 | async playAndPauseVideo (isAutoplay: boolean) { | 19 | async playAndPauseVideo (isAutoplay: boolean) { |
20 | // Autoplay is disabled on iOS | 20 | const videojsEl = element(by.css('div.video-js')) |
21 | if (isAutoplay === false || await isIOS()) { | 21 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) |
22 | |||
23 | // Autoplay is disabled on iOS and Safari | ||
24 | if (await isIOS() || await isSafari() || await isMobileDevice()) { | ||
25 | // We can't play the video using protractor if it is not muted | ||
26 | await browser.executeScript(`document.querySelector('video').muted = true`) | ||
27 | await this.clickOnPlayButton() | ||
28 | } else if (isAutoplay === false) { | ||
22 | await this.clickOnPlayButton() | 29 | await this.clickOnPlayButton() |
23 | } | 30 | } |
24 | 31 | ||
25 | await browserSleep(2000) | 32 | await browserSleep(2000) |
26 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) | 33 | await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) |
27 | 34 | ||
28 | const videojsEl = element(by.css('div.video-js')) | 35 | await browserSleep(2000) |
29 | await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) | ||
30 | |||
31 | if (await isMobileDevice()) { | ||
32 | await browserSleep(5000) | ||
33 | |||
34 | // On Android, we need to click twice on "play" (BrowserStack particularity) | ||
35 | if (!await isIOS()) await videojsEl.click() | ||
36 | } | ||
37 | |||
38 | browser.ignoreSynchronization = false | ||
39 | await browserSleep(7000) | ||
40 | browser.ignoreSynchronization = true | ||
41 | 36 | ||
42 | await videojsEl.click() | 37 | await videojsEl.click() |
43 | } | 38 | } |
diff --git a/client/e2e/src/utils.ts b/client/e2e/src/utils.ts index e19da6402..a9d30c03a 100644 --- a/client/e2e/src/utils.ts +++ b/client/e2e/src/utils.ts | |||
@@ -1,11 +1,15 @@ | |||
1 | import { browser } from 'protractor' | 1 | import { browser } from 'protractor' |
2 | 2 | ||
3 | async function browserSleep (amount: number) { | 3 | async function browserSleep (amount: number) { |
4 | if (await isIOS()) browser.ignoreSynchronization = false | 4 | const oldValue = await browser.waitForAngularEnabled() |
5 | |||
6 | // iOS does not seem to work with protractor | ||
7 | // https://github.com/angular/protractor/issues/2840 | ||
8 | if (await isIOS()) browser.waitForAngularEnabled(true) | ||
5 | 9 | ||
6 | await browser.sleep(amount) | 10 | await browser.sleep(amount) |
7 | 11 | ||
8 | if (await isIOS()) browser.ignoreSynchronization = true | 12 | if (await isIOS()) browser.waitForAngularEnabled(oldValue) |
9 | } | 13 | } |
10 | 14 | ||
11 | async function isMobileDevice () { | 15 | async function isMobileDevice () { |
diff --git a/client/e2e/src/videos.e2e-spec.ts b/client/e2e/src/videos.e2e-spec.ts index d8af1885f..d9d2cb9b9 100644 --- a/client/e2e/src/videos.e2e-spec.ts +++ b/client/e2e/src/videos.e2e-spec.ts | |||
@@ -43,7 +43,7 @@ describe('Videos workflow', () => { | |||
43 | if (await isIOS()) { | 43 | if (await isIOS()) { |
44 | // iOS does not seem to work with protractor | 44 | // iOS does not seem to work with protractor |
45 | // https://github.com/angular/protractor/issues/2840 | 45 | // https://github.com/angular/protractor/issues/2840 |
46 | browser.ignoreSynchronization = true | 46 | browser.waitForAngularEnabled(false) |
47 | 47 | ||
48 | console.log('iOS detected') | 48 | console.log('iOS detected') |
49 | } else if (await isMobileDevice()) { | 49 | } else if (await isMobileDevice()) { |
@@ -111,6 +111,7 @@ describe('Videos workflow', () => { | |||
111 | }) | 111 | }) |
112 | 112 | ||
113 | it('Should watch the associated embed video', async () => { | 113 | it('Should watch the associated embed video', async () => { |
114 | const oldValue = await browser.waitForAngularEnabled() | ||
114 | await browser.waitForAngularEnabled(false) | 115 | await browser.waitForAngularEnabled(false) |
115 | 116 | ||
116 | await videoWatchPage.goOnAssociatedEmbed() | 117 | await videoWatchPage.goOnAssociatedEmbed() |
@@ -118,10 +119,11 @@ describe('Videos workflow', () => { | |||
118 | await playerPage.playAndPauseVideo(false) | 119 | await playerPage.playAndPauseVideo(false) |
119 | expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 120 | expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
120 | 121 | ||
121 | await browser.waitForAngularEnabled(true) | 122 | await browser.waitForAngularEnabled(oldValue) |
122 | }) | 123 | }) |
123 | 124 | ||
124 | it('Should watch the p2p media loader embed video', async () => { | 125 | it('Should watch the p2p media loader embed video', async () => { |
126 | const oldValue = await browser.waitForAngularEnabled() | ||
125 | await browser.waitForAngularEnabled(false) | 127 | await browser.waitForAngularEnabled(false) |
126 | 128 | ||
127 | await videoWatchPage.goOnP2PMediaLoaderEmbed() | 129 | await videoWatchPage.goOnP2PMediaLoaderEmbed() |
@@ -129,7 +131,7 @@ describe('Videos workflow', () => { | |||
129 | await playerPage.playAndPauseVideo(false) | 131 | await playerPage.playAndPauseVideo(false) |
130 | expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) | 132 | expect(playerPage.getWatchVideoPlayerCurrentTime()).toBeGreaterThanOrEqual(2) |
131 | 133 | ||
132 | await browser.waitForAngularEnabled(true) | 134 | await browser.waitForAngularEnabled(oldValue) |
133 | }) | 135 | }) |
134 | 136 | ||
135 | it('Should update the video', async () => { | 137 | it('Should update the video', async () => { |
@@ -185,11 +187,12 @@ describe('Videos workflow', () => { | |||
185 | 187 | ||
186 | await myAccountPage.playPlaylist() | 188 | await myAccountPage.playPlaylist() |
187 | 189 | ||
190 | const oldValue = await browser.waitForAngularEnabled() | ||
188 | await browser.waitForAngularEnabled(false) | 191 | await browser.waitForAngularEnabled(false) |
189 | 192 | ||
190 | await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000) | 193 | await videoWatchPage.waitUntilVideoName(video2Name, 20000 * 1000) |
191 | 194 | ||
192 | await browser.waitForAngularEnabled(true) | 195 | await browser.waitForAngularEnabled(oldValue) |
193 | }) | 196 | }) |
194 | 197 | ||
195 | it('Should watch the webtorrent playlist in the embed', async () => { | 198 | it('Should watch the webtorrent playlist in the embed', async () => { |
@@ -198,6 +201,7 @@ describe('Videos workflow', () => { | |||
198 | const accessToken = await browser.executeScript(`return window.localStorage.getItem('access_token');`) | 201 | const accessToken = await browser.executeScript(`return window.localStorage.getItem('access_token');`) |
199 | const refreshToken = await browser.executeScript(`return window.localStorage.getItem('refresh_token');`) | 202 | const refreshToken = await browser.executeScript(`return window.localStorage.getItem('refresh_token');`) |
200 | 203 | ||
204 | const oldValue = await browser.waitForAngularEnabled() | ||
201 | await browser.waitForAngularEnabled(false) | 205 | await browser.waitForAngularEnabled(false) |
202 | 206 | ||
203 | await myAccountPage.goOnAssociatedPlaylistEmbed() | 207 | await myAccountPage.goOnAssociatedPlaylistEmbed() |
@@ -212,10 +216,11 @@ describe('Videos workflow', () => { | |||
212 | 216 | ||
213 | await playerPage.waitUntilPlaylistInfo('2/2') | 217 | await playerPage.waitUntilPlaylistInfo('2/2') |
214 | 218 | ||
215 | await browser.waitForAngularEnabled(true) | 219 | await browser.waitForAngularEnabled(oldValue) |
216 | }) | 220 | }) |
217 | 221 | ||
218 | it('Should watch the HLS playlist in the embed', async () => { | 222 | it('Should watch the HLS playlist in the embed', async () => { |
223 | const oldValue = await browser.waitForAngularEnabled() | ||
219 | await browser.waitForAngularEnabled(false) | 224 | await browser.waitForAngularEnabled(false) |
220 | 225 | ||
221 | await videoWatchPage.goOnP2PMediaLoaderPlaylistEmbed() | 226 | await videoWatchPage.goOnP2PMediaLoaderPlaylistEmbed() |
@@ -224,7 +229,7 @@ describe('Videos workflow', () => { | |||
224 | 229 | ||
225 | await playerPage.waitUntilPlaylistInfo('2/2') | 230 | await playerPage.waitUntilPlaylistInfo('2/2') |
226 | 231 | ||
227 | await browser.waitForAngularEnabled(true) | 232 | await browser.waitForAngularEnabled(oldValue) |
228 | }) | 233 | }) |
229 | 234 | ||
230 | it('Should delete the video 2', async () => { | 235 | it('Should delete the video 2', async () => { |