茉莉花 html 中的清洁目的地记者无法正常工作
Cleandestination in jasmine html reporter is not working
我正在使用以下代码生成 HTML
量角器端到端测试报告。
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: './e2e/e2e_coverage/',
savePath: './e2e/e2e_coverage/',
screenshotsFolder: 'images',
takeScreenShotsOnlyForFailedSpecs: true,
cleanDestination: true,
fixedScreenshotName: true,
htmlReportDir: './e2e/e2e_coverage/htmlReports/',
jsonsSubfolder: 'jsons',
docTitle: 'HTMLreport.html'
}).getJasmine2Reporter());
这里,清理目标不是清理以前的 运行 结果。它附加了之前的 运行 结果,这在 HTML
报告中产生了重复的结果。
我正在使用 protractor-beautiful-reporter version 1.2.7
。
请让我知道我缺少什么。
在您的 onPrepare()
中尝试以下操作
// Add a screenshot reporter:
jasmine.getEnv().addReporter(new HtmlReporter({
preserveDirectory: false,
takeScreenShotsOnlyForFailedSpecs: true,
screenshotsSubfolder: 'images',
jsonsSubfolder: 'jsons',
baseDirectory: 'reports-tmp',
pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) {
// Return '<30-12-2016>/<browser>/<specname>' as path for screenshots:
// Example: '30-12-2016/firefox/list-should work'.
var currentDate = new Date(),
day = currentDate.getDate(),
month = currentDate.getMonth() + 1,
year = currentDate.getFullYear();
var validDescriptions = descriptions.map(function (description) {
return description.replace('/', '@');
});
return path.join(
day + "-" + month + "-" + year,
// capabilities.get('browserName'),
validDescriptions.join('-'));
}
}).getJasmine2Reporter());
protractor-beautiful-reporter version 1.2.7
中没有cleanDestination
选项。
希望preserveDirectory: false,
对您有所帮助。
您可以使用以下代码轻松实现此目的。我在量角器的 5.4.2 版中进行了测试
https://www.npmjs.com/package/protractor-beautiful-reporter
// protractor beautifulreporterconfig.js
//Add this import with path to exact node module to avoid the error
var HtmlReporter = require('C:/Users/sam/AppData/Roaming/npm/node_modules/protractor-beautiful-reporter');
exports.config = {
//directConnect: true,
framework: 'jasmine',
//if your spec.js only have none angular scripts
onPrepare: function () {
// browser.driver.ignoreSynchronization = true;// for non-angular set true. default value is false
//browser.waitForAngularEnabled(false); // for non-angular set false. default value is true
browser.driver.manage().window().setSize(1280, 1024);
},
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
}
},
jasmineNodeOpts: {
//Jasmine provides only one timeout option timeout in milliseconds don't add ;
defaultTimeoutInterval: 180000
},
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/Reports/screenshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: 'HtmlReports',
screenshotsSubfolder: 'images', //sub folder for screenshots
//Below settings are optional
//Add title for the html report (optional)
docTitle: 'my beautiful reporter',
jsonsSubfolder: 'jsons',//You can store all JSONs in subfolder by using jsonsSubfolder option:
//Exclude report for skipped test cases (optional)
excludeSkippedSpecs: false,//default is false
//Screenshots for skipped test cases (optional) Default is false.
takeScreenShotsForSkippedSpecs: false,
//Screenshots only for failed test cases (optional) default is false
takeScreenShotsOnlyForFailedSpecs: false,
//To Disable all screenshots default is false
disableScreenshots: false,
//You can gather browser logs using gatherBrowserLogs: option: default is true
gatherBrowserLogs: true ,
//You can preserve (or clear) the base directory using preserveDirectory: option:Default is true.
// it it is true , report folder get cleared before the execution
//If you want to show the total duration in the header or footer area...
preserveDirectory: false,
clientDefaults:{
showTotalDurationIn: "header",
totalDurationFormat: "hms"
}
}).getJasmine2Reporter());
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/com/sam/scriptjs/radiobutton.spec.js']
}
我正在使用以下代码生成 HTML
量角器端到端测试报告。
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: './e2e/e2e_coverage/',
savePath: './e2e/e2e_coverage/',
screenshotsFolder: 'images',
takeScreenShotsOnlyForFailedSpecs: true,
cleanDestination: true,
fixedScreenshotName: true,
htmlReportDir: './e2e/e2e_coverage/htmlReports/',
jsonsSubfolder: 'jsons',
docTitle: 'HTMLreport.html'
}).getJasmine2Reporter());
这里,清理目标不是清理以前的 运行 结果。它附加了之前的 运行 结果,这在 HTML
报告中产生了重复的结果。
我正在使用 protractor-beautiful-reporter version 1.2.7
。
请让我知道我缺少什么。
在您的 onPrepare()
// Add a screenshot reporter:
jasmine.getEnv().addReporter(new HtmlReporter({
preserveDirectory: false,
takeScreenShotsOnlyForFailedSpecs: true,
screenshotsSubfolder: 'images',
jsonsSubfolder: 'jsons',
baseDirectory: 'reports-tmp',
pathBuilder: function pathBuilder(spec, descriptions, results, capabilities) {
// Return '<30-12-2016>/<browser>/<specname>' as path for screenshots:
// Example: '30-12-2016/firefox/list-should work'.
var currentDate = new Date(),
day = currentDate.getDate(),
month = currentDate.getMonth() + 1,
year = currentDate.getFullYear();
var validDescriptions = descriptions.map(function (description) {
return description.replace('/', '@');
});
return path.join(
day + "-" + month + "-" + year,
// capabilities.get('browserName'),
validDescriptions.join('-'));
}
}).getJasmine2Reporter());
protractor-beautiful-reporter version 1.2.7
中没有cleanDestination
选项。
希望preserveDirectory: false,
对您有所帮助。
您可以使用以下代码轻松实现此目的。我在量角器的 5.4.2 版中进行了测试 https://www.npmjs.com/package/protractor-beautiful-reporter
// protractor beautifulreporterconfig.js
//Add this import with path to exact node module to avoid the error
var HtmlReporter = require('C:/Users/sam/AppData/Roaming/npm/node_modules/protractor-beautiful-reporter');
exports.config = {
//directConnect: true,
framework: 'jasmine',
//if your spec.js only have none angular scripts
onPrepare: function () {
// browser.driver.ignoreSynchronization = true;// for non-angular set true. default value is false
//browser.waitForAngularEnabled(false); // for non-angular set false. default value is true
browser.driver.manage().window().setSize(1280, 1024);
},
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: [ "--start-maximized" ]
}
},
jasmineNodeOpts: {
//Jasmine provides only one timeout option timeout in milliseconds don't add ;
defaultTimeoutInterval: 180000
},
onPrepare: function() {
// Add a screenshot reporter and store screenshots to `/Reports/screenshots`:
jasmine.getEnv().addReporter(new HtmlReporter({
baseDirectory: 'HtmlReports',
screenshotsSubfolder: 'images', //sub folder for screenshots
//Below settings are optional
//Add title for the html report (optional)
docTitle: 'my beautiful reporter',
jsonsSubfolder: 'jsons',//You can store all JSONs in subfolder by using jsonsSubfolder option:
//Exclude report for skipped test cases (optional)
excludeSkippedSpecs: false,//default is false
//Screenshots for skipped test cases (optional) Default is false.
takeScreenShotsForSkippedSpecs: false,
//Screenshots only for failed test cases (optional) default is false
takeScreenShotsOnlyForFailedSpecs: false,
//To Disable all screenshots default is false
disableScreenshots: false,
//You can gather browser logs using gatherBrowserLogs: option: default is true
gatherBrowserLogs: true ,
//You can preserve (or clear) the base directory using preserveDirectory: option:Default is true.
// it it is true , report folder get cleared before the execution
//If you want to show the total duration in the header or footer area...
preserveDirectory: false,
clientDefaults:{
showTotalDurationIn: "header",
totalDurationFormat: "hms"
}
}).getJasmine2Reporter());
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['src/com/sam/scriptjs/radiobutton.spec.js']
}