]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/e2e/src/utils.ts
Reorganize left menu and account menu
[github/Chocobozzz/PeerTube.git] / client / e2e / src / utils.ts
CommitLineData
ee68bbc4
C
1import { browser } from 'protractor'
2
3async function browserSleep (amount: number) {
c8bc2a1a
C
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)
ee68bbc4
C
9
10 await browser.sleep(amount)
11
c8bc2a1a 12 if (await isIOS()) browser.waitForAngularEnabled(oldValue)
ee68bbc4
C
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}