cypress
cypress copied to clipboard
Cypress should find Windows browsers in WSL2
Current behavior
In WSL2 when you follow the installation instructions the resulting Cypress setup only runs the internal Electron browser. Even if it would've found all the browsers the user has installed if you ran it on the Windows host.
Desired behavior
When Cypress is run in WSL should detect all the browsers available in the Windows host. Windows' environment, filesystem, and the ability to run .exe files are all available from within WSL2 so Cypress should be fully capable of running the host Windows' browsers.
Test code to reproduce
n/a
Cypress Version
9.2.1
Other
No response
I tried next command
cypress open --browser /mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe
no luck so far
I have also tried to create a symlink:
sudo ln -s /mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe /usr/local/bin/google-chrome
Cypress opens the browser, but later says it is not recognized.
I wonder what recognized means, but couldn't find in a few mins the code that is responsible for recognition.
i have same problem, cypress cant open or recognized browser, i try to install in linux browser but not work too
https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress
https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress
That link just gives instructions on installing Cypress with WSL, which is required to get Cypress to open. Once you follow these steps then you run into the problem that dantman is describing, which is that only the Electron browser is available.
in my case the real problem was version node, try to change.. can be resolve
When you open cypress in WSL, the server load the Linux environment version of this code: https://github.com/cypress-io/cypress/blob/acc1050dd2659182fa87729be5ce9c3ca99de94b/packages/launcher/lib/linux/index.ts#L111-L123
However, when you link or use --browser
with Window's chrome.exe
, it just opens the browser.
In which, code for the Window environment:
https://github.com/cypress-io/cypress/blob/acc1050dd2659182fa87729be5ce9c3ca99de94b/packages/launcher/lib/windows/index.ts#L170-L179
I wanted to run cypress with chrome, and managed to do so by installing chrome in WSL2
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt -y install ./google-chrome-stable_current_amd64.deb
@abulhawa The answer i have been trawling for. Thank you.
I've faced this same issue and after a long research I've identified that my problem is related to webpack build, so I've tried to build(npm run build) and my webpack run out of memory(WSL), I've 32GB of RAM and this still happends, so I just run this export NODE_OPTIONS=--max_old_space_size=8192 and cypress work again, took me some months to discover this as cypress doesn't stop or show errors related to webpack build(just when succeed). Hope I can help you(I've never found that related solution).