test: restrict example/env to Cypress <15.10 - #1888
Conversation
|
8047f00 to
3962636
Compare
Co-authored-by: Jennifer Shehane <[email protected]>
jennifer-shehane
left a comment
There was a problem hiding this comment.
Thanks for surfacing all this @MikeMcC399, the approach makes sense to me. A few things:
example-env.ymlstill showsCypress.env()in the inline comments which reads oddly right under the new header.action.ymlline 30 still says "Sets Cypress environment variables", worth matching the new README framing, like expose does.
With cypress pinned at 15.21.1, all four jobs now run only the placeholder. Should we pin this example below 15.10 so it actually exercises the legacy path?
I assume that you're just commenting without requesting a change
I would address that separately, because that affects the action, not the example of using the action. Also the documentation history on https://docs.cypress.io/app/references/module-api would need extending as it does not describe the history of repurposing the Module API
Pinning the example to a non-standard version would be messy. Renovate would try to update it, unless an exception were put in place, and Dependabot would regularly complain about vulnerabilities that are already resolved. I would not want to do that. I did test it on the old versions. |
PREREQUISITE FOR CYPRESS 16 UPGRADE
Situation
The example directory examples/env uses the Cypress.env() API call to get environment variables in tests. These are non-secret environment variables. The related workflow example-env.yml refers to this usage in comments.
In [email protected]
Cypress.env()was deprecatedallowCypressEnvwas introduced for the remaining lifetime of Cypress 15.x to enable explicitly disallowingCypress.env()cy.env()was added for sensitive configuration informationenvcorresponding to the action parameterenvis now specified for use with secret environment variablesCypress.expose()was added for non-sensitive configuration informationIn cypress-io/[email protected]
exposeparameter was added to be able to pass this to the Cypress Module APICypress.expose()In [email protected]
Cypress.env()was removedallowCypressEnvwas removedAssessment
The
envexamples are still relevant for action users that have not upgraded to minimum Cypress 15.10. They are however incompatible with Cypress 16 and block upgrading the repo.envcontinues to be available for GitHub Actions workflows for both secret and non-secret variables. Preserving various examples usingenvis therefore helpful for understanding how to use variables.Change
Skip the tests in examples/env for Cypress >=15.10.0
Update code inline comments and documentation accordingly.
Verification
Confirm that each test is successful.
Note
Low Risk
Changes are limited to example tests, lockfile, and documentation; no production action behavior is modified.
Overview
Prepares the repo for a Cypress 16 upgrade by keeping the legacy
examples/envworkflow and docs while stoppingCypress.env()assertions from running on Cypress 15.10.0+ (where that API is deprecated/removed).The e2e specs in
spec.cy.jsandwithout-env.cy.jsnow usesemverto run the original env checks only on older Cypress versions; on ≥15.10.0 they register a no-op test so CI still passes.example-env.ymland the README Env section are updated with migration notes and a pointer toexample-expose.yml/ theexposeaction input for non-sensitive config on modern Cypress.Reviewed by Cursor Bugbot for commit 3c0051f. Bugbot is set up for automated code reviews on this repo. Configure here.