aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/utils/common.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/e2e/src/utils/common.ts')
-rw-r--r--client/e2e/src/utils/common.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/client/e2e/src/utils/common.ts b/client/e2e/src/utils/common.ts
new file mode 100644
index 000000000..eb5f6b450
--- /dev/null
+++ b/client/e2e/src/utils/common.ts
@@ -0,0 +1,47 @@
1async function browserSleep (amount: number) {
2 await browser.pause(amount)
3}
4
5function isMobileDevice () {
6 const platformName = (browser.capabilities['platformName'] || '').toLowerCase()
7
8 return platformName === 'android' || platformName === 'ios'
9}
10
11function isSafari () {
12 return browser.capabilities['browserName'] &&
13 browser.capabilities['browserName'].toLowerCase() === 'safari'
14}
15
16function isIOS () {
17 return isMobileDevice() && isSafari()
18}
19
20async function go (url: string) {
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 })
29}
30
31async function waitServerUp () {
32 await browser.waitUntil(async () => {
33 await go('/')
34 await browserSleep(500)
35
36 return $('<my-app>').isDisplayed()
37 }, { timeout: 20 * 1000 })
38}
39
40export {
41 isMobileDevice,
42 isSafari,
43 isIOS,
44 waitServerUp,
45 go,
46 browserSleep
47}