简体   繁体   中英

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. The backend is written using 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.

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. Here's my testacular-e2e.conf.js file.

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 . It configures testacular to use your server. If I'm not mistaken, Django runs on port 8000 in development. So proxies would look like this:

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:

$ testacular start config/testacular-e2e.conf.js

JsTestDriver似乎不再被维护,您也可以尝试使用PhantomJS运行测试,例如: https : //github.com/jcarver989/phantom-jasmine

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM