无法使用詹金斯运行量角器

时间:2019-05-27 04:36:35

标签: jenkins protractor

我能够使用命令提示符运行量角器。

但是,当我尝试使用jenkins运行量角器时,它启动了selenium服务器,但不执行浏览器,并且由于超时而失败。

除了项目路径之外,我还需要在jenkins侧进行任何配置吗?

我还尝试过手动安装软件包以确保其更新。

以下是我尝试使用jenkins构建/运行量角器时的错误:

> webhis_jasmine@ protractor C:\Users\user1\.jenkins\HISWEBJASMINE
> protractor conf.js

[12:06:44] I/launcher - Running 1 instances of WebDriver
[12:06:44] I/local - Starting selenium standalone server...
[12:06:46] I/local - Selenium standalone server started at http://10.190.40.39:56419/wd/hub
Started
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0mA Jasmine spec timed out. Resetting the WebDriver Control Flow.
[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m[31mF[0m

我试图仅使用jenkins来运行webdriver-manager更新,但它给出了以下错误:

C:\Users\user1\.jenkins\HISWEBJASMINE>webdriver-manager update 
'webdriver-manager' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\user1\.jenkins\HISWEBJASMINE>exit 9009 

这是配置文件:

// conf.js
var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
exports.config = {


  capabilities: {
      'browserName': 'chrome'
  },
  specs: ['Patient_positive.js','Visit_positive.js'],
  suites:{
        Smoke: ['ChainLocators.js', 'Dropdown.js'],
            Regression: 'ElementBasics.js',
            Testbed: 'testbed.js',
            PatientPositive: 'Patient_positive.js',
            PatientNegative: 'Patient_negative.js',
            VisitPositive: 'Visit_positive.js',
            VisitNegative: 'Visit_negative.js',
            EpisodeCPOEPositive: 'EpisodeCPOE_positive.js'
    },
  onPrepare:function(){
      browser.driver.manage().window().maximize();
      jasmine.getEnv().addReporter(
                new Jasmine2HtmlReporter({
                  savePath: './test/reports/',
                  screenshotsFolder: 'images',
                  takeScreenshots: true,
                  fixedScreenshotName: true,
                  takeScreenshotsOnlyOnFailures: false,
                  cleanDestination: false,
                  showPassed: true,
                  fileName: 'Test_Report',
                  fileNameSuffix: '',
                  fileNameDateSuffix: true
                })
              );
             },

        jasmineNodeOpts:{
            showColors: true
        }
};

有关系吗?

1 个答案:

答案 0 :(得分:0)

尝试在配置文件中使用public void ConfigureServices(IServiceCollection services) { services.Configure<CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; }); services.AddRazorPages() .AddNewtonsoftJson(); services.AddControllers() .AddNewtonsoftJson(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { //other middlewares app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapControllers(); }); } 而不是directConnect:true

在运行测试之前,请执行以下活动

seleniumAddress: 'http://localhost:4444/wd/hub',

希望它对您有帮助