diff options
Diffstat (limited to 'client/e2e/src/po/player.po.ts')
-rw-r--r-- | client/e2e/src/po/player.po.ts | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/client/e2e/src/po/player.po.ts b/client/e2e/src/po/player.po.ts index 33719da25..e41422359 100644 --- a/client/e2e/src/po/player.po.ts +++ b/client/e2e/src/po/player.po.ts | |||
@@ -29,29 +29,32 @@ export class PlayerPage { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | async playAndPauseVideo (isAutoplay: boolean, waitUntilSec: number) { | 31 | async playAndPauseVideo (isAutoplay: boolean, waitUntilSec: number) { |
32 | const videojsElem = () => $('div.video-js') | 32 | // Autoplay is disabled on mobile and Safari |
33 | 33 | if (isIOS() || isSafari() || isMobileDevice() || isAutoplay === false) { | |
34 | await videojsElem().waitForExist() | 34 | await this.playVideo() |
35 | |||
36 | // Autoplay is disabled on iOS and Safari | ||
37 | if (isIOS() || isSafari() || isMobileDevice()) { | ||
38 | // We can't play the video if it is not muted | ||
39 | await browser.execute(`document.querySelector('video').muted = true`) | ||
40 | await this.clickOnPlayButton() | ||
41 | } else if (isAutoplay === false) { | ||
42 | await this.clickOnPlayButton() | ||
43 | } | 35 | } |
44 | 36 | ||
37 | await $('div.video-js.vjs-has-started').waitForExist() | ||
38 | |||
45 | await browserSleep(2000) | 39 | await browserSleep(2000) |
46 | 40 | ||
47 | await browser.waitUntil(async () => { | 41 | await browser.waitUntil(async () => { |
48 | return (await this.getWatchVideoPlayerCurrentTime()) >= waitUntilSec | 42 | return (await this.getWatchVideoPlayerCurrentTime()) >= waitUntilSec |
49 | }) | 43 | }) |
50 | 44 | ||
51 | await videojsElem().click() | 45 | // Pause video |
46 | await $('div.video-js').click() | ||
52 | } | 47 | } |
53 | 48 | ||
54 | async playVideo () { | 49 | async playVideo () { |
50 | await $('div.video-js.vjs-paused').waitForExist() | ||
51 | |||
52 | // Autoplay is disabled on iOS and Safari | ||
53 | if (isIOS() || isSafari() || isMobileDevice()) { | ||
54 | // We can't play the video if it is not muted | ||
55 | await browser.execute(`document.querySelector('video').muted = true`) | ||
56 | } | ||
57 | |||
55 | return this.clickOnPlayButton() | 58 | return this.clickOnPlayButton() |
56 | } | 59 | } |
57 | 60 | ||