'WebdriverIO doesn't spawn a browser in CircleCI job
I am trying to run my E2E tests in CircleCi. Tests work locally. On CircleCi tests are stuck after wdio's call:
[0-0] 2021-08-20T11:01:17.873Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2021-08-20T11:01:17.902Z INFO webdriver: [POST] http://localhost:9515/session
[0-0] 2021-08-20T11:01:17.902Z INFO webdriver: DATA {
[0-0] capabilities: {
[0-0] alwaysMatch: {
[0-0] browserName: 'chrome',
[0-0] 'goog:chromeOptions': [Object],
[0-0] acceptInsecureCerts: true
[0-0] },
[0-0] firstMatch: [ {} ]
[0-0] },
[0-0] desiredCapabilities: {
[0-0] browserName: 'chrome',
[0-0] 'goog:chromeOptions': { args: [Array] },
[0-0] acceptInsecureCerts: true
[0-0] }
[0-0] }
Locally, after this request follows command that opens url in a browser. But for me it throws timeout error like this:
[0-0] 2021-08-20T11:03:18.009Z WARN webdriver: Request timed out! Consider increasing the "connectionRetryTimeout" option.
Here's my CI config file:
version: 2.1
orbs:
browser-tools: circleci/[email protected]
jobs:
e2e:
working_directory: /tmp/circle-run
docker:
- image: cimg/node:14.16.1-browsers
resource_class: large
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- checkout
- run:
name: Install Node Modules
command: npm ci
- save_cache:
key: dependency-cache-{{ .Environment.CACHE_VERSION }}-{{ checksum
"package.json" }}-{{checksum "package-lock.json" }}
paths:
- ./node_modules
- run:
name: lint
command: npm run lint
- run:
name: Run E2E tests on staging
command: npm run test:e2e
- store_test_results:
path: tests/wdio-e2e/allure-results
// ETC
I run WebdriverIO using chromedriver-service.
I don't think that problem is with access to the internet, because I tried to solve this with Selenium Standalone service and was able to curl a jar file. What did I do wrong?
Solution 1:[1]
The problem was with wdio.config.js and async before() function. Forgot to remove it while was playing with setup.
async beforeTest() and async afterTest() functions can remain in the config file safely - they don't cause any trouble.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Viterzgir |