cypress-docker-images icon indicating copy to clipboard operation
cypress-docker-images copied to clipboard

Firefox - unable to run scripts in Firefox - cypress/browsers:node12.18.3-chrome89-ff86

Open varshanharshank opened this issue 3 years ago • 2 comments

Getting below error while running cypress scripts in firefox browser

Cypress version - 9.2.0

Docker image- Tried with below images

cypress/browsers:node12.18.3-chrome89-ff86 cypress/browsers:node14.17.0-chrome91-ff89

Note: It is working fine in chrome browser

ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory :ERROR:bus.cc(392)] Failed to connect to the bus: Address does not contain a colon Failed to connect to the bus: Address does not contain a colon ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is

image

image

varshanharshank avatar Jan 05 '22 18:01 varshanharshank

We found that this problem only happen for us when we run the container with a non-root user. Our solving steps were as follows:

First, we changed the container to run as root. This failed with firefox not being identified on the system. This is the problem reported on #85, but the problem is not running as root per se, actually firefox only blocks running as a user that does not own the $HOME path.

Second, we removed our $HOME var and passed the full firefox path to cypress (--browser /opt/firefox/firefox). This works, but all artifacts generated are now own by the root user.

Third, we added a script to run at the end of the test suite that chowns the artifacts back to the correct user.

Those steps are only necessary for Firefox due to it's security restriction.

Hope this helps everyone else that reaches a similar problem

Fryuni avatar Jan 06 '22 17:01 Fryuni

@Fryuni I just tried with --browser /opt/firefox/firefox but still facing same issue

varshanharshank avatar Jan 10 '22 15:01 varshanharshank

The error message output by Firefox 117 in a similar situation running on GitHub is:

"Running Firefox as root in a regular user's session is not supported. ($HOME is /github/home which is owned by uid 1001.)"

Advice to avoid this error is now included in the README.

Perhaps this issue could be closed now?

MikeMcC399 avatar Oct 18 '23 16:10 MikeMcC399