[GH-ISSUE #1887] Docker image w/ Cypress Support #915

Open
opened 2026-03-01 21:47:23 +03:00 by kerem · 1 comment
Owner

Originally created by @RobertGemmaJr on GitHub (Jun 26, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1887

Act version

0.2.46

Feature description

Attempting to run an workflow with Cypress testing and I am unable to run them locally.

The workflow

name: 🧪 Test
on: pull_request

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  actions: write
  contents: read

env:
  REACT_APP_NODE_ENV: "test"

# ... other jobs


  integration_tests:
    name: ⚫️ Cypress
    runs-on: ubuntu-latest

    env:
      FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache
      FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} # Organization secret
      SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_XMA_PORTAL }}
      DATABASE_URL: ${{ secrets.DATABASE_URL }}
      SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
    steps:
      - name: ⬇️ Checkout repo
        uses: actions/checkout@v3

      - name: ⎔ Setup node
        uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: npm
          cache-dependency-path: ./package.json

      - name: 📥 Install Dependencies
        run: npm install

      - name: Cache firebase emulators
        uses: actions/cache@v2
        with:
          path: ${{ env.FIREBASE_EMULATORS_PATH }}
          key: ${{ runner.os }}-firebase-emulators-${{
            hashFiles('emulator-cache/**') }}
        continue-on-error: true

      - name: 🐳 Docker compose
        run: docker compose up -d && sleep 10 # Sleep gives time for postgres to start

      - name: 🛠 Setup Database
        run: npx prisma migrate reset --force

      - name: 🌳 Cypress run (Chrome)
        uses: cypress-io/github-action@v5
        with:
          browser: chrome
          build: npm run build
          start: npm run start:mocks
          wait-on: "http://localhost:8811"
          wait-on-timeout: 120
          command: npm run test:e2e:run
        env:
          PORT: "8811"

fails on running act -j integration_tests with --secret-file env/.secrets --env-file env/.env.production in my .actrc file.

The step - name: 🌳 Cypress run (Chrome) fails with the following error:

| [command]/opt/hostedtoolcache/node/18.16.1/x64/bin/npx cypress verify
| 
| [STARTED] Task without title.
| [FAILED] Your system is missing the dependency: Xvfb
| [FAILED] 
| [FAILED] Install Xvfb and run Cypress again.
| [FAILED] 
| [FAILED] Read our documentation on dependencies for more information:
| [FAILED] 
| [FAILED] https://on.cypress.io/required-dependencies
| [FAILED] 
| [FAILED] If you are using Docker, we provide containers with all required dependencies installed.
| [FAILED] 
| [FAILED] ----------
| [FAILED] 
| [FAILED] Error: spawn Xvfb ENOENT
| [FAILED] 
| [FAILED] ----------
| [FAILED] 
| [FAILED] Platform: linux-x64 (Ubuntu - 22.04)
| [FAILED] Cypress Version: 12.16.0
| Your system is missing the dependency: Xvfb
| 
| Install Xvfb and run Cypress again.
| 
| Read our documentation on dependencies for more information:
| 
| https://on.cypress.io/required-dependencies
| 
| If you are using Docker, we provide containers with all required dependencies installed.
| 
| ----------
| 
| Error: spawn Xvfb ENOENT
| 
| ----------
| 
| Platform: linux-x64 (Ubuntu - 22.04)
| Cypress Version: 12.16.0
[🧪 Test/⚫️ Cypress       ]   ❗  ::error::The process '/opt/hostedtoolcache/node/18.16.1/x64/bin/npx' failed with exit code 1
[🧪 Test/⚫️ Cypress       ]   ❌  Failure - Main 🌳 Cypress run (Chrome)
[🧪 Test/⚫️ Cypress       ]   ⚙  ::set-env:: CI=1
[🧪 Test/⚫️ Cypress       ]   ⚙  ::set-env:: CYPRESS_CACHE_FOLDER=/root/.cache/Cypress
[🧪 Test/⚫️ Cypress       ]   ⚙  ::set-env:: npm_config_cache=/root/.npm
[🧪 Test/⚫️ Cypress       ] exitcode '1': failure
[🧪 Test/⚫️ Cypress       ] 🏁  Job failed
Error: Job '⚫️ Cypress' failed

Cypress has a bunch of docker images to choose from. Is it possible to add these as images to base the project over?

I'm not getting the error in GitHub, only locally, which is why I suspect the error is coming from the act instance

Originally created by @RobertGemmaJr on GitHub (Jun 26, 2023). Original GitHub issue: https://github.com/nektos/act/issues/1887 ### Act version 0.2.46 ### Feature description Attempting to run an workflow with Cypress testing and I am unable to run them locally. The workflow ```yml name: 🧪 Test on: pull_request concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: actions: write contents: read env: REACT_APP_NODE_ENV: "test" # ... other jobs integration_tests: name: ⚫️ Cypress runs-on: ubuntu-latest env: FIREBASE_EMULATORS_PATH: ${{ github.workspace }}/emulator-cache FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} # Organization secret SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_XMA_PORTAL }} DATABASE_URL: ${{ secrets.DATABASE_URL }} SESSION_SECRET: ${{ secrets.SESSION_SECRET }} steps: - name: ⬇️ Checkout repo uses: actions/checkout@v3 - name: ⎔ Setup node uses: actions/setup-node@v3 with: node-version: 18 cache: npm cache-dependency-path: ./package.json - name: 📥 Install Dependencies run: npm install - name: Cache firebase emulators uses: actions/cache@v2 with: path: ${{ env.FIREBASE_EMULATORS_PATH }} key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('emulator-cache/**') }} continue-on-error: true - name: 🐳 Docker compose run: docker compose up -d && sleep 10 # Sleep gives time for postgres to start - name: 🛠 Setup Database run: npx prisma migrate reset --force - name: 🌳 Cypress run (Chrome) uses: cypress-io/github-action@v5 with: browser: chrome build: npm run build start: npm run start:mocks wait-on: "http://localhost:8811" wait-on-timeout: 120 command: npm run test:e2e:run env: PORT: "8811" ``` fails on running `act -j integration_tests` with `--secret-file env/.secrets --env-file env/.env.production` in my .actrc file. The step ` - name: 🌳 Cypress run (Chrome)` fails with the following error: ```sh | [command]/opt/hostedtoolcache/node/18.16.1/x64/bin/npx cypress verify | | [STARTED] Task without title. | [FAILED] Your system is missing the dependency: Xvfb | [FAILED] | [FAILED] Install Xvfb and run Cypress again. | [FAILED] | [FAILED] Read our documentation on dependencies for more information: | [FAILED] | [FAILED] https://on.cypress.io/required-dependencies | [FAILED] | [FAILED] If you are using Docker, we provide containers with all required dependencies installed. | [FAILED] | [FAILED] ---------- | [FAILED] | [FAILED] Error: spawn Xvfb ENOENT | [FAILED] | [FAILED] ---------- | [FAILED] | [FAILED] Platform: linux-x64 (Ubuntu - 22.04) | [FAILED] Cypress Version: 12.16.0 | Your system is missing the dependency: Xvfb | | Install Xvfb and run Cypress again. | | Read our documentation on dependencies for more information: | | https://on.cypress.io/required-dependencies | | If you are using Docker, we provide containers with all required dependencies installed. | | ---------- | | Error: spawn Xvfb ENOENT | | ---------- | | Platform: linux-x64 (Ubuntu - 22.04) | Cypress Version: 12.16.0 [🧪 Test/⚫️ Cypress ] ❗ ::error::The process '/opt/hostedtoolcache/node/18.16.1/x64/bin/npx' failed with exit code 1 [🧪 Test/⚫️ Cypress ] ❌ Failure - Main 🌳 Cypress run (Chrome) [🧪 Test/⚫️ Cypress ] ⚙ ::set-env:: CI=1 [🧪 Test/⚫️ Cypress ] ⚙ ::set-env:: CYPRESS_CACHE_FOLDER=/root/.cache/Cypress [🧪 Test/⚫️ Cypress ] ⚙ ::set-env:: npm_config_cache=/root/.npm [🧪 Test/⚫️ Cypress ] exitcode '1': failure [🧪 Test/⚫️ Cypress ] 🏁 Job failed Error: Job '⚫️ Cypress' failed ``` Cypress has a bunch of [docker images](https://github.com/cypress-io/cypress-docker-images) to choose from. Is it possible to add these as images to base the project over? I'm not getting the error in GitHub, only locally, which is why I suspect the error is coming from the act instance
Author
Owner

@GuessWhoSamFoo commented on GitHub (Jun 27, 2023):

Are you using the default image? Try using a more fully featured one via act -P <platform>=<docker-image>. It'll represent the Github runner better and might have Xvfb installed

<!-- gh-comment-id:1609827489 --> @GuessWhoSamFoo commented on GitHub (Jun 27, 2023): Are you using the default image? Try using a more fully featured one via `act -P <platform>=<docker-image>`. It'll represent the Github runner better and might have `Xvfb` installed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#915
No description provided.