我抓取了Angular Seed项目并修改了它的场景测试。我在做一个非常简单的测试,所以我相信我遗漏了什么。以下是DSL和场景规范:
angular.scenario.dsl('customDsl', function() {
return function(selector) {
return this.addFutureAction('customDsl', function ($window, $document, done) {
done(null, selector + ' is ok!');
});
};
});
describe('my app', function() {
it('should pass', function() {
expect(customDsl('test')).toBe('test is ok!');
});
});
运行测试时,它失败并显示以下消息:
Frame window is not accessible.
我使用Windows 7并在Chrome中运行场景。为了运行测试,我先启动服务器node scriptsweb-server.js
,然后是scriptse2e-test.bat
。
在运行任何场景之前,您似乎需要移动到应用程序的某个页面。检查:
http://plnkr.co/edit/cG4CQI注意添加
browser().navigateTo('/')
解决了这个问题。把它拿出来,你就可以重复你的错误了。