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

Docker containers doesnt contain firefox #862

Closed
lverner opened this issue Mar 20, 2023 · 8 comments
Closed

Docker containers doesnt contain firefox #862

lverner opened this issue Mar 20, 2023 · 8 comments
Assignees

Comments

@lverner
Copy link

lverner commented Mar 20, 2023

I run tests normally in the GitHub actions, and it is working for chrome/edge/electron. But not for firefox. Every time I try to run it with firefox I get:

Browser: firefox was not found on your system or is not supported by Cypress.

The snippet of workflow is like this:

on:
  push:
  workflow_dispatch:
  schedule:
    - cron: "0 9 * * 1-5"

env:
  SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

jobs:
  cypress_sanity_tests_firefox:
    runs-on: [gh_cyp_pool_qat]


    container:
      image: cypress/browsers:node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1

    steps:
      - uses: actions/checkout@v2
      - uses: cypress-io/github-action@v5
        with:
          build: npx cypress info
          browser: firefox
          config-file: cypress.config.js
          working-directory: cypress
          spec: path_to_tests/*.cy.js

      - uses: actions/upload-artifact@v3
        with:
          name: screenshots
          path: cypress/cypress/screenshots
        if: ${{ failure() }}

I even tried it locally with a different container on my machine and same results...
docker run -it -v $PWD:/e2e -w /e2e cypress/included:cypress-12.8.1-node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1 --spec path_to_tests/*.cy.js --browser firefox

The npx cypress info yields chrome/electron/edge but not firefox

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 21, 2023

I tried this on my machine, bizarrely I'm not seeing anything other than the built-in Electron browser. I ran this command on a fresh project:

Browsers do not get installed on an m1.

docker run -it -v $PWD:/e2e -w /e2e cypress/included:cypress-12.8.1-node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1 --spec cypress/e2e/spec.cy.js  --browser firefox

Output:

[409:0321/031952.588193:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
Can't run because you've entered an invalid browser name.

Browser: firefox was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome:canary
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - electron
Can't run because you've entered an invalid browser name.

Browser: firefox was not found on your system or is not supported by Cypress.

Cypress supports the following browsers:
 - electron
 - chrome
 - chromium
 - chrome:canary
 - edge
 - firefox

You can also use a custom browser: https://on.cypress.io/customize-browsers

Available browsers found on your system are:
 - electron

@lmiller1990
Copy link
Contributor

Yep, I reproduced on GH Actions like you did: https://github.com/lmiller1990/cypress-test-tiny/actions/runs/4475867744/jobs/7865680235

Looks like something isn't quite right on the image. We will look into it.

@mjhenkes
Copy link
Member

Not sure how to explain this. Firefox is installed on that image and passes in our tests on this repo and locally for me.

This command produces

docker run -it cypress/browsers:node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1 find . -name firefox
./opt/firefox
./opt/firefox/firefox
./usr/bin/firefox

Running this command locally also succeeded. When you ran the command locally, were you running it on arm architecture?

docker run -it -v $PWD:/e2e -w /e2e cypress/included:cypress-12.8.1-node-18.14.1-chrome-111.0.5563.64-1-ff-111.0-edge-111.0.1661.43-1 --browser firefox

@lverner
Copy link
Author

lverner commented Mar 21, 2023

Actually, I am working on M1 so the comment from @lmiller1990 makes sense it doesn't work locally.
But the bigger issue is the GitHub Workflow. When running the workflow from the #862 (comment) it still doesn't find the firefox.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 22, 2023

On GH Actions:

root@95351854f38f:/__w/cypress-test-tiny/cypress-test-tiny# npx cypress info
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[931:0322/034524.611322:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
Displaying Cypress info...

Detected 2 browsers installed:

1. Chrome
  - Name: chrome
  - Channel: stable
  - Version: 111.0.5563.64
  - Executable: google-chrome

2. Edge
  - Name: edge
  - Channel: stable
  - Version: 111.0.1661.43
  - Executable: edge

Note: to run these browsers, pass <name>:<channel> to the '--browser' field

Examples:
- cypress run --browser chrome
- cypress run --browser edge

Learn More: https://on.cypress.io/launching-browsers

Proxy Settings: none detected
Environment Variables:
CYPRESS_CACHE_FOLDER: /root/.cache/Cypress
CYPRESS_DEFAULT_NODE_VERSION: 18.14.1

Application Data: /github/home/.config/cypress/cy/development
Browser Profiles: /github/home/.config/cypress/cy/development/browsers
Binary Caches: /root/.cache/Cypress

Cypress Version: 12.8.0 (stable)
System Platform: linux (Debian - 11.6)
System Memory: 7.28 GB free 6.15 GB
root@95351854f38f:/__w/cypress-test-tiny/cypress-test-tiny# ls /opt/
firefox  google  microsoft  yarn-v1.22.19
root@95351854f38f:/__w/cypress-test-tiny/cypress-test-tiny#

Note the end:

root@95351854f38f:/__w/cypress-test-tiny/cypress-test-tiny# ls /opt/
firefox  google  microsoft  yarn-v1.22.19

Firefox is certainly there, but Cypress is not detecting it.

@lmiller1990
Copy link
Contributor

Hmm okay, it's a permissions issue.

root@95351854f38f:/__w/cypress-test-tiny/cypress-test-tiny# /opt/firefox/firefox --version
Running Firefox as root in a regular user's session is not supported.  ($HOME is /github/home which is owned by uid 1001.)

To answer the OP: the contain does contain Firefox, but it cannot be launched due to permissions.

@lmiller1990
Copy link
Contributor

lmiller1990 commented Mar 22, 2023

Okay, thanks to the PW folks: microsoft/playwright#6500

HOME=/ npx cypress info

It found Firefox now.

I did

HOME=/ npx cypress run --browser firefox

It run the test with Firefox! 🚀 🦊

@lverner
Copy link
Author

lverner commented Mar 22, 2023

Thank you for checking this! :)

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

No branches or pull requests

3 participants