-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
[feature request] use tags for example tables for scenarios with more example tables #196
Comments
Hey @jimmy882 . I believe we use the same tag-expressions, but since we are running things through cypress as basically dynamically-created mocha tests our implementation of how we deal with tags is custom (and a reason for lack of features and problems). I don't have any issues with what you are suggesting, and might get around to it one day, but it's not high on my list of priorities, since none of our clients requested this so far. I'd love to take a PR though! |
Hi @lgandecki , I'm wanting to run exactly the same scenario as @jimmy882 to express different outcomes in different environments, but have found the same problem. I tried to trick it by setting a At the moment I'll have to copy the scenario outline and give it a different tag as a workaround |
This has some benefits, like that we no longer have to construct examples from outlines ourselves and tags are correctly inherited and applied. This also happens to fix #196 and #237.
Looking for the same feature, is there any workaround, please? |
Also need this functionality with tagged examples. any news? |
Also looking for this functionality, bump. |
We are also looking for this solution. Is there a beta version we can use to help test? |
we need that in our company! |
This feature would be great. bump |
This feature would be very interesting, does anyone have any workarounds? |
It would be awesome to have this feature, did anyone thought on a workaround? |
this is what exactly I needed for a scenario. Appreciate help on this feature |
Any update on this feature request. It would be very helpful if this feature is implemented |
This will be really helpful. Kindly share if there is any workaround for now. |
If at some point this feature will be implemented, that would be really great, thank you!! |
We would really appreciate if this feature can be implemented. Kindly share if there is any workaround for now. |
According to cucumber tags should be inherited downwards. See https://cucumber.io/docs/cucumber/api/#tags fix #196
Hello.. Any update when will this be merged? Thank you for adding this feature in first place |
Hello @RitikaGhosh15 , this is an issue not a PR, do you mean any specific PR you would like to be merged? The #557 ? |
@lgandecki ohk, i assumed it to be a new feature. Actually i am trying to run tags attached to examples in cypress-cucumber-preprocessor with command but its not considering the example tag and running both the examples npx cypress open --env env=devint TAGS='@mobile and @reg' |
This is exactly the usecase we had for our porject, that's why I made #557 to solve this, and in the mean while live up to the gherkin specs that says it should be possible. |
Would be great to have this feature, currently there is no workaround :( If someone has one, please share! |
This is quite a huge setback for my project too. :( |
there is work started here if you guys would like to contribute and help pushing this through the finish line: |
…es` in `cypress.json` cypress-tags finds no files when `testFiles` is set to `**/*.{feature,features}` in `cypress.json`. The problem was that the script expected that we can specify multiple glob patterns separated by a comma. But that is wrong. Cypress requires us to specify either an array of glob patterns or a single glob pattern string. And those glob patterns can be as complex as we want. So when a single string is specified, splitting by `,` was just wrong. Tested patterns: - `"testFiles": "**/*.feature"` - `"testFiles": "**/*.{feature,features}"` - `"testFiles": "{**/*.{features,featurex},**/*.feature}"` - `"testFiles": ["**/*.{feature,features}", "**/*.feature"]` - `"testFiles": ["{**/*.{features,featurex},**/*.feature}", "**/*.feature"]` This fix is related to #196.
Opened PR #607 for the feature files search bug. I can also work on the examples tag filtering bug if you want... |
@rkrisztian Thanks for looking into this issue. I would really appreciate if you could work on examples tag filtering... I've set-up an example project (clone from https://github.com/TheBrainFamily/cypress-cucumber-example, with addition of examples with tags):
|
Thank you @rkrisztian @dankopetrovic for looking into this issue. |
Hopefully, below command would work where I am trying to switch environment at run time specify in cypress.json. It is not working right now. |
…tly filtered by tags Now the script supports filtering examples of scenario outlines too. I have removed the optimization that we should check scenario tags if there are any, because they do not work for negated tags (e.g. `not @tag1`). Additionally, just checking the feature tag itself is also wrong, because a feature with tag `@feature` having a scenario with tag `@scenario` would incorrectly run when we filter for `not @scenario`. So the best is to leave the tag checking for "leaf nodes", i.e. scenarios or examples. Also consider the corner case where a feature has no scenarios or scenario outlines at all, i.e. again we would not run such a feature at all. Fixes #196.
@RitikaGhosh15 , @dankopetrovic , PR #609 opened. @jime2003 , I think the env problem should be a separate issue report to keep things focused. |
thanks @rkrisztian . I have opened new issue #610 |
…ctly filtered by tags (#609) * fix(cypress-tags.js): scenario outlines with examples were not correctly filtered by tags Now the script supports filtering examples of scenario outlines too. I have removed the optimization that we should check scenario tags if there are any, because they do not work for negated tags (e.g. `not @tag1`). Additionally, just checking the feature tag itself is also wrong, because a feature with tag `@feature` having a scenario with tag `@scenario` would incorrectly run when we filter for `not @scenario`. So the best is to leave the tag checking for "leaf nodes", i.e. scenarios or examples. Also consider the corner case where a feature has no scenarios or scenario outlines at all, i.e. again we would not run such a feature at all. Fixes #196. * fixup! fix(cypress-tags.js): scenario outlines with examples were not correctly filtered by tags
🎉 This issue has been resolved in version 4.3.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
It's working but screenshots are generated for other scenarious in the same feature file (without tag)... Cypress version: 8.5.0: |
I try it, but without success... |
I'm having a little trouble understanding your problem here. It appears that a screenshot is taken from a failing test (hence the "(failed)" in the name), but I can't see any failed tests. Can you provide me with a repository illustrating the issue? |
I run it like this (only with critical tag): npx cypress-tags run -e TAGS=@critical Examples with tag @other are pending - it's ok |
Calling The error could be could be caught inside https://github.com/TheBrainFamily/cypress-cucumber-preprocessor/blob/master/lib/createTestFromScenario.js#L70 But it's logged against this Cypress issue: cypress-io/cypress#14867 |
I see. It would appear to me as if the above-mentioned branch / fix would resolve the issue. Any further attempt to explain to me that it doesn't should be in the form of a repository I can clone, run easily and observe the problem at hand. |
I am still not able to set tags at example level and it fails to pick up the particular tags @tag1 @regression executing this command npx cypress --env TAGS='@sanity and not @regression' --spec 'feature file path' results in executing both the tags. If there is any other way please let me know Appreciate your kind response @badeball |
You're using the old package (ref. #689). |
@badeball thanks for your response. Is the latest cypress-cucumber-preprocessor package v11.0.0 ? Should i be upgrading to that ? |
No, it’s not. You can read latest release on the front page of the repository. And yeah, you should upgrade if you want updates and bug fixes such as what’s referred to here. |
Why would it given that you’re specifying sanity tag? Wasn’t this the goal to begin with? |
Yes the goal is to execute sanity tests but its executing including regression tags |
As I said earlier in the thread - if you think you've found an issue with this, you need to provide me with an example in the form of a repository I can clone, run easily and observe the problem at hand. |
Thanks for implementing this feature! It's super helpful. |
When I have a scenario with more example tables with different tags:
I would like to run only those examples that are tagged with specific tag, for example
@smoke
.This is possible with pure cucumber-js, do they use different tag-expressions?
According to cucumber documentation:
Tags can be placed above the following Gherkin elements:
I tried to run cucumber-js and it worked, but when running cypress with cypress-cucumber-preprocessor, I get an error:
We could not detect any tests in the above file. Write some tests and re-run.
The text was updated successfully, but these errors were encountered: