| 488 | } |
| 489 | |
| 490 | _validateConfig(config) { |
| 491 | const defaults = { |
| 492 | logLevel: 'silent', |
| 493 | // codeceptjs |
| 494 | remoteFileUpload: true, |
| 495 | smartWait: 0, |
| 496 | waitForTimeout: 1000, // ms |
| 497 | capabilities: {}, |
| 498 | restart: true, |
| 499 | uniqueScreenshotNames: false, |
| 500 | disableScreenshots: false, |
| 501 | fullPageScreenshots: false, |
| 502 | manualStart: false, |
| 503 | keepCookies: false, |
| 504 | keepBrowserState: false, |
| 505 | deprecationWarnings: false, |
| 506 | highlightElement: false, |
| 507 | strict: false, |
| 508 | } |
| 509 | |
| 510 | // override defaults with config |
| 511 | config = Object.assign(defaults, config) |
| 512 | |
| 513 | if (config.host) { |
| 514 | // webdriverio spec |
| 515 | config.hostname = config.host |
| 516 | config.path = config.path ? config.path : '/wd/hub' |
| 517 | } |
| 518 | |
| 519 | config.baseUrl = config.url || config.baseUrl |
| 520 | if (config.desiredCapabilities && Object.keys(config.desiredCapabilities).length) { |
| 521 | config.capabilities = config.desiredCapabilities |
| 522 | } |
| 523 | config.capabilities.browserName = config.browser || config.capabilities.browserName |
| 524 | |
| 525 | // WebDriver Bidi Protocol. Default: true |
| 526 | config.capabilities.webSocketUrl = config.bidiProtocol ?? config.capabilities.webSocketUrl ?? true |
| 527 | |
| 528 | config.capabilities.browserVersion = config.browserVersion || config.capabilities.browserVersion |
| 529 | if (config.capabilities.chromeOptions) { |
| 530 | config.capabilities['goog:chromeOptions'] = config.capabilities.chromeOptions |
| 531 | delete config.capabilities.chromeOptions |
| 532 | } |
| 533 | if (config.capabilities.firefoxOptions) { |
| 534 | config.capabilities['moz:firefoxOptions'] = config.capabilities.firefoxOptions |
| 535 | delete config.capabilities.firefoxOptions |
| 536 | } |
| 537 | if (config.capabilities.ieOptions) { |
| 538 | config.capabilities['se:ieOptions'] = config.capabilities.ieOptions |
| 539 | delete config.capabilities.ieOptions |
| 540 | } |
| 541 | if (config.capabilities.selenoidOptions) { |
| 542 | config.capabilities['selenoid:options'] = config.capabilities.selenoidOptions |
| 543 | delete config.capabilities.selenoidOptions |
| 544 | } |
| 545 | |
| 546 | config.waitForTimeoutInSeconds = config.waitForTimeout / 1000 // convert to seconds |
| 547 | |