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

Cypress should find Windows browsers in WSL2 #19687

Open
dantman opened this issue Jan 13, 2022 · 11 comments
Open

Cypress should find Windows browsers in WSL2 #19687

dantman opened this issue Jan 13, 2022 · 11 comments
Labels
E2E Issue related to end-to-end testing OS: WSL type: feature New feature that does not currently exist

Comments

@dantman
Copy link
Contributor

dantman commented Jan 13, 2022

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

@alehatsman
Copy link

alehatsman commented Aug 2, 2022

I tried next command

cypress open --browser /mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe

no luck so far

@alehatsman
Copy link

alehatsman commented Aug 3, 2022

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.

@alehatsman
Copy link

alehatsman commented Aug 3, 2022

I wonder what recognized means, but couldn't find in a few mins the code that is responsible for recognition.

@misaku
Copy link

misaku commented Aug 29, 2022

i have same problem, cypress cant open or recognized browser, i try to install in linux browser but not work too

@fuleinist
Copy link

https://nickymeuleman.netlify.app/blog/gui-on-wsl2-cypress

@kyfohatl
Copy link

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.

@misaku
Copy link

misaku commented Sep 27, 2022

in my case the real problem was version node, try to change.. can be resolve

@zero41120
Copy link

When you open cypress in WSL, the server load the Linux environment version of this code:

export function getVersionString (path: string) {
debugVerbose('finding version string using command "%s --version"', path)
return Bluebird.resolve(utils.getOutput(path, ['--version']))
.timeout(30000, `Timed out after 30 seconds getting browser version for ${path}`)
.then((val) => val.stdout)
.then((val) => val.trim())
.then((val) => {
debugVerbose('stdout for "%s --version": %s', path, val)
return val
})
}

However, when you link or use --browser with Window's chrome.exe, it just opens the browser.
In which, code for the Window environment:

export function getVersionString (path: string) {
// on Windows using "--version" seems to always start the full
// browser, no matter what one does.
try {
return Promise.resolve(winVersionInfo(path).FileVersion)
} catch (err) {
return Promise.reject(err)
}
}

@abulhawa
Copy link

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

@Sam-Ryan
Copy link

@abulhawa The answer i have been trawling for. Thank you.

@nagash77 nagash77 added type: feature New feature that does not currently exist E2E Issue related to end-to-end testing OS: WSL labels Jun 15, 2023
@matheuspellegrini
Copy link

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).

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

No branches or pull requests

10 participants