github-action: `dashboardUrl` not set in step outputs?
I just enabled recording on Cypress dashboard for my project, but am having trouble printing the dashboardUrl.
It prints at the end of a run (in the Cypress step itself), but when I try to print it in another step it’s blank
Cypress step:
(Run Finished)
Spec Tests Passing Failing Pending Skipped
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ ✔ smoke.test.ts 00:14 3 3 - - - │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
✔ All specs passed! 00:14 3 3 - - -
───────────────────────────────────────────────────────────────────────────────────────────────────────
Recorded Run: https://dashboard.cypress.io/projects/xxx/runs/7
Print step:
Cypress finished with: success
See results at
My configuration
name: Deploy
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:
build-deploy:
...
smoke-test:
needs: build-deploy
runs-on: ubuntu-latest
name: Smoke test
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v2
id: cypress
continue-on-error: true
with:
command-prefix: yarn dlx # need this bc using yarn pnp w/o node_modules
install-command: yarn install --immutable --immutable-cache
build: yarn build-custom
headless: true
config: baseUrl=https://env.com/
spec: cypress/integration/smoke.test.ts
record: true
env:
CYPRESS_PROJECT_ID: xxx
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print Dashboard URL
run: |
echo Cypress finished with: ${{ steps.cypress.outcome }}
echo See results at ${{ steps.cypress.outputs.dashboardUrl }}
Update: I also tried echo ${{ toJSON(steps.cypress.outputs) }} in my step and it just prints an empty object {}
Update 2: added missing configuration for command-prefix and custom install
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 28 (4 by maintainers)
@jazanne this may be a bug. We’ll have to look into it a bit more.
@MikeMcC399 yep the issue i’m seeing seems in line with the new docs you added https://github.com/cypress-io/github-action/pull/846 - url not set using custom
command.thanks for looking into this
I’m guessing that this would need to be an enhancement to Cypress in order to expose / export the Cypress Cloud URL.
Whilst the pull request is still in review mode you can read the suggestion under the link Outputs.@Erenndriel
You are right. It would not be possible to catch all cases, so it is not a good candidate at all for an enhancement request. Thanks again for your inputs and insight!
Appreciate your reply @MikeMcC399 !
I wholeheartedly agree with you that there are gaps in that regard and that a PR to improve such docs would be a time saver for many others who’d stumble upon this inconsistent behavior. That being said, the custom command can actually be any other command in
package.json, say a custom NodeJS script that runs numerous process, one of them beingcypressitself. With that in consideration, how can one consider--recordflag is the flag forcypressor for another thing that the developers intended to?E.g.:
package.jsonassume I havemyScript: "node scripts/generateFromTemplate.js".npm run myScript --record.--recordis parsed from the script and applied something completely different, not related tocypresss---recordflag.--recordflag from thecommand: npm run myScript --record, we are to assume/believe that the developer intended to set Cypress’--recordflag, which in this **case ** is not.I don’t think that it’d be the right direction to assume that
--recordis meant for Cypress when passed tocommandinput.@far11ven
You can also try this out for yourself if you have a fork of this repository. Follow the instructions in