Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Struggling to set up and run a basic Cypress Github Action because of Xvfb #601

Closed
Thebarda opened this issue Sep 27, 2022 · 6 comments
Closed

Comments

@Thebarda
Copy link
Contributor

Hello, dear Cypress maintainers,

I'm using Cypress 10.3.1 and I struggle to run use a basic implementation of Cypress Github Action

Here is my job configuration:

end-to-end:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v3
      - uses: actions/checkout@v3
      - uses: cypress-io/[email protected]
        with:
          browser: chrome
          install-command: npm ci --legacy-peer-deps

As you may see it's a very basic configuration, nothing fancy.

And it returns the following error and verifying cypress installation:

[command]/opt/hostedtoolcache/node/16.17.0/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 - 20.04)
| [FAILED] Cypress Version: 10.3.1
| 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 - 20.04)
| Cypress Version: 10.3.1

It tried with Ubuntu 22.04 as a runner, I tried to downgrade the action to 4.1.0 and nothing resolved the issue.

What did I do wrong?

@seanohue
Copy link

seanohue commented Oct 3, 2022

Not a Cypress maintainer but I came across this issue while searching for a solution to a related problem and I'm interested to see what you find out.

I ran into this same issue recently and ended up trying the advice here to use a Docker container with the necessary dependencies to run the tests in (see here). However, this still failed for me with an NPM 243 error.

Do you still see this error if you run the Action in a container such as one of these provided by Cypress?

@XavierLeTohic
Copy link

We fixed this issue by adding this step with recommend linux dependencies and setting DEBIAN_FRONTEND=noninteractive

      - name: Setup xvfb (Linux)
        if: runner.os == 'Linux'
        run: |
          sudo DEBIAN_FRONTEND=noninteractive apt-get update
          sudo DEBIAN_FRONTEND=noninteractive apt-get -y install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb

@MikeMcC399
Copy link
Collaborator

@Thebarda

Are you still having a problem with this or can this issue be closed?

Were you running on a self-hosted runner? I have not seen this problem on GitHub-hosted runners.

https://on.cypress.io/required-dependencies explains about installing missing dependencies.

@moshie
Copy link

moshie commented May 25, 2023

Yep this problem seems to happen for self-hosted runners you need to install the dependencies using apt as mentioned by @XavierLeTohic

@MikeMcC399
Copy link
Collaborator

@moshie

Yep this problem seems to happen for self-hosted runners you need to install the dependencies using apt as mentioned by

Thanks for the feedback!

I would tend to suggest to close this issue and for anyone impacted to subscribe to the main Cypress one (cypress-io/cypress#19868). Maybe the original submitter @Thebarda has some comment?

@Thebarda Thebarda closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2023
@moshie
Copy link

moshie commented May 25, 2023

Another solution is to use the cypress included container in your github action

container: 
      image: cypress/included:11.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants