New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@wdio/cucumber-framework: Filter specs /w Cucumber Tag Expression before spawning workers #10330
@wdio/cucumber-framework: Filter specs /w Cucumber Tag Expression before spawning workers #10330
Conversation
@christian-bromann Mind having a look at the failing jobs, seems like the new dependencies have trouble being imported with the browser-runner? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make sure we keep Cucumber related functionality in the Cucumber package.
I am looking into fixing the build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something happened here that reverted some changes from the past, can we revert them?
Apologies, differences between my origin and upstream, should be fixed |
I moved the implementation over to I noticed if we have 4 files total and when filtering by tag we get 1 file, the reporter output still spits out 4 files. npx wdio my.conf --cucumberOpts.tagExpression="@myTagThatExistsInOneFileOutOfFour"
Execution of 4 workers started at [redacted]
[0-0] RUNNING in chrome - file:///features/Login.feature
[0-0] PASSED in chrome - file:///features/Login.feature
"spec" Reporter:
------------------------------------------------------------------
Running: chrome (v113.0.0.0) on darwin
Session ID: etc
» /features/MyFeature.feature
MyFeature
User can do stuff
✓ Given I do stuff
1 passing (9.7s)
Spec Files: 1 passed, 4 total (25% completed) in 00:00:14 This did not happen when filtering was done in Is this intended behavior? |
This should be ready to go, despite the Linux job failing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions, I like it is now all within the cucumber adapter package.
const require = createRequire(import.meta.url) | ||
const EventDataCollector = require('@cucumber/cucumber/lib/formatter/helpers/event_data_collector').default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems Cucumber now has ESM support so maybe we can update this and now import the EventDataCollector
via import statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think this is possible yet. See TypeStrong/ts-node#1585
Since EventDataCollector
is still not exported from @cucumber/cucumber
I need to
import { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers'
// or
import { EventDataCollector } from '@cucumber/cucumber/lib/formatter/helpers/index.js'
But I'm getting
No known conditions for "./lib/formatter/helpers" specifier in "@cucumber/cucumber" package
Added a comment to the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers! I saw an export for all lib files but then realised that it was only for require
imports:
"./lib/*": {
"require": "./lib/*.js"
},
😞
While on the subject, WDIO should really have a flag to pass the tags @christian-bromann Try typing --cucumberOpts.tagExpression="@myTag" three times fast 😅 --tags "@myTag" Is where it's at. |
Feel free to raise a PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for updating the Cucumber deps 🎉 👍
Hello @christian-bromann @nextlevelbeard , |
fixes #8253
Proposed changes
Makes use of CucumberJS API to read the content of the Feature files used by the Cucumber framework to then filter the specs based on the provided Tag Expression.
We do this before spawning any workers, optimizing heavily the filtering process for less optimal hardware and from even moderate amounts of specs.
Before this change, a worker was spawned for each spec file, the worker would skip the file and then terminate, impacting performance heavily.
The filtering implementation is compatible with latest changes to the Gherkin spec (like the addition of the Rule).
Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers