From c8bc2a1af698c21ea16ba56f077e507412f6b6ab Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 Aug 2020 14:38:34 +0200 Subject: Fix e2e tests --- client/e2e/src/po/player.po.ts | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'client/e2e/src/po') 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 @@ -import { browser, by, element, ExpectedConditions } from 'protractor' -import { browserSleep, isIOS, isMobileDevice } from '../utils' +import { browser, by, element } from 'protractor' +import { browserSleep, isIOS, isMobileDevice, isSafari } from '../utils' export class PlayerPage { @@ -17,27 +17,22 @@ export class PlayerPage { } async playAndPauseVideo (isAutoplay: boolean) { - // Autoplay is disabled on iOS - if (isAutoplay === false || await isIOS()) { + const videojsEl = element(by.css('div.video-js')) + await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) + + // Autoplay is disabled on iOS and Safari + if (await isIOS() || await isSafari() || await isMobileDevice()) { + // We can't play the video using protractor if it is not muted + await browser.executeScript(`document.querySelector('video').muted = true`) + await this.clickOnPlayButton() + } else if (isAutoplay === false) { await this.clickOnPlayButton() } await browserSleep(2000) await browser.wait(browser.ExpectedConditions.invisibilityOf(element(by.css('.vjs-loading-spinner')))) - const videojsEl = element(by.css('div.video-js')) - await browser.wait(browser.ExpectedConditions.elementToBeClickable(videojsEl)) - - if (await isMobileDevice()) { - await browserSleep(5000) - - // On Android, we need to click twice on "play" (BrowserStack particularity) - if (!await isIOS()) await videojsEl.click() - } - - browser.ignoreSynchronization = false - await browserSleep(7000) - browser.ignoreSynchronization = true + await browserSleep(2000) await videojsEl.click() } -- cgit v1.2.3