fix: Catch requests failure to trigger the result and onAfterCommand event#13922
Conversation
eslint-plugin-wdio
@wdio/allure-reporter
@wdio/browser-runner
@wdio/appium-service
@wdio/browserstack-service
@wdio/cli
@wdio/concise-reporter
@wdio/config
@wdio/cucumber-framework
@wdio/dot-reporter
@wdio/firefox-profile-service
@wdio/globals
@wdio/jasmine-framework
@wdio/json-reporter
@wdio/junit-reporter
@wdio/lighthouse-service
@wdio/local-runner
@wdio/logger
@wdio/mocha-framework
@wdio/protocols
@wdio/repl
@wdio/reporter
@wdio/runner
@wdio/sauce-service
@wdio/shared-store-service
@wdio/smoke-test-cjs-service
@wdio/smoke-test-service
@wdio/smoke-test-reporter
@wdio/spec-reporter
@wdio/static-server-service
@wdio/sumologic-reporter
@wdio/testingbot-service
@wdio/types
@wdio/utils
@wdio/webdriver-mock-service
webdriver
webdriverio
commit: |
christian-bromann
left a comment
There was a problem hiding this comment.
Thanks for raising the PR, could we have unit tests for this?
I am trying, but I have difficulties finding how to enter the catch in the tests; maybe tomorrow I will have something! |
4887a79 to
0ffe3d2
Compare
|
@christian-bromann it is ✅ with unit test, just missing approval and merge 🎉 |
|
Hey dprevost-LMI 👋 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. We are looking forward to more contributions from you in the future 🙌 Have a nice day, |
Proposed changes
As described in #13921 and #13915, we can trigger
onBeforeCommandwithout the expectedonAfterCommand,resulting, for example, in the case of allure-reporter, in generating more start steps than stopStep and, in the end, making the generator hang in a specific scenario.Here is a proposition to catch all errors on
request.makeRequestto ensure we trigger theresultevent, which consequently triggers theonAfterCommand. In the end, it now ensures the allure-reporter has the same amount ofstartStepandendStep.Types of changes
New feature (non-breaking change which adds functionality)Breaking change (fix or feature that would cause existing functionality to not work as expected)Documentation update (improvements to the project's docs)Specification changes (updates to WebDriver command specifications)Internal updates (everything related to internal scripts, governance documentation and CI files)Checklist
I have added the necessary documentation (if appropriate)I have added proper type definitions for new commands (if appropriate)Backport Request
v9and doesn't need to be back-portedBack-ported PR at#XXXXXFurther comments
Reviewers: @webdriverio/project-committers
Example in allure report: