Skip to content
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

JSON report is not generated anymore for versions above 2.28.0 #157

Closed
GRmeB opened this issue Sep 6, 2022 · 8 comments
Closed

JSON report is not generated anymore for versions above 2.28.0 #157

GRmeB opened this issue Sep 6, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@GRmeB
Copy link

GRmeB commented Sep 6, 2022

Describe the bug
All versions above the 2.28.0 are not creating Allure JSON report anymore in my case.

To Reproduce
Steps to reproduce the behavior:

  1. Please checkout my example project https://github.com/GRmeB/cypress_allure_example2
  2. then please execute the steps in the readme
  3. no JSON report is generated (expected under cypress/reports/allure/json in project)4.
  4. when downgrading the cypress-allure-plugin to 2.28.0 then everything seems to be fine with JSON report generation5.

Expected behavior
JSON report is generated.

Environment (please complete the following information):

  • Cypress version: 10.7.0
  • OS: Mac OS X 12.5.1

Developer Tools Console Output

Additional context

@GRmeB GRmeB added the bug Something isn't working label Sep 6, 2022
@GRmeB GRmeB changed the title JSON report is not generated anymore JSON report is not generated anymore for versions above 2.28.0 Sep 6, 2022
@christianopaets
Copy link

I have the same problem. Simple project, with one spec, neither passing by cli, cypres.env.json or inside cypress.config works

@Shelex
Copy link
Owner

Shelex commented Sep 6, 2022

Hi @GRmeB
Maybe it is related to #150 as I see you have that forked cucumber-preprocessor plugin.

Since v2.30.2 you can pass env variable allureReuseAfterSpec: true and it will not register new listener thus resolve your case.

And I assume it will resolve #156 too.

@GRmeB
Copy link
Author

GRmeB commented Sep 6, 2022

@Shelex setting allureReuseAfterSpec: true in cypress env doesn't change anything. The JSON report is not generated or do you mean something else? I updated https://github.com/GRmeB/cypress_allure_example2 with extending cypress env.

@GRmeB
Copy link
Author

GRmeB commented Sep 6, 2022

@Shelex and the forked cucumber preprocessor plugin (@badeball/cypress-cucumber-preprocessor) is the new stable repo, the other one is deprecated.

@Shelex
Copy link
Owner

Shelex commented Sep 6, 2022

@GRmeB

setting allureReuseAfterSpec: true in cypress env doesn't change anything.

As firstly you have allureWriter enabled, then preprocessor, the after:spec event listener is overwritten by preprocessor, thus this flag is inavitable to tell the allure-plugin to reuse existing listener.

forked cucumber preprocessor plugin (@badeball/cypress-cucumber-preprocessor) is the new stable repo

Sure, I have seen a transfer of ownership. I mean that they have changed the preprocessor behaviour and now to make this reporter work you need to add allureReuseAfterSpec flag.

I updated https://github.com/GRmeB/cypress_allure_example2 with extending cypress env

Thanks for the example repo, that really helped.

I do not have pnpm, so I have just moved arguments to package json script:
"cy:run": "./node_modules/.bin/cypress run --env USE_MOCHA=true,allure=true --config-file config/cypress_prod_github_com.ts", however, that does not matter in our case.

and enabled debug logs:

DEBUG=allure-plugin* npm run cy:run

my working directory is
/Users/me/repos/cypress_allure_example2

and here is a line from logs output:
allure-plugin:writer starting writing allure results to "/Users/me/repos/cypress/reports/allure/json" +15s

So it just takes allure results path ../cypress/reports/allure/json, and resolves to parent directory, instead of current.
So I have changed ../cypress/reports/allure/json -> cypress/reports/allure/json, and I can see a report in the correct folder, as well as screenshot attachments.

Could you please check it on your end?

@GRmeB
Copy link
Author

GRmeB commented Sep 7, 2022

@Shelex
I updated the repo again with your suggestions changing the allureResultsPath.

Now the Mocha tests are successfully running via npm run cy:run:all:mocha, but the Cucumber tests are not running anymore with the following message in log (in run mode and in open mode):

cypress:server:browsers:electron console message: { column: 21, level: 'warning', line: 7442, source: 'console-api', text: "Unhandled rejection TypeError: Cannot read properties of undefined (reading 'rule')\n" + '    at get currentRule [as currentRule] (https://github.com/__cypress/tests?p=cypress/support/e2e.ts:1857:29)\n' + '    at CucumberHandler.checkTags (https://github.com/__cypress/tests?p=cypress/support/e2e.ts:2000:29)\n' + '    at Runner.eval (https://github.com/__cypress/tests?p=cypress/support/e2e.ts:3013:39) color: red', url: 'https://github.com/__cypress/runner/cypress_runner.js' }

You can try this while executing npm run cy:run:all:cucumber. I only change the specPattern on runtime. Default specPattern is set to Cucumber Feature files and this pattern will be changed to Mocha files on runtime when setting the Cypress env USE_MOCHA=true, so nothing really fancy.

Further information:
We are currently migrating the Mocha based tests to Cucumber. That is why we need both in our repo to execute.

@Shelex
Copy link
Owner

Shelex commented Sep 7, 2022

@GRmeB Thanks for details provided.
There was issue with getting tags from missing Rule keyword details in gherkin, additional guards added, now works fine with v2.30.3.
Please check on your side.

@GRmeB
Copy link
Author

GRmeB commented Sep 7, 2022

@Shelex great! now it is working! I updated also the repo https://github.com/GRmeB/cypress_allure_example to have a running example for other people to show that it is running with Mocha and Cucumber.

Thank you guy :)

Also my other bug issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants