cypress-plugins: Not able to execute npx cypress-slack-reporter - `find mochareports`
Hi!
Thanks so much creating this plugin! 🥇 💯 👍
I’m having issues running the execution part npx cypress-slack-reporter
npx cypress-slack-reporter Error: Cannot find test report @ /Users/ronakchovatiya/Documents/Work/.../mochareports
Specifically Set the following environment variables in your localhost or CI configuration. 🤔
i've created config.env.test file with my slack webhook
$SLACK_WEBHOOK_URL - The full URL you created in the last step
where does the export go?
$ export SLACK_WEBHOOK_URL=yourWebhookUrlHere -
Execution
$ npx cypress-slack-reporter --help - this works
Steps performed
- yarn add cypress-slack-reporter --dev
- yarn add mocha @5.4.2 (instead of the latest 6 which gave error)
- yarn Added all of mochawesome reports (if i add the --reporter flag it works and i do get a html report)
- Created Slack app and Webhook URL / Oauth
- added code snippets for cypress.json and reporterOpts.json
- I’m not using CIRCLE CI - need it to just run locally for now then will add gitlab later
Guess the main issue I’m faceing not know how to hook up the config.test.env file in my react app and error message for not finding mochareports
i even created folder with same name in the specified place.
P.S - i’ve tried the same steps for the example repo you’ve created react-ts-testing-example
Which has all setup - i am able to run the website locally and normal cypress test pass… But 😓 not able to run npx cypress-slack-reporter
System Info
MacOS
Cypress : 3.3.0
“cypress-slack-reporter”: “^0.2.6”,
“mocha-multi-reporters”: “^1.1.7”,
“mochawesome”: “^3.1.2”,
“mochawesome-merge”: “^1.0.7”,
“mochawesome-report-generator”: “^3.1.5”,
–
Thanks again! 🙏
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (10 by maintainers)
ah
/mochareports
is manual folder i created, it doesn’t have any files.Cheers buddy! Glad it has worked for you! Good luck with Edge!
Thanks for the offer of a coffee! I’ve only been to America once (to NYC for a work conference) but plan on going out there with the wife soon, so you never know, might take you up on that 😆
ahhh right, yeah that’ll do it, if you run cypress, with the reporterOpts as described in the readme, you would need to do the following to generate the necessary reports
If you want to test it out, pop these two files in your mochareports folder and you should be able to send the slack message without needing to run cypress, or generate any reports 😃
https://github.com/YOU54F/cypress-slack-reporter/tree/master/src/slack/test/jsonTestPass
Hey buddy, thanks for using my plugin! woop woop!
Let’s see what we can sort.
Yeah Mocha 6 errors with mocha-multi-reporters, I have fixed it in a fork, and it is available here https://www.npmjs.com/package/cypress-multi-reporters
config.env.test
is actually used for the projects tests, and isn’t read by the npm module.The plugin reads
SLACK_WEBHOOK_URL
withprocess.env
hereYou need it available to the shell you are executing your program from.
if you run the command
export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/AAA/BBB/CCC
at the command line, and then runecho $SLACK_WEBHOOK_URL
it should return your incoming webhook. However we need to look at why we can’t find the report file(s).If you run it with
npx cypress-slack-reporter --logger
, it will output the directory we are trying to read the report file from.The report folder will need 2 things, a mochawesome html report, and a mochawesome json report. It uses the json report to ascertain the test results, and choose which message to send, and the html report is used when constructing the artefact URL’s from circleci.
Let me know how it goes!