cypress-allure-plugin icon indicating copy to clipboard operation
cypress-allure-plugin copied to clipboard

Missing step details for previous tests

Open Shelex opened this issue 3 years ago • 10 comments

Hello team, I have configured the allure report successfully with my setup. I used version conf as below. Cypress: 12.5.1 After executing my test case. I am getting results for 2nd method, not for the first method. TestBody of the first method is overridden by the second method's tc. Please help to resolve this issue with the allure report.

Screenshot_6 Screenshot_7 Screenshot_8 image

Originally posted by @Sheth90 in https://github.com/Shelex/cypress-allure-plugin/issues/200#issuecomment-1493800979

Shelex avatar Apr 03 '23 12:04 Shelex

Hi @Sheth90 Please provide an example repo where such issue could be reproduced.

I see several reporter dependencies (mochawesome, cypress-multi-reporters, mocha-allure-reporter, cypress-allure-plugin), thus I am questioning they are properly set up.

mocha-allure-reporter for example was not working for cypress (it was the exact reason for creating this plugin) so I am not sure if it is working now properly.

Shelex avatar Apr 03 '23 12:04 Shelex

From this what you want to remove? And what is your suggestion?

{ "name": "samsung-kiosk", "version": "1.0.0", "main": "index.js", "scripts": { "launchcypress": "cypress open", "testcases": "cypress run --spec ./cypress/e2e/testcases/.js --browser chrome", "testcases-allure": "npm run allure:clear && cypress run --spec ./cypress/e2e/ParBrink/testcases/OverrideModifier.spec.js --browser chrome --headed --env allure=true", "allure:clear": "npx allure generate --clean -o allure-results", "test": "npx cypress run --spec ./cypress/e2e/testcases/.js", "cy:parallel": "cypress-parallel -d cypress/e2e/testcases/ -t 5 -s test", "cy:run": "cypress run — env allure=true", "allure:report": "allure generate allure-results --clean -o allure-report", "tests": "npm run cy:run || npm run aftertest" }, "keywords": [], "author": "Sanjay Sonule", "license": "ISC", "devDependencies": { "@4tw/cypress-drag-drop": "^1.4.0", "@faker-js/faker": "^7.6.0", "@shelex/cypress-allure-plugin": "^2.37.0", "allure-commandline": "^2.21.0", "cypress": "^12.5.1", "cypress-file-upload": "^4.1.1", "cypress-multi-reporters": "^1.6.2", "cypress-xpath": "^1.8.0", "mocha-allure-reporter": "^1.4.0", "mochawesome": "^7.1.3", "mochawesome-merge": "^4.2.0", "mochawesome-report-generator": "^6.2.0", "node-xlsx": "^0.21.0" }, "dependencies": { "cypress-downloadfile": "^1.2.0", "faker": "^5.5.3", "jsonpath": "^1.1.1" }, "description": "" }

Sheth90 avatar Apr 03 '23 12:04 Sheth90

@Sheth90, I am not suggesting to remove anything right now. I am asking you to provide example tiny repository to see your setup and ways to reproduce it. Maybe you have a mix of sync\async code or some specific setup - I have no idea.

Shelex avatar Apr 03 '23 12:04 Shelex

https://drive.google.com/file/d/1r6y1ktx0GEVIPtp6m-ipKKjfGWxEnGW-/view?usp=sharing

Download it from here. @Shelex

Sheth90 avatar Apr 03 '23 12:04 Sheth90

https://drive.google.com/file/d/1r6y1ktx0GEVIPtp6m-ipKKjfGWxEnGW-/view?usp=sharing

Download it from here. @Shelex

Thanks for example.

  1. You have duplicated setupNodeEvents in cypress.config.js:
e2e: {
- // you don't have `cypress/plugins/index.js` - so no need in requiring non-existing file:
-    setupNodeEvents(on, config) {
-      return require('./cypress/plugins/index.js')(on, config)
-    },
    baseUrl: 'https://stagingsamsunggrubbrrqa.azurewebsites.net/',
    specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
    setupNodeEvents(on, config) {
      allureWriter(on, config);
      return config;
  },
  1. you don't need allureReuseAfterSpec as you do not have cucumber or plugins that utilize after:spec event.

  2. mocha-allure-reporter is not used anywhere

  3. in package.json your allure:clear basically generates new report in allure-results, and I don't get the idea what is the purpose. Then you try to generate allure report based on another report in allure-results?

  4. In allure-report I see test with same name Backend Settings for override moidifiers-Actual flag is disabled on main section of modifier-See flag of Show On Kiosk with status "skipped" and status "passed". It makes sense to clear previous results.

Shelex avatar Apr 03 '23 13:04 Shelex

I did changes as you suggested. Still same problem. Please find below the code link for the same. For point number 5, every time the allure report is coming as a duplicate. Not comes with a proper tc result hence I need to clear the allure-result folder at the start of the script execution and once execution is completed then I need to fire a command to generate a report.

image

https://drive.google.com/file/d/1j58SkfNU3Us2t7TSNxfpxCtY_c31oqeV/view?usp=share_link @Shelex

Sheth90 avatar Apr 03 '23 14:04 Sheth90

@Sheth90 Thanks for example provided. I can reproduce it and confirm that it relates to #179 .

Why it works that way and looses steps:

  • in cypress.config.js you have "baseUrl": "OneUrl"
  • Cypress, and later Allure are initialized for "OneUrl"
  • in test you do visit("SecondUrl"), which is from another domain
  • Cypress refreshes the page and clears all state to prepare opening new domain
  • Allure is initialized fresh and clean for "SecondUrl", keeping trace of tests (because mocha runner has that info), but have no idea what steps were executed, as that info was cleared from browser window while visiting other domain.

Kind of workaround: if we remove baseUrl, we would see all tests with steps, as browser state is not cleared between domains (because there is no domain change). As for the proper solution - I have not found yet the mechanism how to persist or pass old Allure instance to other superdomain.

Shelex avatar Apr 04 '23 17:04 Shelex

Hi @Sheth90
As #179 is resolved in v2.38.3, I think your case should also be fixed as well.

Please check it on your end.

Shelex avatar Apr 05 '23 01:04 Shelex

@Shelex how to update allure report to the desire version at v2.38.3? I did the below changes in package.json, but still the result is not coming properly.

image image

Sheth90 avatar Apr 05 '23 05:04 Sheth90

@Sheth90 That means your specific case was not covered or covered just partially thus requires further investigation.

However, I can confirm that when I used cypress-parallel sometimes some of the results were empty, but not reproduced for me while using just cypress run - that is still in progress.

Shelex avatar Apr 06 '23 15:04 Shelex