2

我需要每个将在(chrome、safari、firefox)上运行我的 e2e 测试的浏览器来通过不同的代理运行测试套件。

有没有办法在 karma.conf.js 文件中做到这一点?

目前我可以使用以下命令运行测试,指定浏览器和我想使用的代理,但我需要能够一次运行所有浏览器。

karma start karma-e2e.conf.js --browsers=Chrome --proxies./=http://e2e-chrome.localhost.com:80/
4

1 回答 1

3

我必须想办法确保在测试每个浏览器时,它在数据库中创建的数据不会与任何其他测试交互。我设法通过使用基于子域的多租户系统来做到这一点。(browser-beind-tested.localhost.com)

为了在指定不同浏览器的情况下同时运行所有测试,我简单地编写了一个 shell 脚本来一次运行 3 个命令:

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/

然后我只需运行命令:

sh run-e2e-tests.sh

注意这不允许我运行持续集成测试(还),因为每次我想要运行测试时,我都必须从命令行手动运行 shell 脚本

于 2013-09-12T00:06:47.167 回答