aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/e2e/src/utils.ts
blob: e19da6402602bb885288ca250d2291e7d8f38d82 (plain) (tree)





























                                                                                      
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
}