标签: ngmocke2e

模块'ngMockE2E'不可用!AngularJS

在我的浏览器中出现以下错误:

Uncaught Error: [$injector:modulerr] Failed to instantiate module sayHiApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngMockE2E due to:
Error: [$injector:nomod] Module 'ngMockE2E' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.2.15/$injector/nomod?p0=ngMockE2E
    at http://127.0.0.1:9000/bower_components/angular/angular.js:78:12
    at http://127.0.0.1:9000/bower_components/angular/angular.js:1611:17
    at ensure (http://127.0.0.1:9000/bower_components/angular/angular.js:1535:38)
    at module (http://127.0.0.1:9000/bower_components/angular/angular.js:1609:14)
    at http://127.0.0.1:9000/bower_components/angular/angular.js:3717:22
    at Array.forEach (native)
    at forEach (http://127.0.0.1:9000/bower_components/angular/angular.js:323:11)
    at loadModules (http://127.0.0.1:9000/bower_components/angular/angular.js:3711:5)
    at http://127.0.0.1:9000/bower_components/angular/angular.js:3718:40
    at Array.forEach (native)
http://errors.angularjs.org/1.2.15/$injector/modulerr?p0=ngMockE2E&p1=Error…ngular%2Fangular.js%3A3718%3A40%0A%20%20%20%20at%20Array.forEach%20(native) …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs httpbackend ngmocke2e

10
推荐指数
1
解决办法
4200
查看次数

在Protractor中的httpBackend API模拟模块中打印请求

我在量角器中使用角度服务$ httpBackend对模拟的API运行我的e2e测试.

我已经有了selenium浏览器的调试日志:

afterEach(function() {
  browser.manage().logs().get('browser').then(function(browserLog){
    if(browserLog.length) {
      for (var i = 0; i < browserLog.length; i++) {
        if( typeof browserLog[i] !== 'undefined') {
          console.log(
            JSON
            .parse(browserLog[i].message).message.parameters[0].value
          );
        }
      };
    }
  });
});
Run Code Online (Sandbox Code Playgroud)

我想在我的httpBackend模块中打印每个请求的URL标题(例如,对于用户资源):

$httpBackend
  .whenGET(/^\/api\/users.*$/)
  .respond(function(method, url, data, headers) {
     var users = mockUserService.getData();
     console.log(url);
     console.log(headers);
     return [200, users, {}];
});
Run Code Online (Sandbox Code Playgroud)

但是在httpBackend模块内的任何地方都没有记录任何内容.当我在我的应用程序中使用它时它工作正常,但是当我在量角器中使用它时它没有.

有没有办法在任何地方打印?即使在输出文本文件中?

angularjs protractor httpbackend ngmocke2e e2e-testing

7
推荐指数
1
解决办法
1192
查看次数