aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/po/player.po.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/po/player.po.ts')
-rw-r--r--client/e2e/src/po/player.po.ts29
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 @@
1import { browser, by, element, ExpectedConditions } from 'protractor' 1import { browser, by, element } from 'protractor'
2import { browserSleep, isIOS, isMobileDevice } from '../utils' 2import { browserSleep, isIOS, isMobileDevice, isSafari } from '../utils'
3 3
4export class PlayerPage { 4export 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 }