diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-26 14:38:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-26 14:44:35 +0200 |
commit | c8bc2a1af698c21ea16ba56f077e507412f6b6ab (patch) | |
tree | 1ff4d10da8505f23e5b3076c04124094fbcacba7 /client/e2e/src/po | |
parent | 2199aaef6fcf37411dba401475be36c89eb325d3 (diff) | |
download | PeerTube-c8bc2a1af698c21ea16ba56f077e507412f6b6ab.tar.gz PeerTube-c8bc2a1af698c21ea16ba56f077e507412f6b6ab.tar.zst PeerTube-c8bc2a1af698c21ea16ba56f077e507412f6b6ab.zip |
Fix e2e tests
Diffstat (limited to 'client/e2e/src/po')
-rw-r--r-- | client/e2e/src/po/player.po.ts | 29 |
1 files changed, 12 insertions, 17 deletions
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 | } |