function getWebdriveBaseConfig()

in dev-utils/webdriver.js [146:242]


function getWebdriveBaseConfig(
  path,
  specs = './test/e2e/**/*.e2e-spec.js',
  capabilities
) {
  const { tunnelIdentifier, username, accessKey } = getSauceConnectOptions()
  /**
   * Skip the ios platform on E2E tests because of script
   * timeout issue in Appium
   */
  const browsers = [...getBrowserList(), ...getAppiumBrowsersForWebdriver()]
  capabilities = (capabilities || browsers)
    .map(c => {
      const sauceOptions = c['sauce:options'] || {}
      sauceOptions.tunnelIdentifier = tunnelIdentifier
      sauceOptions.seleniumVersion = '3.141.59'

      return {
        ...c,
        'sauce:options': sauceOptions
      }
    })
    .filter(({ platformName }) => platformName !== 'iOS')

  const baseConfig = {
    runner: 'local',
    specs: glob.sync(join(path, specs)),
    maxInstancesPerCapability: 3,
    services: ['sauce'],
    user: username,
    key: accessKey,
    sauceConnect: false,
    capabilities,
    logLevel: 'error',
    bail: 1,
    screenshotPath: join(path, 'error-screenshot'),
    baseUrl: 'http://localhost:8000',
    waitforTimeout: 30000,
    framework: 'jasmine',
    reporters: ['dot', 'spec'],
    jasmineOpts: {
      defaultTimeoutInterval: 90000
    },
    async before() {
      /**
       * Increase script timeout so that executeAsyncScript does not
       * throw async script failure in 0 ms error
       *
       * Skip setting timeouts on firefox and microsoftedge since they
       * result in NullPointerException issue from selenium driver
       */
      const { name } = getBrowserInfo()
      if (name === 'firefox' || name === 'microsoftedge') {
        return
      }

      await browser.setTimeout({ script: 30000 })
    },
    afterTest(test) {
      /**
       * Log only on failures
       * Log api is only available in chrome driver
       * */
      if (!test.passed && isChromeLatest()) {
        const response = browser.getLogs('browser')
        console.log(
          '[Chrome Browser Logs]:',
          JSON.stringify(response, undefined, 2)
        )
      }
    }
  }

  const { sauceLabs } = getTestEnvironmentVariables()

  if (!sauceLabs) {
    Object.assign(baseConfig, {
      automationProtocol: 'devtools',
      capabilities: [
        {
          browserName: 'chrome',
          'goog:chromeOptions': {
            headless: true
          }
        },
        {
          browserName: 'firefox',
          'moz:firefoxOptions': {
            headless: true
          }
        }
      ]
    })
  }

  return baseConfig
}