]>
Commit | Line | Data |
---|---|---|
1 | import { browser } from 'protractor' | |
2 | ||
3 | async 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 | ||
15 | async function isMobileDevice () { | |
16 | const caps = await browser.getCapabilities() | |
17 | return caps.get('realMobile') === 'true' || caps.get('realMobile') === true | |
18 | } | |
19 | ||
20 | async function isSafari () { | |
21 | const caps = await browser.getCapabilities() | |
22 | return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari' | |
23 | } | |
24 | ||
25 | async function isIOS () { | |
26 | return await isMobileDevice() && await isSafari() | |
27 | } | |
28 | ||
29 | export { | |
30 | isMobileDevice, | |
31 | isSafari, | |
32 | isIOS, | |
33 | browserSleep | |
34 | } |