Closed kumarpatel closed 5 years ago
Hi @kumarpatel,
sure that is possible and changing the hostname
property in chrome.js to host.docker.internal
is the first right step.
Additionally you will also have to change the assetsDir
property in chrome.js to process.env.MACOS_ASSETS_DIR
, so tests which make use of the assets directory don't fail.
Your chrome.js config file will look like this (not showing the unchanged properties):
exports.config = Object.assign({}, require('./hooks'), {
hostname: 'host.docker.internal',
// ...
assetsDir: process.env.MACOS_ASSETS_DIR,
// ...
})
Finally, you will have to download chromedriver and then start it with the following arguments:
./chromedriver --port=4444 --whitelisted-ips=
Make sure you download the correct chromedriver
version matching the version of your Chrome installation.
Then you can run the containerized WebdriverIO against your local desktop chrome:
docker-compose run --rm wdio
Please note that I do not recommend doing this, as the whole point of this project is to dockerize dependencies as much as possible, so it's easy to run tests on build servers.
Any reason why you prefer to run against desktop chrome versus the dockerized Linux version?
Awesome. Thanks. I shall give this is a try. mobile-chrome, mobile-safari, safari and chrome (on linux) are working extremely well.
Another question: android-emulator.sh script. Is the purpose of this script to run it on all avd's only once to upload android.host file? or is it to run it every single time to start the emulators before mobile-chrome tests are executed?
Any reason why you prefer to run against desktop chrome versus the dockerized Linux version?
My only reason to run it on Chrome for Mac is because I assume there are differences between Chrome for Mac vs Chrome for Linux vs Chrome for Windows. What do you think?
In general I think Chrome for Linux is on par with the Mac and Windows versions in regards to Website testing - the JS engine and HTML parser are the same. Also, many developers use Chrome for Mac as main testing device, so in my opinion there's no need to test Chrome for Mac/Windows specifically.
Technically you don't have to use the android-emulator.sh
script to start the Android emulators every time, but you do have to supply the -writable-system
argument (which is used by the script) every time, else the simulator will not use the overlay filesystem with the updated hostnames.
So in the end, I do recommend to use the script every time.
You above solution worked. Thanks again.
I've tried modifying
hostname: "chromedriver",
in chrome.js tohostname: "host.docker.internal",
Thoughts?