aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/e2e/src/utils.ts
blob: e19da6402602bb885288ca250d2291e7d8f38d82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { browser } from 'protractor'

async function browserSleep (amount: number) {
  if (await isIOS()) browser.ignoreSynchronization = false

  await browser.sleep(amount)

  if (await isIOS()) browser.ignoreSynchronization = true
}

async function isMobileDevice () {
  const caps = await browser.getCapabilities()
  return caps.get('realMobile') === 'true' || caps.get('realMobile') === true
}

async function isSafari () {
  const caps = await browser.getCapabilities()
  return caps.get('browserName') && caps.get('browserName').toLowerCase() === 'safari'
}

async function isIOS () {
  return await isMobileDevice() && await isSafari()
}

export  {
  isMobileDevice,
  isSafari,
  isIOS,
  browserSleep
}