1 import { browser } from 'protractor'
3 async function browserSleep (amount: number) {
4 const oldValue = await browser.waitForAngularEnabled()
6 // iOS does not seem to work with protractor
7 // https://github.com/angular/protractor/issues/2840
8 if (await isIOS()) browser.waitForAngularEnabled(true)
10 await browser.sleep(amount)
12 if (await isIOS()) browser.waitForAngularEnabled(oldValue)
15 async function isMobileDevice () {
16 const caps = await browser.getCapabilities()
17 return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
20 async function isSafari () {
21 const caps = await browser.getCapabilities()
22 return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
25 async function isIOS () {
26 return await isMobileDevice() && await isSafari()