【问题标题】:Running protractor tests on jenkins在詹金斯上运行量角器测试
【发布时间】:2015-03-04 15:27:50
【问题描述】:

我正在尝试使用 jasmine-reporter 插件为 jenkins 生成报告。

我的量角器配置是:

exports.config = {
allScriptsTimeout: 99999,
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
    'browserName': 'chrome'
},
baseUrl: 'http://localhost:9000/',
framework: 'jasmine2',
specs: ['../test/e2e/**/*.js'],
onPrepare: function() {
   var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
        consolidateAll: true,
        filePrefix: 'test_results_e2e'
    }));
},

jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 60000,
    print: function() {}
}
};

生成了带有测试报告的文件,但测试失败并出现以下错误:

Failed: Angular could not be found on the page http://localhost:9000/# : retries looking for angular exceeded

我正在使用咕噜声。所以我定义了两项任务,一项用于测试,另一项用于开发。这两个任务使用不同的配置文件,唯一的区别是执行“grunt test”应该得到文件报告,而“grunt dev”执行测试并监视更改。因此,如果我使用“dev”任务运行应用程序,那么我不会收到任何错误。但是任务“test”仍然会产生错误的文件。

【问题讨论】:

    标签: angularjs selenium gruntjs jasmine protractor


    【解决方案1】:

    您看到的错误表明您正在测试的页面不是 Angular 应用程序。鉴于您提供的信息,我的最佳猜测是您的 grunt dev 任务正在启动本地服务器并在端口 9000 上为您的应用程序提供服务,这允许测试正常工作,但您的 grunt test 任务不会启动本地服务器,因此您的应用实际上并未在端口 9000 上运行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-16
      相关资源
      最近更新 更多