[英]How can I run my e2e test scenario against a Django application with Angular.js frontend?
I want to do end to end test as described in the documentation Angular.js using a frontend based on angular-seed. 我想使用基于角度种子的前端按照文档Angular.js中的说明进行端到端测试。 The backend is written using django. 后端使用django编写。 When I try to use the jstestdriver (and the proxy option) I receive messages from jetty saying that GET requests to this URLs are not allowed. 当我尝试使用jstestdriver(和proxy选项)时,我收到码头的消息,说不允许对此URL进行GET请求。
How can I fix this? 我怎样才能解决这个问题? Are there other ways to run my tests in such a setup? 还有其他方法可以在这样的设置中运行测试吗?
Do I understand it correctly that it's just common Jasmine and the test driver is more or less just a server? 我是否正确理解它只是普通的茉莉花,而测试驱动程序或多或少只是一台服务器?
Karma is currently the supported test runner. Karma目前是受支持的测试运行程序。 Here's my testacular-e2e.conf.js
file. 这是我的testacular-e2e.conf.js
文件。
basePath = '../';
files = [
ANGULAR_SCENARIO,
ANGULAR_SCENARIO_ADAPTER,
'test/e2e/**/*.js'
];
autoWatch = false;
browsers = ['Chrome'];
singleRun = true;
proxies = {
'/': 'http://localhost:3000/'
};
junitReporter = {
outputFile: 'test_out/e2e.xml',
suite: 'e2e'
};
The important part is proxies
. 重要的是proxies
。 It configures testacular to use your server. 它配置testacular以使用您的服务器。 If I'm not mistaken, Django runs on port 8000 in development. 如果我没记错的话,Django在开发中的端口8000上运行。 So proxies
would look like this: 因此proxies
看起来像这样:
proxies = {
'/': 'http://127.0.0.1:8000/'
};
After installing testacular via npm and creating this config file, you can then start your back end server and run your e2e tests like so: 通过npm安装testacular并创建此配置文件之后,您可以启动后端服务器并按以下方式运行e2e测试:
$ testacular start config/testacular-e2e.conf.js
JsTestDriver似乎不再被维护,您也可以尝试使用PhantomJS运行测试,例如: https : //github.com/jcarver989/phantom-jasmine
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.