【发布时间】:2019-05-27 04:36:35
【问题描述】:
我可以使用命令提示符运行量角器。
但是,当我尝试使用 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 个“它”并运行。设法获得成功结果并生成报告,但我看到浏览器没有像使用 cmd 提示符运行时那样启动。
C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE>npm run protractor
> webhis_jasmine@ protractor C:\Users\hafizan.abdmulok\.jenkins\HISWEBJASMINE
> protractor conf.js
[15:14:40] I/launcher - Running 1 instances of WebDriver
[15:14:40] I/local - Starting selenium standalone server...
[15:14:43] I/local - Selenium standalone server started at http://10.190.40.39:52793/wd/hub
Started
Successfully open patient page
Successfully enter name
Successfully select title
Successfully select gender
Successfully enter date of birth
Successfully select ID type
Successfully enter idno= 850921141112
Successfully select Nationality= Malaysia
Successfully enter mobile no
Successfully enter patient address line 1
Successfully enter patient address line 2
Successfully enter patient address line 3
Successfully enter patient postcode= 57000
Successfully enter patient city= Bukit Jalil
Successfully select patient State= Kuala Lumpur
Successfully select patient State= Malaysia
[32m.[0m
1 spec, 0 failures
Finished in 63.169 seconds
CGM
[15:15:52] I/local - Shutting down selenium standalone server.
[15:15:52] I/launcher - 0 instance(s) of WebDriver still running
[15:15:52] I/launcher - chrome #01 passed
Finished: SUCCESS
【问题讨论】:
-
运行 webdriver manager 命令,例如:“node_modules\.bin\webdriver-manager update”
-
@SadikAli 我试过运行这个命令
node node_modules/protractor/bin/webdriver-manager update --standalone --versions.standalone=3.8.0 -
有效吗?
-
不,它不工作
标签: jenkins protractor