【问题标题】:Karma, the test doesn't run业力,测试没有运行
【发布时间】:2014-02-02 18:35:48
【问题描述】:

这就是我的业力代码的样子..

describe('E2E: Testing Controllers', function() {
  beforeEach(function() {
    browser().navigateTo('/dashboard/');
  });

  it('should have a working home page controller that applies the leads to scope', function() {
    browser().navigateTo('#/');
    expect(browser().location().path()).toBe("/");
    expect(element('.shoutbox').html());
  });
});

业力被困在

browser navigate to '/dashboard/'

我不确定这里可能出了什么问题。

这是我的业力配置

var sharedConfig = require('./karma.shared.conf');

module.exports = function(config) {
  var conf = sharedConfig();

  conf.files = conf.files.concat([
    //test files
    './tests/e2e/**/*.js'
  ]);

  conf.proxies = {
    '/': 'http://localhost:8080/'
  };

  conf.urlRoot = '/__e2e/';

  conf.frameworks = ['ng-scenario'];

  config.set(conf);
};

我哪里出错了?

【问题讨论】:

    标签: angularjs testing karma-runner angular-scenario


    【解决方案1】:

    您使用的是哪个浏览器,因为我没有看到任何配置,例如'browsers: ['Chrome']'?

    请确保您已在proxies 中配置的地址运行应用程序。

    您是否安装了所需的插件,例如:

    https://github.com/karma-runner/karma-chrome-launcher

    https://github.com/karma-runner/karma-ng-scenario

    如果您的浏览器正在启动,如果出现错误,请查看 javascript 控制台。

    也许您需要在 karma.conf 中包含更多文件,例如:

    // list of files / patterns to load in the browser
            files: [
                'vendor/angular/angular.js', 'vendor/angular/angular-resource.js', 'vendor/angular/angular-mocks.js', 'test/e2e.*.js', 'src/**/*.js', 'test/e2e/**/*.js',
                'src/**/*.html'
            ]
    

    为什么你在beforeEach()it() 中使用browser().navigateTo('');

    您希望通过这个期望实现什么:expect(element('.shoutbox').html());

    查看ng-scenario syntax 并考虑使用Protractor

    【讨论】:

      猜你喜欢
      • 2015-05-22
      • 1970-01-01
      • 2014-10-01
      • 2015-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-10
      • 2017-05-30
      相关资源
      最近更新 更多