问题
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.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/59752824/how-can-i-run-my-tests-with-older-chrome-version-in-cypress