cypress-io / github-action

GitHub Action for running Cypress end-to-end & component tests
https://on.cypress.io/guides/continuous-integration/github-actions
MIT License
1.35k stars 357 forks source link

Cypress in Github Actions won't feed env variables to Oxygen server #1186

Closed belazaras closed 3 months ago

belazaras commented 3 months ago

Current behavior

image

That workflow file, tried several different places where to place the env: section, nothing works. If I run the Oxygen server directly with npm run dev it seems to work. But not through the cypress action, or manually running cypress with an npm command.

Desired behavior

feed the variables to the Oxygen server, I tried a new project with an Express server and it worked.

Test code to reproduce

Full workflow file:

name: Testing
on:
- push
permissions:
  contents: read
  deployments: write
jobs:
  test:
    name: Cypress Testing
    timeout-minutes: 30
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Setup node.js
      uses: actions/setup-node@v4
      with:
        node-version: lts/*
        check-latest: true
    - name: Get yarn cache directory
      id: yarn-cache-dir-path
      run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
    - uses: actions/cache@v3
      with:
        path: "${{ steps.yarn-cache-dir-path.outputs.dir }}"
        key: "${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}"
        restore-keys: "${{ runner.os }}-yarn-\n"
    - name: Install dependencies
      id: install-dependencies
      run: yarn
    - name: Cypress run
      uses: cypress-io/github-action@v6
      with:
        start: npm run dev
        wait-on: "http://localhost:3000"
        wait-on-timeout: 120
        browser: chrome
        record: true
      env:
        CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
        SESSION_SECRET: ${{ secrets.CYPRESS_SESSION_SECRET }}
        PUBLIC_STOREFRONT_API_TOKEN: ${{ secrets.CYPRESS_PUBLIC_STOREFRONT_API_TOKEN }}
        PUBLIC_STORE_DOMAIN: ${{ secrets.CYPRESS_PUBLIC_STORE_DOMAIN }}
        PUBLIC_STOREFRONT_ID: ${{ secrets.CYPRESS_PUBLIC_STOREFRONT_ID }}
        PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID: ${{ secrets.CYPRESS_PUBLIC_CUSTOMER_ACCOUNT_API_CLIENT_ID }}
        PUBLIC_CUSTOMER_ACCOUNT_API_URL: ${{ secrets.CYPRESS_PUBLIC_CUSTOMER_ACCOUNT_API_URL }}
        RESEND_API_KEY: ${{ secrets.CYPRESS_RESEND_API_KEY }}
        CAPTCHA_SECRET_KEY: ${{ secrets.CYPRESS_CAPTCHA_SECRET_KEY }}
        PUBLIC_CHECKOUT_DOMAIN: ${{ secrets.CYPRESS_PUBLIC_CHECKOUT_DOMAIN }}
        SHOPIFY_API_VERSION: ${{ secrets.CYPRESS_SHOPIFY_API_VERSION }}`

Cypress Version

13.9.0

Node version

20.11.1

Operating System

ubuntu

Debug Logs

No response

Other

No response

MikeMcC399 commented 3 months ago

@belazaras

Please generate debug logs according to the README > Debugging instructions.

MikeMcC399 commented 3 months ago

@belazaras

Did you make any progress on debugging your issue?

belazaras commented 3 months ago

Hi there @MikeMcC399, not yet, i'm dedicating less time to this issue as already wasted too much

MikeMcC399 commented 3 months ago

@belazaras

If you don't want to continue with this issue, you can close it.

At this time It does not look like it would be a bug in the action. You can also request help from the Cypress technical community where you may find other users of Cypress with Oxygen.

Discord chat (click on button)