aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/utils.ts')
-rw-r--r--client/e2e/src/utils.ts39
1 files changed, 21 insertions, 18 deletions
diff --git a/client/e2e/src/utils.ts b/client/e2e/src/utils.ts
index a9d30c03a..df1c29238 100644
--- a/client/e2e/src/utils.ts
+++ b/client/e2e/src/utils.ts
@@ -1,34 +1,37 @@
1import { browser } from 'protractor'
2
3async function browserSleep (amount: number) { 1async function browserSleep (amount: number) {
4 const oldValue = await browser.waitForAngularEnabled() 2 await browser.pause(amount)
5 3}
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 4
10 await browser.sleep(amount) 5function isMobileDevice () {
6 const platformName = (browser.capabilities['platformName'] || '').toLowerCase()
11 7
12 if (await isIOS()) browser.waitForAngularEnabled(oldValue) 8 return platformName === 'android' || platformName === 'ios'
13} 9}
14 10
15async function isMobileDevice () { 11function isSafari () {
16 const caps = await browser.getCapabilities() 12 return browser.capabilities['browserName'] &&
17 return caps.get('realMobile') === 'true' || caps.get('realMobile') === true 13 browser.capabilities['browserName'].toLowerCase() === 'safari'
18} 14}
19 15
20async function isSafari () { 16function isIOS () {
21 const caps = await browser.getCapabilities() 17 return isMobileDevice() && isSafari()
22 return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
23} 18}
24 19
25async function isIOS () { 20async function go (url: string) {
26 return await isMobileDevice() && await isSafari() 21 await browser.url(url)
22
23 // Hide notifications that could fail tests when hiding buttons
24 await browser.execute(() => {
25 const style = document.createElement('style')
26 style.innerHTML = 'p-toast { display: none }'
27 document.head.appendChild(style)
28 })
27} 29}
28 30
29export { 31export {
30 isMobileDevice, 32 isMobileDevice,
31 isSafari, 33 isSafari,
32 isIOS, 34 isIOS,
35 go,
33 browserSleep 36 browserSleep
34} 37}