-import { go } from '../utils'
+import { browserSleep, go, isAndroid, isMobileDevice } from '../utils'
export class LoginPage {
await $('input#username').setValue(username)
await $('input#password').setValue(password)
- await browser.pause(1000)
+ await browserSleep(1000)
- await $('form input[type=submit]').click()
+ const submit = $('.login-form-and-externals > form input[type=submit]')
+ await submit.click()
+
+ // Have to do this on Android, don't really know why
+ // I think we need to "escape" from the password input, so click twice on the submit button
+ if (isAndroid()) {
+ await browserSleep(2000)
+ await submit.click()
+ }
if (this.isMobileDevice) {
const menuToggle = $('.top-left-block span[role=button]')
}
async playAndPauseVideo (isAutoplay: boolean, waitUntilSec: number) {
- const videojsElem = () => $('div.video-js')
-
- await videojsElem().waitForExist()
-
- // Autoplay is disabled on iOS and Safari
- if (isIOS() || isSafari() || isMobileDevice()) {
- // We can't play the video if it is not muted
- await browser.execute(`document.querySelector('video').muted = true`)
- await this.clickOnPlayButton()
- } else if (isAutoplay === false) {
- await this.clickOnPlayButton()
+ // Autoplay is disabled on mobile and Safari
+ if (isIOS() || isSafari() || isMobileDevice() || isAutoplay === false) {
+ await this.playVideo()
}
+ await $('div.video-js.vjs-has-started').waitForExist()
+
await browserSleep(2000)
await browser.waitUntil(async () => {
return (await this.getWatchVideoPlayerCurrentTime()) >= waitUntilSec
})
- await videojsElem().click()
+ // Pause video
+ await $('div.video-js').click()
}
async playVideo () {
+ await $('div.video-js.vjs-paused').waitForExist()
+
+ // Autoplay is disabled on iOS and Safari
+ if (isIOS() || isSafari() || isMobileDevice()) {
+ // We can't play the video if it is not muted
+ await browser.execute(`document.querySelector('video').muted = true`)
+ }
+
return this.clickOnPlayButton()
}
return platformName === 'android' || platformName === 'ios'
}
+function isAndroid () {
+ const platformName = (browser.capabilities['platformName'] || '').toLowerCase()
+
+ return platformName === 'android'
+}
+
function isSafari () {
return browser.capabilities['browserName'] &&
browser.capabilities['browserName'].toLowerCase() === 'safari'
isMobileDevice,
isSafari,
isIOS,
+ isAndroid,
waitServerUp,
go,
browserSleep
"esModuleInterop": true,
"module": "commonjs",
"target": "es5",
+ "typeRoots": [
+ "../node_modules/@types",
+ "../node_modules"
+ ],
"types": [
"node",
"@wdio/globals/types",
}
}
-function buildBStackDesktopOptions (sessionName: string, resolution: string, os?: string) {
+function buildBStackDesktopOptions (options: {
+ sessionName: string
+ resolution: string
+ os?: string
+ osVersion?: string
+}) {
+ const { sessionName, resolution, os, osVersion } = options
+
return {
'bstack:options': {
...buildMainOptions(sessionName),
os,
+ osVersion,
resolution
}
}
}
-function buildBStackMobileOptions (sessionName: string, deviceName: string, osVersion: string) {
+function buildBStackMobileOptions (options: {
+ sessionName: string
+ deviceName: string
+ osVersion: string
+}) {
+ const { sessionName, deviceName, osVersion } = options
+
return {
'bstack:options': {
...buildMainOptions(sessionName),
{
browserName: 'Chrome',
- ...buildBStackDesktopOptions('Latest Chrome Desktop', '1280x1024')
+ ...buildBStackDesktopOptions({ sessionName: 'Latest Chrome Desktop', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
},
{
browserName: 'Firefox',
browserVersion: '78', // Very old ESR
- ...buildBStackDesktopOptions('Firefox ESR Desktop', '1280x1024', 'Windows')
+ ...buildBStackDesktopOptions({ sessionName: 'Firefox ESR Desktop', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
},
{
browserName: 'Safari',
browserVersion: '12.1',
- ...buildBStackDesktopOptions('Safari Desktop', '1280x1024')
+ ...buildBStackDesktopOptions({ sessionName: 'Safari Desktop', resolution: '1280x1024' })
},
{
browserName: 'Firefox',
- ...buildBStackDesktopOptions('Firefox Latest', '1280x1024')
+ ...buildBStackDesktopOptions({ sessionName: 'Firefox Latest', resolution: '1280x1024', os: 'Windows', osVersion: '8' })
},
{
browserName: 'Edge',
- ...buildBStackDesktopOptions('Edge Latest', '1280x1024')
+ ...buildBStackDesktopOptions({ sessionName: 'Edge Latest', resolution: '1280x1024' })
},
{
browserName: 'Chrome',
- ...buildBStackMobileOptions('Latest Chrome Android', 'Samsung Galaxy S8', '7.0')
+ ...buildBStackMobileOptions({ sessionName: 'Latest Chrome Android', deviceName: 'Samsung Galaxy S8', osVersion: '7.0' })
},
{
browserName: 'Safari',
- ...buildBStackMobileOptions('Safari iPhone', 'iPhone 8 Plus', '12.4')
+ ...buildBStackMobileOptions({ sessionName: 'Safari iPhone', deviceName: 'iPhone 8 Plus', osVersion: '12.4' })
},
{
browserName: 'Safari',
- ...buildBStackMobileOptions('Safari iPad', 'iPad 7th', '13')
+ ...buildBStackMobileOptions({ sessionName: 'Safari iPad', deviceName: 'iPad 7th', osVersion: '13' })
}
],
}
private initCaptions () {
- debugLogger('Init captions with current subtitle ' + this.currentSubtitle)
+ if (this.currentSubtitle) debugLogger('Init captions with current subtitle ' + this.currentSubtitle)
+ else debugLogger('Init captions without current subtitle')
this.player.tech(true).clearTracks('text')