diff options
Diffstat (limited to 'client/e2e/src/utils.ts')
-rw-r--r-- | client/e2e/src/utils.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/client/e2e/src/utils.ts b/client/e2e/src/utils.ts new file mode 100644 index 000000000..e19da6402 --- /dev/null +++ b/client/e2e/src/utils.ts | |||
@@ -0,0 +1,30 @@ | |||
1 | import { browser } from 'protractor' | ||
2 | |||
3 | async function browserSleep (amount: number) { | ||
4 | if (await isIOS()) browser.ignoreSynchronization = false | ||
5 | |||
6 | await browser.sleep(amount) | ||
7 | |||
8 | if (await isIOS()) browser.ignoreSynchronization = true | ||
9 | } | ||
10 | |||
11 | async function isMobileDevice () { | ||
12 | const caps = await browser.getCapabilities() | ||
13 | return caps.get('realMobile') === 'true' || caps.get('realMobile') === true | ||
14 | } | ||
15 | |||
16 | async function isSafari () { | ||
17 | const caps = await browser.getCapabilities() | ||
18 | return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari' | ||
19 | } | ||
20 | |||
21 | async function isIOS () { | ||
22 | return await isMobileDevice() && await isSafari() | ||
23 | } | ||
24 | |||
25 | export { | ||
26 | isMobileDevice, | ||
27 | isSafari, | ||
28 | isIOS, | ||
29 | browserSleep | ||
30 | } | ||