1

我正在尝试使用 testacular 在我的 AngularJs 项目上进行 e2e 测试。我成功启动了一个基于 node.js 的 Web 服务器,我可以看到加载 url 时文件是如何发送的,即使我可以在浏览器上看到视觉结果,但 Testacular 测试不起作用。我收到此错误:

[2013-04-04 00:31:00.499] [WARN] config - "/" is proxied, you should probably change urlRoot to avoid conflicts
INFO [testacular]: Testacular server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser Firefox
INFO [Chrome 26.0 (Mac)]: Connected on socket id EN7sZuseiLuwlddbBkqn
INFO [Firefox 13.0 (Mac)]: Connected on socket id lBTUcn8b75p5O_cPBkqo
Chrome 26.0 (Mac): Executed 0 of 3
Chrome 26.0 (Mac): Executed 0 of 3 DISCONNECTED (0.413 secs / 0 secs)
Firefox 13.0 (Mac): Executed 0 of 3 DISCONNECTED (0.31 secs / 0 secs)
WARN [Chrome 26.0 (Mac)]: Disconnected

这是我的睾丸配置文件:

basePath = '../';

files = [
  ANGULAR_SCENARIO,
  ANGULAR_SCENARIO_ADAPTER,
  'test/e2e/**/*.js'
];

autoWatch = true;
browsers = ['Chrome', 'Firefox'];
singleRun = false;

proxies = {
  '/': 'http://localhost:8000/'
};

junitReporter = {
  outputFile: 'test_out/e2e.xml',
  suite: 'e2e'
};

知道我在做什么吗?

4

1 回答 1

1

我遇到了类似的问题。我正在使用 index.html 异步风格,事实证明您还需要ng-app放入document.body.

angular.bootstrap(document, ['app']);

document.body.className = document.body.className + ' ng-app';

参考:https ://github.com/karma-runner/karma/issues/422

于 2013-05-04T23:14:15.377 回答