aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src')
-rw-r--r--client/e2e/src/po/login.po.ts14
-rw-r--r--client/e2e/src/po/player.po.ts27
-rw-r--r--client/e2e/src/utils/common.ts7
3 files changed, 33 insertions, 15 deletions
diff --git a/client/e2e/src/po/login.po.ts b/client/e2e/src/po/login.po.ts
index e2362ef51..a8606dbd2 100644
--- a/client/e2e/src/po/login.po.ts
+++ b/client/e2e/src/po/login.po.ts
@@ -1,4 +1,4 @@
1import { go } from '../utils' 1import { browserSleep, go, isAndroid, isMobileDevice } from '../utils'
2 2
3export class LoginPage { 3export class LoginPage {
4 4
@@ -23,9 +23,17 @@ export class LoginPage {
23 await $('input#username').setValue(username) 23 await $('input#username').setValue(username)
24 await $('input#password').setValue(password) 24 await $('input#password').setValue(password)
25 25
26 await browser.pause(1000) 26 await browserSleep(1000)
27 27
28 await $('form input[type=submit]').click() 28 const submit = $('.login-form-and-externals > form input[type=submit]')
29 await submit.click()
30
31 // Have to do this on Android, don't really know why
32 // I think we need to "escape" from the password input, so click twice on the submit button
33 if (isAndroid()) {
34 await browserSleep(2000)
35 await submit.click()
36 }
29 37
30 if (this.isMobileDevice) { 38 if (this.isMobileDevice) {
31 const menuToggle = $('.top-left-block span[role=button]') 39 const menuToggle = $('.top-left-block span[role=button]')
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
diff --git a/client/e2e/src/utils/common.ts b/client/e2e/src/utils/common.ts
index eb5f6b450..b04fe47f3 100644
--- a/client/e2e/src/utils/common.ts
+++ b/client/e2e/src/utils/common.ts
@@ -8,6 +8,12 @@ function isMobileDevice () {
8 return platformName === 'android' || platformName === 'ios' 8 return platformName === 'android' || platformName === 'ios'
9} 9}
10 10
11function isAndroid () {
12 const platformName = (browser.capabilities['platformName'] || '').toLowerCase()
13
14 return platformName === 'android'
15}
16
11function isSafari () { 17function isSafari () {
12 return browser.capabilities['browserName'] && 18 return browser.capabilities['browserName'] &&
13 browser.capabilities['browserName'].toLowerCase() === 'safari' 19 browser.capabilities['browserName'].toLowerCase() === 'safari'
@@ -41,6 +47,7 @@ export {
41 isMobileDevice, 47 isMobileDevice,
42 isSafari, 48 isSafari,
43 isIOS, 49 isIOS,
50 isAndroid,
44 waitServerUp, 51 waitServerUp,
45 go, 52 go,
46 browserSleep 53 browserSleep