cypress
cypress copied to clipboard
Cypress will not run on restricted users on GUI-enabled environments
Current behavior:
When you run cypress run
in a GUI- enabled environment (e.g. Ubuntu Desktop) with an unprivileged user that can not open windows (e.g. a system user) the cypress cannot start up . It will give this error:
> cypress run
No protocol specified
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] test: `cypress run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Desired behavior:
Cypress should run nonetheless with system users on GUI-based environments in headless mode just like it does in none-GUI enabled environments.
Steps to reproduce: (app code and test code)
Create a system user. login to that user and run cypress run
on Ubuntu Desktop 16.04
Versions
3.1.5, Ubuntu Desktop 16.04
Additional Info
As I investigated the problem Cypress binary file tries to open a Cypress window in GUI mode but sometimes it is not allowed to do that. It should fallback to normal headless cli mode when it is not allowed.
Here is the last lines of the result of strace
called on Cypress
binary executable:
access("/home/miad/.Xauthority", R_OK) = -1 EACCES (Permission denied)
fcntl(19, F_GETFL) = 0x2 (flags O_RDWR)
fcntl(19, F_SETFL, O_RDWR|O_NONBLOCK) = 0
fcntl(19, F_SETFD, FD_CLOEXEC) = 0
poll([{fd=19, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=19, revents=POLLOUT}])
writev(19, [{"l\0\v\0\0\0\0\0\0\0\0\0", 12}, {"", 0}], 2) = 12
recvfrom(19, 0xe73445695b0, 8, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=19, events=POLLIN}], 1, -1) = 1 ([{fd=19, revents=POLLIN}])
recvfrom(19, "\0\26\v\0\0\0\6\0", 8, 0, NULL, NULL) = 8
recvfrom(19, "No protocol specified\n\0\0", 24, 0, NULL, NULL) = 24
write(2, "No protocol specified\n", 22No protocol specified
) = 22
shutdown(19, SHUT_RDWR) = 0
close(19) = 0
close(3) = 0
exit_group(1) = ?
+++ exited with 1 +++
which as you can see it has a permission problem
Hi,
I'm having the same issue. Do you have a workaround to run it until this bug gets fixed (other than giving access to X)?
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This is still an issue.
Though there is a simple workaround: unset DISPLAY
@progval this is still an issue on Ubuntu 20 and Cypress 12.12.0? Just want to verify and make sure before I try to reproduce the problem
I tested with Debian 11 and Cypress 12.9.0
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.