dimanche 7 juin 2020

How to run testcafe tests on mobile chrome using selenium hub

I am trying to run testcafe on selenium hub.

My commands:

docker network create network

docker run -d -p 4444:4444 --net network --name selenium-hub selenium/hub

docker run -d -e HUB_PORT_4444_TCP_ADDR=selenium-hub -e HUB_PORT_4444_TCP_PORT=4444 --shm-size=2gb -v /dev/shm:/dev/shm --network network --name chrome selenium/node-chrome

docker run -d -e HUB_PORT_4444_TCP_ADDR=selenium-hub -e HUB_PORT_4444_TCP_PORT=4444 -p 6080:6080 -p 5554:5554 -p 5555:5555 -e DEVICE="Samsung Galaxy S6" --shm-size=2gb -v /dev/shm:/dev/shm -e CONNECT_TO_GRID=true -e APPIUM=true --network network --name chrome-mobile -e SELENIUM_HOST=selenium-hub -e MOBILE_WEB_TEST=true -e APPIUM_PORT=4723 butomo1989/docker-android-arm-7.1.1

I am using this package to connect to hub: testcafe-browser-provider-selenium - https://www.npmjs.com/package/testcafe-browser-provider-selenium

I can see both configurations at http://localhost:4444/grid/console enter image description here

I can run tests on linux chrome using:

testcafe selenium:chrome:Linux my_first_test.js

But i am not able to run tests on android chrome:

[my_first_project (master)]$ testcafe selenium:chrome:Android my_first_test.js 
Using locally installed version of TestCafe.
The "src", "browsers" options from the configuration file will be ignored.
ERROR Was unable to open the browser "selenium:chrome:Android" due to error.

SessionNotCreatedError: A new session could not be created. Details: The desiredCapabilities object was not valid for the following reason(s): 'deviceName' can't be blank
    at Object.checkLegacyResponse (/Users/abc/node_modules/selenium-webdriver/lib/error.js:585:15)

Please help me to resolve this issue. My end goal is to be able to run chrome on mobile browsers in CI and don't want to use cloud browsers like browserstack. I am open to other ideas if android image won't work.

Aucun commentaire:

Enregistrer un commentaire