Skip to content

Commit

Permalink
feat: replace dashboardUrl by resultsUrl (#916)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcC399 committed May 22, 2023
1 parent 98de7b8 commit 1911878
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/example-recording.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
- name: Print Cypress Cloud URL
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }} # note: dashboardUrl is now deprecated
group-v9:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
- name: Print Cypress Cloud URL
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
group:
runs-on: ubuntu-22.04
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,9 @@ If you add `workflow_dispatch` event to your workflow, you will be able to start
### Outputs
This action sets a GitHub step output `dashboardUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/cloud-introduction) using the action parameter setting `record: true` (see [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud)). Note that using a [Custom test command](#custom-test-command) with the `command` parameter overrides the `record` parameter and in this case no `dashboardUrl` step output is saved.
This action sets a GitHub step output `resultsUrl` if the run was recorded on [Cypress Cloud](https://on.cypress.io/cloud-introduction) using the action parameter setting `record: true` (see [Record test results on Cypress Cloud](#record-test-results-on-cypress-cloud)). Note that using a [Custom test command](#custom-test-command) with the `command` parameter overrides the `record` parameter and in this case no `resultsUrl` step output is saved.
This is an example of using the step output `dashboardUrl`:
This is an example of using the step output `resultsUrl`:
```yml
- name: Cypress tests
Expand All @@ -1379,9 +1379,11 @@ This is an example of using the step output `dashboardUrl`:
- name: Print Cypress Cloud URL
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
echo See results at ${{ steps.cypress.outputs.resultsUrl }}
```

The GitHub step output `dashboardUrl` is deprecated. Cypress Dashboard is now [Cypress Cloud](https://on.cypress.io/cloud-introduction).

[![recording example](https://github.com/cypress-io/github-action/workflows/example-recording/badge.svg?branch=master)](.github/workflows/example-recording.yml)

**Note:** every GitHub workflow step can have `outcome` and `conclusion` properties. See the GitHub [Contexts](https://docs.github.com/en/actions/learn-github-actions/contexts) documentation section [steps context](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#steps-context). In particular, the `outcome` or `conclusion` value can be `success`, `failure`, `cancelled`, or `skipped` which you can use in any following steps.
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ inputs:
default: false
outputs:
dashboardUrl:
description: 'Cypress Dashboard URL if the run was recorded'
description: 'Cypress Cloud URL if the run was recorded (deprecated)'
resultsUrl:
description: 'Cypress Cloud URL if the run was recorded'
runs:
using: 'node16'
main: 'dist/index.js'
Expand Down
11 changes: 6 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75091,7 +75091,7 @@ const runTests = async () => {
debug(`Cypress options ${JSON.stringify(cypressOptions)}`)

const onTestsFinished = (testResults) => {
const dashboardUrl = testResults.runUrl
const resultsUrl = testResults.runUrl
process.chdir(startWorkingDirectory)

if (testResults.failures) {
Expand All @@ -75112,14 +75112,15 @@ const runTests = async () => {

debug(`Cypress tests: ${testResults.totalFailed} failed`)

if (dashboardUrl) {
debug(`Dashboard url ${dashboardUrl}`)
if (resultsUrl) {
debug(`resultsUrl ${resultsUrl}`)
} else {
debug('There is no Dashboard url')
debug('There is no resultsUrl')
}

// we still set the output explicitly
core.setOutput('dashboardUrl', dashboardUrl)
core.setOutput('dashboardUrl', resultsUrl) // deprecated and retained for backward compatibility
core.setOutput('resultsUrl', resultsUrl) // replacement for dashboardUrl

if (testResults.totalFailed) {
return Promise.reject(
Expand Down
11 changes: 6 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ const runTests = async () => {
debug(`Cypress options ${JSON.stringify(cypressOptions)}`)

const onTestsFinished = (testResults) => {
const dashboardUrl = testResults.runUrl
const resultsUrl = testResults.runUrl
process.chdir(startWorkingDirectory)

if (testResults.failures) {
Expand All @@ -761,14 +761,15 @@ const runTests = async () => {

debug(`Cypress tests: ${testResults.totalFailed} failed`)

if (dashboardUrl) {
debug(`Dashboard url ${dashboardUrl}`)
if (resultsUrl) {
debug(`resultsUrl ${resultsUrl}`)
} else {
debug('There is no Dashboard url')
debug('There is no resultsUrl')
}

// we still set the output explicitly
core.setOutput('dashboardUrl', dashboardUrl)
core.setOutput('dashboardUrl', resultsUrl) // deprecated and retained for backward compatibility
core.setOutput('resultsUrl', resultsUrl) // replacement for dashboardUrl

if (testResults.totalFailed) {
return Promise.reject(
Expand Down

0 comments on commit 1911878

Please sign in to comment.