webdriverio: [๐Ÿ› Bug]: Since v8 --spec only works with full path to spec file

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

16

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

Before v8 it was possible to use the --spec option with only mentioning the spec file. wdio then figured out, which spec file to load, depending on den given specs glob pattern config. This was very convenient to quickly limit test execution to just one spec file and not the whole suite.

What is your expected behavior?

Entering, for configured specs glob pattern test/itests/js/specs/mainProduct/**/*Test.js

wdio run --spec LoginTest.js should be the same as eg.

wdio run --spec test/itests/js/specs/mainProduct/LoginTest.js

How to reproduce the bug.

Make use of the --spec cli option in a wdio project without giving the full path to the spec js file.

Relevant log output

2022-12-30T16:00:31.536Z WARN @wdio/config:ConfigParser: pattern test/itests/js/specs/mainProduct/**/*Test.js did not match any file

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 49 (22 by maintainers)

Commits related to this issue

Most upvoted comments

Iโ€™m going to start working on this issue

I was able to create a PR for this potential fix. (Noted above.)

@mind-aman please not that one of the breaking changes in v8 was that file paths are resolved from the WDIO config location rather than the current working directory.

@christian-bromann Any news? This is very uncomfortable to use full path

Team webdriverio, please is there a solution to this issue?

Team webdriverio also includes you so any contributions are appreciated, thanks!

I am experiencing the same issue after I updated to v8. Prior to v* upgrade all my spec files were found. Team webdriverio, please is there a solution to this issue? Screenshot 2023-02-14 at 13 58 52

Hello,
I donโ€™t know if this is related, but it seems quite similar to my problem: In the wdio config file I specify for each specific browser I want to run my tests with, a list of paths to the tests I want to run on that browser. In V7 it was working perfectly just like I have it all configured now, but since V8, it does not seem to find anything on these paths.

My wdio config file: (the affected part) Screenshot 2023-02-09 at 15 26 02

The console showing that no tests are actually run: Screenshot 2023-02-09 at 15 26 14

Before it would show the paths of the tests that are being executed for the browser: Screenshot 2023-02-09 at 15 32 23

Just to try, In V8 I changed the routes to ./specs/my.test, but it then it seems to be executed outside of the module, so it fails. It shows like: file:///my-path-to-file

For further info, I have the wdio files and config located in the root dir as such: Screenshot 2023-02-09 at 15 32 38

And the compiler options are like this: Screenshot 2023-02-09 at 15 33 44

I hope this is enough information. Otherwise please let me know what you would need to understand better where the problem could be.

Thank you!!

I believe it has something to do with the changes in THIS LINE which now includes rootDir too as parameter