Skip to content

tests(deps): add node.js 22 (current) to tests (#1173) #2620

tests(deps): add node.js 22 (current) to tests (#1173)

tests(deps): add node.js 22 (current) to tests (#1173) #2620

Workflow file for this run

name: example-env
on:
push:
branches:
- 'master'
pull_request:
workflow_dispatch:
env:
# pass an environment variable to Cypress
# a test can get its value like this
# Cypress.env('environmentName') // 'staging'
# see https://on.cypress.io/env
CYPRESS_environmentName: staging
jobs:
e2e:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
# in the tests below, only the environment
# variable 'environmentName' will be set
- name: Cypress run with env
uses: ./
with:
working-directory: examples/env
spec: cypress/e2e/without-env.cy.js
with-env:
# in the tests below, in addition to 'environmentName'
# we are passing additional environment variables
# using "--env" command line option
# see https://on.cypress.io/configuration
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
with:
working-directory: examples/env
# additional env variables to pass to Cypress specs
# variables are automatically casted
# Cypress.env('host') // 'http://api.dev.local'
# Cypress.env('apiPort') // 4222
env: host=http://api.dev.local,apiPort=4222
spec: cypress/e2e/spec.cy.js
with-action-env:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
# GH Actions workflow syntax allows
# each step to add more environment variables
# via additional "env" blocks
env:
CYPRESS_apiPort: 4222
CYPRESS_host: http://api.dev.local
with:
working-directory: examples/env
spec: cypress/e2e/spec.cy.js
combined-env:
# combination of all 3 ways to pass environment variables
# 'environmentName' value comes from the workflow's environment
# 'apiPort' comes from the step's "env" block
# 'host' is defined in the action's "with: env:" parameter
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress run with env
uses: ./
env:
CYPRESS_apiPort: 4222
with:
env: host=http://api.dev.local
working-directory: examples/env
spec: cypress/e2e/spec.cy.js