Skip to content

[🐛 Bug]: Cucumber-framework replaces error messages when using retries #14138

@alisher-qa

Description

@alisher-qa

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

9.7.2

Node.js Version

22

Mode

WDIO Testrunner

What happened?

Starting from 8.23.0 of @wdio/cucumber-framework package there is a regression that replaces some error messages with Error: Timeout if failing step is configured to retry.
Affects 9.7.2 too.

What is your expected behavior?

Retrying a step should not replace a meaningful error message with Error: Timeout.

How to reproduce the bug.

To reproduce the bug, clone this repo: https://github.com/alisher-qa/wdio-cucumber-retry
It contains 3 directories with identical files except for package.json and package-lock.json, with @wdio/cucumber-framework versions: 8.22.0, 8.41.0, 9.7.2.

  1. Go to one of directories, run npm install
  2. Run npm run wdio
  3. Wait for tests to end (1 min) and look at error messages.

Only in directory 8.22 you will get a proper error message in both scenarios.
In 8.41 and 9 directories you will get an Error: Timeout in the first scenario because of { wrapperOptions: { retry: 1 }

Relevant log output

[chrome 132.0.6834.159 linux #0-0] Running: chrome (v132.0.6834.159) on linux
[chrome 132.0.6834.159 linux #0-0] Session ID: d6224b1af46f540b988acc62fb477293
[chrome 132.0.6834.159 linux #0-0]
[chrome 132.0.6834.159 linux #0-0] » /features/retries.feature
[chrome 132.0.6834.159 linux #0-0] Cucumber retries
[chrome 132.0.6834.159 linux #0-0] This gets timeout error with retry
[chrome 132.0.6834.159 linux #0-0]     Given I am on the internet page
[chrome 132.0.6834.159 linux #0-0]     Then I assert element with retry
[chrome 132.0.6834.159 linux #0-0]
[chrome 132.0.6834.159 linux #0-0] This gets proper error without retry
[chrome 132.0.6834.159 linux #0-0]     Given I am on the internet page
[chrome 132.0.6834.159 linux #0-0]     Then I assert element without retry
[chrome 132.0.6834.159 linux #0-0]
[chrome 132.0.6834.159 linux #0-0] 2 passing (1m 14.2s)
[chrome 132.0.6834.159 linux #0-0] 2 failing
[chrome 132.0.6834.159 linux #0-0]
[chrome 132.0.6834.159 linux #0-0] 1) This gets timeout error with retry Then I assert element with retry
[chrome 132.0.6834.159 linux #0-0] Error: Timeout
[chrome 132.0.6834.159 linux #0-0] Error: Timeout
[chrome 132.0.6834.159 linux #0-0]     at listOnTimeout (node:internal/timers:569:17)
[chrome 132.0.6834.159 linux #0-0]     at process.processTimers (node:internal/timers:512:7)
[chrome 132.0.6834.159 linux #0-0]
[chrome 132.0.6834.159 linux #0-0] 2) This gets proper error without retry Then I assert element without retry
[chrome 132.0.6834.159 linux #0-0] Error: Element "someButton" was not in state "clickable". Locator: //*[@id="incorrect"]
[chrome 132.0.6834.159 linux #0-0] Error: Element "someButton" was not in state "clickable". Locator: //*[@id="incorrect"]
[chrome 132.0.6834.159 linux #0-0]     at <anonymous> (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/webdriverio/build/node.js:5576:15)
[chrome 132.0.6834.159 linux #0-0]     at Element.wrapCommandFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/@wdio/utils/build/index.js:893:23)
[chrome 132.0.6834.159 linux #0-0]     at Element.elementErrorHandlerCallbackFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/webdriverio/build/node.js:8178:24)
[chrome 132.0.6834.159 linux #0-0]     at Element.wrapCommandFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/@wdio/utils/build/index.js:893:23)
[chrome 132.0.6834.159 linux #0-0]     at Element.wrapCommandFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/@wdio/utils/build/index.js:893:23)
[chrome 132.0.6834.159 linux #0-0]     at Element.elementErrorHandlerCallbackFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/webdriverio/build/node.js:8178:24)
[chrome 132.0.6834.159 linux #0-0]     at Element.wrapCommandFn (/home/userr/Documents/work/wdio-cucumber-retry/9/node_modules/@wdio/utils/build/index.js:893:23)
[chrome 132.0.6834.159 linux #0-0]     at async func (file:///home/userr/Documents/work/wdio-cucumber-retry/9/features/pageobjects/page.js:28:11)
[chrome 132.0.6834.159 linux #0-0]     at async World.<anonymous> (file:///home/userr/Documents/work/wdio-cucumber-retry/9/features/step-definitions/steps.js:19:5)


Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:01:16

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions