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
29 stars 23 forks source link

fix: Prevent "Connection closed" errors when deleting the session for @wdio/cucumber-framework #116

Closed seanpoulter closed 5 months ago

seanpoulter commented 5 months ago

Proposed Changes

This fixes #115.

Validation

Since we don't have Cucumber set up in this repo I used seanpoulter/wdio-vscode-cucumber-example:

$ cd .../wdio-vscode-service
$ npm link
$ npm run build

$ cd .../wdio-vscode-cucumber-example
$ npm link wdio-vscode-service

$ npm run test

> test
> wdio run ./test/wdio.conf.ts

Execution of 1 workers started at 2024-02-27T01:45:04.115Z

Skipping download, bundle for ChromeDriver v27.2.3 already exists
Found existing install in .../.wdio-vscode-service/vscode-linux-arm64-1.86.2. Skipping download
[0-0] RUNNING in chrome - file:///test/features/webview.feature
[0-0] PASSED in chrome - file:///test/features/webview.feature

 "spec" Reporter:
------------------------------------------------------------------
[chrome 118.0.5993.159 linux #0-0] Running: chrome (v118.0.5993.159) on linux
[chrome 118.0.5993.159 linux #0-0] Session ID: 90871adafb5727ca052e30dc884ec9e9
[chrome 118.0.5993.159 linux #0-0]
[chrome 118.0.5993.159 linux #0-0] » /test/features/webview.feature
[chrome 118.0.5993.159 linux #0-0] Hello World
[chrome 118.0.5993.159 linux #0-0] As an extension developer
[chrome 118.0.5993.159 linux #0-0] I want to test if a Webview is displayed
[chrome 118.0.5993.159 linux #0-0]
[chrome 118.0.5993.159 linux #0-0] Webview Shows "Hello World!"
[chrome 118.0.5993.159 linux #0-0]    ✓ When I open the Webview
[chrome 118.0.5993.159 linux #0-0]    ✓ Then I expect that "Hello World!" is displayed
[chrome 118.0.5993.159 linux #0-0]
[chrome 118.0.5993.159 linux #0-0] 2 passing (3.2s)

Spec Files:      1 passed, 1 total (100% completed) in 00:00:10  

:tada:

seanpoulter commented 5 months ago

I am a bit confused as to why Cucumber behaves differently here.

Me too. There wasn't anything obvious comparing the run method for the Mocha and Cucumber frameworks. As a hunch, it seems like Mocha is either not making request after the test case, or it's hiding the rejected promise.

wdio-bot commented 5 months ago

Hey seanpoulter 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution. We've sent you an email with further instructions on how to claim your expenses from our development fund. Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day, The WebdriverIO Team 🤖