webdriverio-community / wdio-vscode-service

A service to test VSCode extensions from end to end using WebdriverIO
https://webdriverio-community.github.io/wdio-vscode-service/
MIT License
31 stars 25 forks source link

CI/CD for vscode extension #131

Open Hemavathy12 opened 1 month ago

Hemavathy12 commented 1 month ago

I'm planning to use wdio-vscode-service for implementing end-to-end tests for a vscode extension. I need to run those tests as part of CI/CD using Docker + Kuberbetes. I could see some docker documentation for running tests written for browser services but couldn't find any for vscode service. Need some help for the same.

I tried using node:18.19.1-bullseye docker image and I got the following error:

*[0-0] 2024-08-05T10:49:11.207Z WARN chromedriver: /tmp/chromedriver/linux-124.0.6367.207/chromedriver-linux64/chromedriver: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory [0-0] 2024-08-05T10:49:21.220Z INFO @wdio/utils: Started Chromedriver v124 with params --port=38755 --allowed-origins= --allowed-ips=0.0.0.0 in 12031ms on port 38755 [0-0] 2024-08-05T10:49:21.706Z INFO webdriver: [POST] http://0.0.0.0:38755/session [0-0] 2024-08-05T10:49:21.707Z INFO webdriver: DATA { [0-0] capabilities: { [0-0] alwaysMatch: { [0-0] browserName: 'chrome', [0-0] browserVersion: '124', [0-0] 'wdio:vscodeOptions': [Object], [0-0] 'goog:chromeOptions': [Object] [0-0] }, [0-0] firstMatch: [ {} ] [0-0] }, [0-0] desiredCapabilities: { [0-0] browserName: 'chrome', [0-0] browserVersion: '124', [0-0] 'wdio:vscodeOptions': { [0-0] extensionPath: '/home/jenkins/agent/workspace/wdio-poc/src', [0-0] userSettings: [Object], [0-0] binary: '/home/jenkins/agent/workspace/wdio-poc/.wdio-vscode-service/vscode-linux-x64-1.92.0/code' [0-0] }, [0-0] 'goog:chromeOptions': { [0-0] binary: '/home/jenkins/agent/workspace/wdio-poc/node_modules/wdio-vscode-service/dist/chromium/index.js', [0-0] args: [Array], [0-0] windowTypes: [Array] [0-0] } [0-0] } [0-0] } [0-0] 2024-08-05T10:49:22.024Z ERROR webdriver: RequestError: connect ECONNREFUSED 0.0.0.0:38755 [0-0] at ClientRequest. (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/webdriver/node_modules/got/dist/source/core/index.js:790:107) [0-0] at Object.onceWrapper (node:events:628:26) [0-0] at ClientRequest.emit (node:events:525:35) [0-0] at ClientRequest.emit (node:domain:489:12) [0-0] at Socket.socketErrorListener (node:_http_client:494:9) [0-0] at Socket.emit (node:events:513:28) [0-0] at Socket.emit (node:domain:489:12) [0-0] at emitErrorNT (node:internal/streams/destroy:157:8) [0-0] at emitErrorCloseNT (node:internal/streams/destroy:122:3) [0-0] at processTicksAndRejections (node:internal/process/task_queues:83:21) [0-0] at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16) [0-0] 2024-08-05T10:49:22.024Z ERROR @wdio/runner: Error: Failed to create session. [0-0] Unable to connect to "http://0.0.0.0:38755/", make sure browser driver is running on that address. [0-0] It seems like the service failed to start or is rejecting any connections. [0-0] at startWebDriverSession (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/webdriver/build/utils.js:69:15) [0-0] at runMicrotasks () [0-0] at processTicksAndRejections (node:internal/process/task_queues:96:5) [0-0] at async Function.newSession (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/webdriver/build/index.js:19:45) [0-0] at async remote (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/webdriverio/build/index.js:46:22) [0-0] at async Runner._startSession (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/@wdio/runner/build/index.js:241:29) [0-0] at async Runner._initSession (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/@wdio/runner/build/index.js:207:25) [0-0] at async Runner.run (file:///home/jenkins/agent/workspace/wdio-poc/node_modules/@wdio/runner/build/index.js:88:19) [0-0] 2024-08-05T10:49:22.026Z DEBUG @wdio/utils:shim: Finished to run "after" hook in 0ms 2024-08-05T10:49:22.143Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1**

Thanks.

christian-bromann commented 1 month ago

RequestError: connect ECONNREFUSED 0.0.0.0:38755

I am not sure how your setup looks like but this error says that WebdriverIO can't connect to Chromedriver. The Chromedriver logs reveal the following error:

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

I am not sure what this error means but it seems there are some missing dependency in the Docker image.

Hemavathy12 commented 1 month ago

RequestError: connect ECONNREFUSED 0.0.0.0:38755

I am not sure how your setup looks like but this error says that WebdriverIO can't connect to Chromedriver. The Chromedriver logs reveal the following error:

error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

I am not sure what this error means but it seems there are some missing dependency in the Docker image.

I ran the tests using this docker image: https://github.com/nodejs/docker-node/blob/619b871fb3d89dc6d6333914b46bf526e781eec5/18/bullseye/Dockerfile

Assumed that pre-requisite for running the tests written for a vscode extension is NodeJs - v16.x or higher. Do we need any other requirements?

christian-bromann commented 1 month ago

Do we need any other requirements?

I don't think so.