Frage

I need each browser that I'll be running my e2e tests on (chrome, safari, firefox) to each run the test suite through different proxies.

Is there a way I can do this in the karma.conf.js file?

At the moment I am able to run the test with the following command, specifying the browser and the proxy I want to use, but I need to be able to run all browsers at once.

karma start karma-e2e.conf.js --browsers=Chrome --proxies./=http://e2e-chrome.localhost.com:80/
War es hilfreich?

Lösung

I had to figure out a way to make sure that when each browser was tested, the data that it created in the database wasn't interacting with any of the other tests. I managed to do this by using a multitenancy system based off the subdomain. (browser-beind-tested.localhost.com)

To run all of the tests simultaneously with different browsers being specified, I simply wrote up a shell script to run 3 commands at once:

karma start karma-e2e.conf.js --browsers=Chrome --proxies./=http://e2e-chrome.localsite.com:80/ &
karma start karma-e2e.conf.js --browsers=Firefox --proxies./=http://e2e-firefox.localsite.com:80/ &
karma start karma-e2e.conf.js --browsers=Safari --proxies./=http://e2e-safari.localsite.com:80/

Then I simply run the command:

sh run-e2e-tests.sh

Note: This doesn't allow me to run continuous integration tests (yet), because every time I want the tests to run, I have to manually run the shell script from the command line

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top