📚 AUTOMATE your TESTS REPORTS with CYPRESS 10+ & CUCUMBER | HTML Report 🔥
Vložit
- čas přidán 21. 08. 2024
- ✅ Automated HTML Reports with Cypress 10+ & Cucumber?
Repo: github.com/Joa...
#cypress #testing #automation #automationtesting #software #softwareengineer #softwaretesting #softwaredeveloper #javascript #typescript
🤖DISCORD: discord.gg/2F9E2fRGaU
⭐PREMIUM Cypress + Typescript course: shorturl.at/dcnPn
📣FREE Cypress videos: shorturl.at/h6iEX
Hey man, thank you so much for this tutorial. I was with some problem to make the reporter works and your video helped me to solve it.
Happy to hear that Adelino!
Hi Joan Media, there is any reason why you can see the screenshot when fails and I don't? I have screenshots in true in the config file and I have a folder with screenshots, but I can't see this in the report, I have search why does this happenning, but i haven't find a way to.. If you have any idea let me know, thanks!
Hi There, if anyone is facing any empty log.json file, please add the below into your cypress.config.js file, BTW: Excellent video @JoanMedia,
env: {
allureReuseAfterSpec: true
}
Hello,
I would like to have multiple cucumber json report( one report by feature file) like it used to work on V9 using the outputFolder, prefixFile, suffixFile in package.json
I am not able to do it using the badeball version, any solution please ?
It only generate 1 single file for all features.
Hello Fresh, I think this is the way how it works now. I'll think about it and if something comes to my mind, I'll let you know.
@@joanmedia thank you!
Hi Joan, thx for video. One question for json-formatter.exe, it's possible download this plugin with npm??
How it's works in pipeline?
There is not npm package (I could be wrong). To resolve the pipeline issue you’ll need to download it manually and place it in your ci/cd environment
My Test not generate the reports with there are a failure step. How I can Fix it? I Used a multiple-cucumber-html-reporter
czcams.com/video/3tkAoj1YNhI/video.html
thank you
it helps me alot,
can you made videos on plugins of cypress.
Thanks Rocky. Will try to do more soon :D
Hello @JoanMedia, thank you for the video, I managed to configure the html report, but i have an issue with retries. Before Cypress 10 I got for each feature a separate json and in the html report i saw only the final result after the retry. Now I see the result prior the retry, which is confusing, because after the retry the test passed. So in CI I could have passing all tests but still have fails in my html report. Do you know how it can be fixed?
Thanks my friend for your videos,
Right now i have a problem i did exactly what you did but still the log.json file empty when i run the tests!
What should be the solution?
Helo Ahmad! Did you get some error message?
@@joanmedia it's fixed, i had to rename the file "cucumber-json-formatte.exe" to "cucumber-json-formatter" because i use mac.
but now after i can the report see. i got an err in Jenkins when i want to see the cucumber report.
so i configured in Jenkins file:
cucumber fileIncludePattern: 'log.json', jsonReportDirectory: 'jsonlogs',
but i got this in Jenkins (cucumber report):
Trying to generate report from following files. Make sure they are valid cucumber report files:
/var/jenkins_home/jobs/HAP/jobs/Spoed EPD cypress/jobs/2.Spoed Cypress Baseline/builds/167/cucumber-html-reports/.cache/jsonlogs/log.json
Do u have an idea what i should change in Jenkins file?
Facing same issue --Now resolved ----use this video--- czcams.com/video/3tkAoj1YNhI/video.html------
Hello @Jaon, Thank you for the video, I did exactly as you mentioned but
when i run cypress:execution then test is running on electron mode and passed too but jsonlogs folder is not generated.
and i am getting an error message below
-- Couldn't find tsconfig.json. tsconfig-paths will be skipped.
i also have the same issue , anyone can some one help why i cannot see the folder getting generated?
I tried different tutorials from you but they do not work as u show, for example this one, trying the fixes provided, it still does not populate log.json, and shows this error on win 11
An error was thrown in your plugins file while executing the handler for the after:run event.
The error we received was:
Error: spawn UNKNOWN
at ChildProcess.spawn (node:internal/child_process:413:11)
at Object.spawn (node:child_process:757:9)
at afterRunHandler (C:\**\JS_Cypress_Sandbox
ode_modules\@badeball\cypress-cucumber-preprocessor\lib\add-cucumber-preprocessor-plugin.js:112:55)
Awesome work. Thank you so much!!
Thank you Ian for your support!
Hi Joan..I tried what you have specified but am not able to generate json files (but able to generate message.ndjson files).
I'm getting the below error message:
'An error was thrown in your plugins file while executing the handler for the after:run event. The error received was:
Error: spawn cucumber-json-formatter.exe ENONT'.
Can you please provide your suggestions on fixing this?
P.S.: I'm working on MAC
@Cristina Garzón Thanks.. I'll check this approach!!
same here...it generated message.ndjson file...but not json file.... I am running on windows11, waht could be the issue...i have put the cucumber-json-formatter at root folder where my cypress code resides and have put the root folder in PATH,but still not able to get log.json file. Appreciate for any help
It makes sense. Probably it is a matter of how the folder structure is, and permissions. Hope it works and thanks for help Cristina.
About Windows 11 I do not have an operating system to test it :( as soon as I have one environment, will let you know my results.
@@roopaar4726 I encountered this same error on both MAC and Windows 10 and solved it by doing the following:
Place cucumber-json-formatter(exe) in the root directory of the project.
I specified the relative path to 'cucumber-json-formatter' file in .cypress-cucumber-preprocessorrc.json
Windows: "formatter": "./cucumber-json-formatter.exe"
MAC: "formatter": "./cucumber-json-formatter"
Below is my .cypress-cucumber-preprocessorrc.json
{
"json": {
"enabled": true,
"output": "jsonlogs/log.json",
"formatter": "./cucumber-json-formatter.exe"
},
"messages": {
"enabled": true,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": true
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}",
"[filepath]\\***.{js,ts}",
"[filepath].{js,ts}",
"cypress\\e2e\\step_definitions\\*.{js,ts}"
]
}
Hi Joan. When I Navigate to the folder where i saved the 'cucumber-json-formatter' file. When I run this command - cucumber-json-formatter --help to test that the cucumber-json-formatter works, I get this error message - "zsh: command not found: cucumber-json-formatter"
I followed this movie, thanks for making it. However I do get the message file with content. But it creates an empty JSON file.
Do you have any sugestions what the cause canm be ?
Hello Joan, the Mac OS version of the json reporter does not work for Apple Silicon (M1 Chip). Will a version be released for this?
Hi, thank you for your videos. It's so helpful for me to work in Cypress Automation.
Anyway, I have stuck when try to integrate Cypress 10 with browserstack due the configuration changes.
Could you make a tutorial of it?
Thanks before
Hello! I think I need to revisit that integration. Adding it to the to-dos list :D
Hey Joan, How to print the run time captured data in the html report
I have issue that my project cannot generate the log.json. Which is the best report for cucumber in cypress? Thank you.
Hello I just updated the repo with a new hotfix: github.com/JoanEsquivel/cypress-cucumber-boilerplate hopefully now it generates the log.json.
If it does not work for you, you can integrate the allure reporter. You have a demo video of allure in this channel :)
@@joanmedia thank you so much.
I am facing step implementation missing error while running cucumber feature file tests.
Hello Arushi check the cucumber configuration video or check the repo in the description of this video. Hopefully you can see what’s wrong.
I am facing same issue Arushi did you resolve it
Thank you so much. Super
Hello Anand! Thank you.
Hey Joan. Thank you for video, it was helpful. But I have some issue, to generate log.json. file itself creating after "cucumber-json-formatter-darwin-amd64" and imported in framework path, made it executable, changed "cucumber-json-formatter.exe" to "cucumber-json-formatter". but still getting error. and report doesnt generate.
error Error: spawn cucumber-json-formatter ENOENT
I encountered this same error on both MAC and Windows 10 and solved it by doing the following:
Place cucumber-json-formatter(exe) in the root directory of the project.
I specified the relative path to 'cucumber-json-formatter' file in .cypress-cucumber-preprocessorrc.json
Windows: "formatter": "./cucumber-json-formatter.exe"
MAC: "formatter": "./cucumber-json-formatter"
Below is my .cypress-cucumber-preprocessorrc.json
{
"json": {
"enabled": true,
"output": "jsonlogs/log.json",
"formatter": "./cucumber-json-formatter.exe"
},
"messages": {
"enabled": true,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": true
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}",
"[filepath]\\***.{js,ts}",
"[filepath].{js,ts}",
"cypress\\e2e\\step_definitions\\*.{js,ts}"
]
}
Hi, how do you setup coverage?
This reporter is not creating the proper reports for the feature file containing the Examples for me. Any one else facing the same issue?
czcams.com/video/3tkAoj1YNhI/video.html
Hello. Maybe somebody helps me. I am faced with an issue, when I execute my test, my log.json file is empty. And when I open HTML report file in the browser, the page is empty too.
Hi @Danylo Andriushko, I have resolved this issue by adding the below into my cypress.config.js file
env: {
allureReuseAfterSpec: true
}
Hi Joan, thank you these videos have been so helpful. McAfee is identifying cucumber json formatter exe file as a trojan , is there an alternative to generate the HTML report.
Hello! There is not at least using that library(the only one I see with constant maintenance). Is there any chance that you can open an issue in the "json formatter" repo with your report?
I´ll try to research for a workaround.
Hi Joan, your videos are really helpful. Thanks alot.
I tried this and worked. I went ahead and pushed code to git repository and integrated with Jenkins.
I see that cucumber-json-formatter.exe being an application file is not being copied in git and hence missing in jenkins local repository causing after:run to fail with below error.
An error was thrown in your plugins file while executing the handler for the after:run event.
The error we received was:
Error: spawn cucumber-json-formatter ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Please can you help.
@joanmedia: please can you help
@@pujadalvi4251 Did you solve this issue?
@@danyloandriushko4273 Not yet
I am having same issue -- Followed exactly but log.Json is not creating
I encountered a similar issue, please ensure you are using the latest Node version and the latest npm version. Furthermore, I created a .bin directory and added the Linux version of the cucumber-json-formatter, then I made it executable via shell script. within my Jenkins file
ex: within the checkout stage
sh "chmod +x cucumber-json-formatter"
I'm getting this issue after node ./cucumber-html-report.js:
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'node:path'
Require stack:......
Do you have any idea?
hello i have faced the same issue, Did you find a way to resolve it ?
Hey Joan. Thank you for video, it was helpful. But I have some issue, to generate log.json. file itself creating after "cucumber-json-formatter-darwin-amd64" and imported in framework path, made it executable, changed "cucumber-json-formatter.exe" to "cucumber-json-formatter". but still getting error. and report doesnt generate.
error Error: spawn cucumber-json-formatter ENOENT
I am having the same problem
I am having same issue -- Followed exactly but log.Json is not creating
Sahaja Yogi
@@sahajayogi7252 I implemented different approach. and it works well.
@@Armagedonnable Can you explain what you did different?
I encountered this same error on both MAC and Windows 10 and solved it by doing the following:
Place cucumber-json-formatter(exe) in the root directory of the project.
I specified the relative path to 'cucumber-json-formatter' file in .cypress-cucumber-preprocessorrc.json
Windows: "formatter": "./cucumber-json-formatter.exe"
MAC: "formatter": "./cucumber-json-formatter"
Below is my .cypress-cucumber-preprocessorrc.json
{
"json": {
"enabled": true,
"output": "jsonlogs/log.json",
"formatter": "./cucumber-json-formatter.exe"
},
"messages": {
"enabled": true,
"output": "jsonlogs/messages.ndjson"
},
"html": {
"enabled": true
},
"stepDefinitions": [
"[filepath]/**/*.{js,ts}",
"[filepath].{js,ts}",
"cypress/e2e/step_definitions/*.{js,ts}",
"[filepath]\\***.{js,ts}",
"[filepath].{js,ts}",
"cypress\\e2e\\step_definitions\\*.{js,ts}"
]
}