Sashika Wijesinghe
Sashika Wijesinghe

Reputation: 425

TestCafe - How to automatically run the generated remote connection URL on a remote browser

I'm new to TestCafe. I have a requirement to execute the TestCafe automated tests on Internet Explorer(IE) browser.

I'm using TestCafe Studio to record the tests and the TestCafe docker container will be used to run the tests within the pipeline. Since the docker container doesn't support test execution with IE browser. I tried out the "remote" option and got a remote connection URL generated.

Which I need to copy and paste in to the remote IE browser where I want to execute the tests. Is there any way that I can automatically triggers test execution with the generated remote connection URL without manually copy and paste the URL?

docker run --add-host=my.host:127.0.0.1  -p 1337:1337 -p 1338:1338 -v /Users/Documents/GIT/Projects/e2e_tests:/tests -it testcafe/testcafe --hostname my.host remote -q --skip-js-errors --assertion-timeout 20000 --selector-timeout 20000 '/tests/Tests/**/*.testcafe' 

Upvotes: 0

Views: 328

Answers (1)

wentwrong
wentwrong

Reputation: 711

You can write a script (using Batch/PowerShell, etc.) that starts the TestCafe container with a remote mode enabled and then navigates Internet Explorer to the connection URL, which is http://${HOSTNAME}:${PORT1}/browser/connect (where HOSTNAME and PORT1 are variables that were used to launch TestCafe). Check out this answer. It contains a bash script that implements this approach for the automation of test launch in the Safari browser using the remote mode.

Also note that TestCafe allows you to use browsers from cloud testing services. BrowserStack and Sauce Labs services provide Internet Explorer among many other browsers, so I assume it would be simpler to make your tests run in IE.

Upvotes: 2

Related Questions