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

feat: add test results output #949

Closed

Conversation

mihaisee
Copy link

@mihaisee mihaisee commented Jun 21, 2023

Added a testResults output that contains a strigified JSON object with the test results.

Object structure

Usage

...
  steps:
    - name: Parse results
      uses: actions/github-script@v6
      with:
        script: |
          const testResults = JSON.parse('${{ steps.cypress-run.outputs.testResults }}')
          console.log(testResults.totalPassed)
          ...

@cypress-app-bot
Copy link

@mihaisee
Copy link
Author

resolves #810

.gitignore Outdated Show resolved Hide resolved
@mike-plummer mike-plummer self-assigned this Jun 23, 2023
- remove .idea excluded directory
@CLAassistant
Copy link

CLAassistant commented Jun 26, 2023

CLA assistant check
All committers have signed the CLA.

@Dale-777
Copy link

Dale-777 commented Jul 7, 2023

please can this be approved

@Dale-777
Copy link

Dale-777 commented Aug 1, 2023

@mihaisee can you add me as a reviewer? seems this is stuck now for some time, I would like to make use of these changes.

1 similar comment
@Dale-777
Copy link

Dale-777 commented Aug 1, 2023

@mihaisee can you add me as a reviewer? seems this is stuck now for some time, I would like to make use of these changes.

@mihaisee
Copy link
Author

mihaisee commented Aug 1, 2023

@mihaisee can you add me as a reviewer? seems this is stuck now for some time, I would like to make use of these changes.

@Dale-777 sorry, but I can't add/remove reviewers

@novirael
Copy link

Looking forward to see that change approved!

@JenoDK
Copy link

JenoDK commented Sep 29, 2023

Would love to see this as well +1, my use case is using these results in a different step to send an e-mail and ms teams message.

@emmanuelnk
Copy link

Any progress on getting this reviewed?

@MikeMcC399

This comment was marked as outdated.

index.js Outdated Show resolved Hide resolved
@jennifer-shehane jennifer-shehane removed the request for review from nagash77 October 4, 2023 18:21
README.md Outdated Show resolved Hide resolved
mihaisee and others added 3 commits October 12, 2023 08:31
Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
Co-authored-by: Mike McCready <66998419+MikeMcC399@users.noreply.github.com>
action.yml Outdated
@@ -96,6 +96,8 @@ outputs:
description: 'Cypress Cloud URL if the run was recorded (deprecated)'
resultsUrl:
description: 'Cypress Cloud URL if the run was recorded'
testResults:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this some more, we should probably name this runResults.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mschile

The documentation currently uses the term "test results"
https://docs.cypress.io/guides/guides/module-api#Results

image

so if the term is changed here, it should be changed in the Module API documentation as well.

action.yml Outdated Show resolved Hide resolved
@emmanuelnk
Copy link

emmanuelnk commented Oct 17, 2023

Can I provide any help to get this moving @mihaisee ?
@mschile @MikeMcC399 any conclusion on the runResults vs testResults ?

@MikeMcC399
Copy link
Collaborator

MikeMcC399 commented Oct 23, 2023

@mschile

You need to sign the CLA

@@ -816,6 +816,8 @@ const runTests = async () => {
debug(`Cypress options ${JSON.stringify(cypressOptions)}`)

const onTestsFinished = (testResults) => {
core.setOutput('runResults', testResults)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with the team. For simplicity, we would like to scope the exposed runResults stringified object to version, totalDuration, totalFailed, totalPassed, totalPending, totalSkipped, totalSuites and totalTests. The results object can get quite large depending on the size of your test suite and if more information is needed, it can be parsed and save in the afterRun hook.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emilyrohrbough can logging the entire results object be an optional input parameter instead? e.g.

output-entire-results-object: true 

This way, by default, a summary is output but still leaves us the option to get the entire object. This way one does not need to go in and change all the test files to log an object (only needs a version update and addition of a parameter)
CC @mihaisee

@jennifer-shehane
Copy link
Member

Hi @mihaisee, will you have time to make the updates asked as Emily outlined above?

@MikeMcC399 MikeMcC399 added the type: enhancement New feature or request label Nov 4, 2023
@jennifer-shehane
Copy link
Member

@mihaisee Just checking in again with the status of this PR

@jennifer-shehane jennifer-shehane removed their request for review December 19, 2023 14:17
@MikeMcC399 MikeMcC399 removed the request for review from davidr-cy December 21, 2023 15:16
@jennifer-shehane
Copy link
Member

Closing as stale. Please open a new PR if the work can be pulled out to the smaller results output requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Output summary results