简体   繁体   中英

How can I run my tests with older chrome version in cypress

Now my cypress version is 3.8.2 And when I am opening cypress window there are chrome version is 79. I want to run my tests in chrome 70 version. I updated my chrome in my computer and now it 70 version.

When I am running my test with selected command

npx vue-cli-service test:e2e --headless --browser chrome

Test is running in Chrome 79. How can I change my chrome version for running.

The --browser command supports launching any supported browser by specifying a path to the binary.

So in your case try: npx vue-cli-service test:e2e --headless --browser /usr/bin/chromium

where /usr/bin/chromium is the path for the binary of your needed version of Chrome.

As per the documentation , the default chrome location to be auto-detected by cypress is "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe". If the other version of chrome is installed in a different location, I guess the available options are to uninstall both 79 & 70 and clean install 70 first to the above said location and later installing 79 to a different location (OR) uninstall 79 (assuming it installed in default location) and re-install to a different location than the default, and finally set a symbolic link to version 70 on the default location something like (which requires admin previleges on the machine, though). This way cypress scans the default location and gets whichever version pointing to the symbolic link.

mklin "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "path to ver70 exe"

But before all, I think the command parameters appear to be slightly off, can you try instead (making sure the path is pointing to the verion 70, not the default one)

npx vue-cli-service test:e2e --headless --browser "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

I suspect --headless is default for a 'cypress run' command command, if your test:e2e is something like "cypress run", then you can simply omit it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM