2

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

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);
};

我哪里出错了?

4

1 回答 1

0

您正在使用哪个浏览器,因为我没有看到任何配置,例如'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'
        ]

为什么你使用browser().navigateTo('');inbeforeEach()又一次 in it()

以及您希望通过此期望实现的目标:expect(element('.shoutbox').html());

查看ng-scenario 语法并考虑使用Protractor

于 2014-02-06T17:58:27.160 回答