]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/e2e/src/utils.ts
Translated using Weblate (Thai)
[github/Chocobozzz/PeerTube.git] / client / e2e / src / utils.ts
... / ...
CommitLineData
1import { browser } from 'protractor'
2
3async function browserSleep (amount: number) {
4 const oldValue = await browser.waitForAngularEnabled()
5
6 // iOS does not seem to work with protractor
7 // https://github.com/angular/protractor/issues/2840
8 if (await isIOS()) browser.waitForAngularEnabled(true)
9
10 await browser.sleep(amount)
11
12 if (await isIOS()) browser.waitForAngularEnabled(oldValue)
13}
14
15async function isMobileDevice () {
16 const caps = await browser.getCapabilities()
17 return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
18}
19
20async function isSafari () {
21 const caps = await browser.getCapabilities()
22 return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
23}
24
25async function isIOS () {
26 return await isMobileDevice() && await isSafari()
27}
28
29export {
30 isMobileDevice,
31 isSafari,
32 isIOS,
33 browserSleep
34}