Issue with 'Rerun failed tests' Feature Incorrectly Handling File Paths

  • WebdriverIO version: v8 (Previous version v7 doesn’t add URI path to the file. I think it’s coming from changes in Node.js 18)
  • Env: Node v18.18

When using the “Rerun failed tests” feature in CircleCI with our WebdriverIO v8 test framework, the rerun command is not correctly handling the file paths of the failed tests. The expected behavior is to grab and rerun only the feature files that contain failed tests. However, instead of getting and passing only the name of the failed feature file (test.feature), it is getting the name of the file with the prefixed URI ‘file://’ in front (file://test.feature). This leads to an incorrect path and causes the rerun to fail.
“Error: spec file(s) /Users/distiller/project/app/e2e/file:/features/file.feature not found”

We are triggering our test from CircleCI config with this command
mkdir -p reports circleci tests glob “features/**/*.feature” | circleci tests run --command="xargs yarn wdio run wdio.ios.conf.ts --cucumberOpts.tags=‘@ios’ --spec " --verbose --split-by=timings

With leads to this command:

$ /Users/distiller/project/app/e2e/node_modules/.bin/wdio run wdio.ios.conf.ts --cucumberOpts.tags=@ios --spec features/articles.feature features/test1.feature features/test2.feature features/test3.feature features/test4.feature

And then, when we have failing tests and trying to “Rerun failed tests,” we are getting:

Installing circleci-tests-plugin-cli plugin.
circleci-tests-plugin-cli plugin Installed. Version: 1.0.7332-dfcf8a1
INFO[2024-02-27T16:09:12Z] received failed tests from workflow 3c40dc68-c1c6-4862-aaec-5ff43c1dd443 
INFO[2024-02-27T16:09:12Z] 3 test(s) failed out of 172 total tests. Rerunning tests from 2 files 
DEBU[2024-02-27T16:09:12Z] if all tests are being run instead of only failed tests, ensure your JUnit XML has a file or classname attribute. 
DEBU[2024-02-27T16:09:12Z] starting execution                           
DEBU[2024-02-27T16:09:12Z] Received: file://./features/test1.feature   
yarn run v1.22.19
**$ /Users/distiller/project/app/e2e/node_modules/.bin/wdio run wdio.ios.conf.ts --cucumberOpts.tags=@ios --spec file://./features/test1.feature**
Error: spec file(s) /Users/distiller/project/app/e2e/file:/features/test1.feature not found

I believe the issue seems to be with how CircleCI is handling the file paths during the rerun process. Can you handle it ASAP?

PS: I can’t provide a screenshot because new users can’t upload photos, but if somebody wants, I can share them.

After triggering the test with a list of feature files, WDIO adds the file:// prefix to them like this

$ /Users/distiller/project/app/e2e/node_modules/.bin/wdio run wdio.ios.conf.ts --cucumberOpts.tags=@ios --spec features/articles.feature features/deleteAccount.feature features/mfaElevatedChallenge.feature features/offerTypes.feature features/raffle.feature

Execution of 5 workers started at 2024-02-27T14:57:48.993Z

[0-0] RUNNING in iOS - file:///features/articles.feature
[0-0] PASSED in iOS - file:///features/articles.feature
[0-1] RUNNING in iOS - file:///features/deleteAccount.feature
[0-1] PASSED in iOS - file:///features/deleteAccount.feature
[0-2] RUNNING in iOS - file:///features/mfaElevatedChallenge.feature

If anyone is interested, I have created a small bash script, which helped me find a temporary workaround.

Github . com /spazbg/circleci-wdio-rerun-fix