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

Wayland support on Linux #20891

Open
switchyrascal opened this issue Apr 2, 2022 · 6 comments · May be fixed by #29366
Open

Wayland support on Linux #20891

switchyrascal opened this issue Apr 2, 2022 · 6 comments · May be fixed by #29366
Labels
type: feature New feature that does not currently exist

Comments

@switchyrascal
Copy link

switchyrascal commented Apr 2, 2022

What would you like?

It would be great to have Cypress run natively with Wayland (npx cypress open) instead of using xfvb/X11/Xwayland.

Why is this needed?

This is required for HiDPI monitors and fractional scaling on Linux machines. This is currently only supported with Wayland for Linux, and running Cypress with Xwayland leads to a very blurry experience on a 4K monitor.

Other

Here's a screenshot attempting to show the issue, top right is a FF window under Wayland which has crisper text, the other two Cypress windows are running under Xwayland and are blurry.
blurry

@davidmunechika davidmunechika added the type: feature New feature that does not currently exist label Apr 3, 2022
@rootsher
Copy link

rootsher commented Jan 9, 2023

After installing a new version of the system (Ubuntu), I debugged the problem of firing Cypress (white screen on very early cypress loading stage) for about two weeks. Starting from Docker networking issues, to a GPU hardware acceleration problem, to a Linux switch from X server to Wayland. I believe this issue will finally be resolved by the Cypress team. However, for those who have reached this place - the temporary solution is to disable Wayland. To do this, uncomment the line #WaylandEnable=false in the /etc/gdm3/custom.conf file and reboot the machine.

@t-moe
Copy link

t-moe commented Jan 18, 2023

Can you elaborate a bit what pieces are missing?
We have a custom build of chromium here, running with wayland on arm64. It would be nice if we could point cypress to use this browser.


I've tried to start it like this: cypress run --browser /usr/bin/chromium --headed --config-file ./cypress/config/test.config.ts.
I've patched the cli to skip the verify process. But now it seems to hang inside of /root/.cache/Cypress/10.7.0/Cypress/Cypress --no-sandbox -- --run-project /home/testuser --headed --browser /usr/bin/chromium. I suspect this is the electron starter app that doesn't work with Wayland yet.
Is there a way to skip the electron starter app and directly launch the browser in question?

@gammons
Copy link

gammons commented Mar 14, 2024

if it's chromium, using the --ozone-platform=wayland should do the trick. You can specify that as a flag, or put it into your ~/.config/chrome-flags.conf file.

@switchyrascal
Copy link
Author

switchyrascal commented Mar 14, 2024

When starting cypress, the initial testing-types-runner window also launches under Xwayland since it's an Electron app. So, if testing with Firefox, running xlsclients lists both 'Cypress' and 'firefox'; this is the problem that this issue is really about, since it should not be necessary to use Xwayland for any runner/browser combo at this point in time.

When cypress launches, it ends up spawning a binary and passes arguments to it, some of those arguments are for Electron. So the fix for this issue can be made with one line, which will stop both the runner and browser from launching under Xwayland, and maybe fix all browsers. In the lib/exec/spawn.js file, an addition of the --ozone-platform=wayland option to the Electron args seems to work. At around line 109, change this:

        const electronArgs = [];

To this:

        const electronArgs = ['--ozone-platform=wayland'];

With this change xlsclients does not list any Cypress process, and the browsers are also launched correctly under Wayland. Maybe this can probably be done with config files too, but I didn't look in to that.

Edit: changed where to add flag for simplicity.

@gammons
Copy link

gammons commented Mar 14, 2024

The right flag actually might be this: --ozone-platform-hint=auto 1 - that would probably account for folks using X and Wayland together. I'm honestly not sure why it isn't the default in chromium

Footnotes

  1. https://wiki.archlinux.org/title/wayland

@switchyrascal
Copy link
Author

I tested --ozone-platform-hint=auto with Cypress 13.7, i.e. added const electronArgs = ['--ozone-platform-hint=auto']; to lib/exec/spawn.js:109, and it works for the runner and browser as well, so is a likely a better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New feature that does not currently exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants