diff options
author | Chocobozzz <me@florianbigard.com> | 2020-05-12 16:38:55 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-05-12 16:49:35 +0200 |
commit | ee68bbc481c154111c60fe80d57565d35bfac46e (patch) | |
tree | 64de79b49228feb35af486e2cf755bc7839fe148 /client/e2e/src/utils.ts | |
parent | 853c3d533d287d762053e0fa6ecf6bfc3feb0051 (diff) | |
download | PeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.tar.gz PeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.tar.zst PeerTube-ee68bbc481c154111c60fe80d57565d35bfac46e.zip |
Unblock ios e2e tests
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 | } | ||