| 372 | } |
| 373 | |
| 374 | _validateConfig(config) { |
| 375 | const defaults = { |
| 376 | // options to emulate context |
| 377 | emulate: {}, |
| 378 | browser: 'chromium', |
| 379 | waitForAction: 100, |
| 380 | waitForTimeout: 1000, |
| 381 | pressKeyDelay: 10, |
| 382 | timeout: 5000, |
| 383 | fullPageScreenshots: false, |
| 384 | disableScreenshots: false, |
| 385 | ignoreLog: ['warning', 'log'], |
| 386 | uniqueScreenshotNames: false, |
| 387 | manualStart: false, |
| 388 | getPageTimeout: 30000, |
| 389 | waitForNavigation: 'load', |
| 390 | restart: false, |
| 391 | keepCookies: false, |
| 392 | keepBrowserState: false, |
| 393 | show: false, |
| 394 | defaultPopupAction: 'accept', |
| 395 | use: { actionTimeout: 0 }, |
| 396 | ignoreHTTPSErrors: false, // Adding it here o that context can be set up to ignore the SSL errors, |
| 397 | highlightElement: false, |
| 398 | storageState: undefined, |
| 399 | onResponse: null, |
| 400 | strict: false, |
| 401 | } |
| 402 | |
| 403 | process.env.testIdAttribute = 'data-testid' |
| 404 | config = Object.assign(defaults, config) |
| 405 | |
| 406 | if (availableBrowsers.indexOf(config.browser) < 0) { |
| 407 | throw new Error(`Invalid config. Can't use browser "${config.browser}". Accepted values: ${availableBrowsers.join(', ')}`) |
| 408 | } |
| 409 | |
| 410 | return config |
| 411 | } |
| 412 | |
| 413 | _getOptionsForBrowser(config) { |
| 414 | if (config[config.browser]) { |