-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
feat: add support for cypress-cucumber-preprocessor #172
Conversation
Hey, thanks for the PR. It looks great! I started to add example & some changes to the README file, but I don't have permissions to the fork, can you please give me push permissions? If you could add some scenarios (some success and some fail), I can create the tests afterward - as I'm unfamiliar with cucumber. Also just wanted to make sure that this is the output you want Thanks. |
Thank for taking time to look at this :)
It seems this is not possible from forks made on an organization https://github.com/orgs/community/discussions/5634 You could cherry-pick my commits and just discard this PR once it is done. I don't really care.
Yes of course. I'll try to that for next week.
Yes that's what I expect. The code highlight is not working because it expects JS/TS but that's not really critical, at least for my needs. And it's something to fix/configure in mochawesome anyway, not in the reporter. |
I just saw that there is not need to grab the gherkinDocument from window. It is already passed to Before hooks https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/cucumber-basics.md#scenario-hooks |
1ac5ca3
to
8c17960
Compare
@LironEr I added a base example. Tried to understand how your output test works but got no luck :) I added a note on the README to suggest to use cypress-on-fix module because I also have a issue to fix : on the failed job I see the Cucumber source AND the |
Fixed the mentionned issue : it was caused by duplicate context variable (one for each attempt) Also added a "Scenario Outline" to test this specific case |
Had a case where "context" was not an array but a single item (it was a non cucumber failing test) "context": "{\n \"title\": \"cypress-mochawesome-reporter-screenshots\",\n \"value\": [\n [\n \"/plugins.cy.ts/plugins -- jms (failed).png\"\n ]\n ]\n}", I added a condition in enhanceReport.js to handle this case |
Thank you @mistic100 |
This solves #130
Users of
cypress-cucumber-preprocessor
will be able to importcucumberSupport
in their steps in order to store the gherkin AST in the test context. During the report generation the context will be used to remplace the code by the actual gherkin.I tried to keep the modification as light as possible without adding any required dependencies.
@badeball/cypress-cucumber-preprocessor
is only imported incucumberSupport.js
@cucumber/gherkin-utils
is imported inside a try-catch block inenhanceReport.js
All of this is optionnal allowing to mix Cucumber features and standard tests in the same suite.
There is still need to add tests, for now I cannot tell when I will be able to do it.