cypress-io / github-action

GitHub Action for running Cypress end-to-end & component tests
https://on.cypress.io/guides/continuous-integration/github-actions
MIT License
1.35k stars 357 forks source link

Save Test Results to File or Action Output #1148

Open ChrisPage-AT opened 6 months ago

ChrisPage-AT commented 6 months ago

Would it be possible to have an option to save the test results to a file instead of posting a job summary? My use case is I am using the parallel: true flag to run across multiple runners and I want to combine the test results into one post per group: instead of each parallel run having their own. The easiest way I can think to accomplish this is to save what would normally put to the job summary into a file (json, csv, etc) and upload those as artifacts. Then I can have a job that waits for all the parallel jobs to complete, aggregates the results, and posts a single summary.

If that's not possible, I could create such a file myself if the various fields such as testResults.totalPassed were exposed as action outputs.

MikeMcC399 commented 6 months ago

@ChrisPage-AT

Are you using Cypress Cloud to view your results?

Most pages on Cypress Cloud Analytics allow download reports in CSV format. It's the small cloud symbol on the top right.

ChrisPage-AT commented 6 months ago

Ah, I see closed PR now. Do you know if this is something the Cypress.io team is interested in still? Those totalDuration, totalFailed, totalPassed, etc fields would help me do what I need to. The current Summary output works fine for parallel: false jobs just fine, but this would make the parallel: true jobs output much cleaner.

We do use Cypress Cloud to view the results, but not everyone has access or knows how to view the results. The $GITHUB_STEP_SUMMARY output in the test pipeline is useful for helping non-QA folks determine if they created a new test failure or if it's one that was already failing that day.

I can try and download the csv report via api call and display the information that way, but I figured just getting test output from the step would be easier since it already has that information.

jennifer-shehane commented 6 months ago

Having the simple stats report would be fine and this was the feedback in the PR - version, totalDuration, totalFailed, totalPassed, totalPending, totalSkipped, totalSuites and totalTests. We don't want the entirety of results or config printed since this could impact performance and also opens up opportunity to users to accidentally expose secrets within the GitHub output.

ChrisPage-AT commented 6 months ago

That would be perfectly fine since if anyone needs that much detail they can just look at the Cypress Cloud site. I'm just looking for whatever data variables you'd use for the GITHUB_STEP_SUMMARY to also be exported as outputs.

erezarnon commented 4 months ago

We'd also like the same thing. Our usecase is we want to grep the output to post to slack the exact test cases that failed. Is there any way to do that?

nrgbistro commented 2 weeks ago

+1 for this feature, I'm looking for a similar use case using parallel tests. IMO it would be cleaner and easier to read if these tables were all together in 1 summary instead of 5 different ones, since by default GitHub only shows the first 3 summaries: https://github.com/bahmutov/cypress-examples/actions/runs/10608410827