Installations
npm install protractor-html-reporter
Releases
Unable to fetch releases
Developer
etxebe
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
4.6.0
NPM Version
2.15.9
Statistics
9 Stars
47 Commits
15 Forks
4 Watching
1 Branches
1 Contributors
Updated on 23 Oct 2022
Languages
JavaScript (77.67%)
CSS (22.33%)
Total Downloads
Cumulative downloads
Total Downloads
1,854,407
Last day
-39.6%
361
Compared to previous day
Last week
-22.5%
2,524
Compared to previous week
Last month
16.8%
12,296
Compared to previous month
Last year
-21.2%
167,742
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
protractor-html-reporter
Generates html report with piecharts based on xml file with tests results. For generating xml file with tests results you can use jasmine-reporters.
This reporter can also display screenshots taken on test failure. To get the screenshots you can use jasmine2-protractor-utils module.
This package is inspired by cucumber-html-report.
repo : https://github.com/etxebe/protractor-html-reporter
Sample images
How to use
-
Converting the xml file to html
1 var HTMLReport = require('protractor-html-reporter'); 2 3 testConfig = { 4 reportTitle: 'Test Execution Report', 5 outputPath: './', 6 screenshotPath: './screenshots', 7 testBrowser: browserName, 8 browserVersion: browserVersion 9 }; 10 new HTMLReport().from('xmlresults.xml', testConfig);
-
Using with protractor conf.js file
1//HTMLReport called once tests are finished 2onComplete: function() { 3 var browserName, browserVersion; 4 var capsPromise = browser.getCapabilities(); 5 6 capsPromise.then(function (caps) { 7 browserName = caps.get('browserName'); 8 browserVersion = caps.get('version'); 9 10 var HTMLReport = require('protractor-html-reporter'); 11 12 testConfig = { 13 reportTitle: 'Test Execution Report', 14 outputPath: './', 15 screenshotPath: './screenshots', 16 testBrowser: browserName, 17 browserVersion: browserVersion, 18 modifiedSuiteName: false, 19 screenshotsOnlyOnFailure: true 20 }; 21 new HTMLReport().from('xmlresults.xml', testConfig); 22 }); 23 }
-
In order to obtain results in xml file you can use jasmine-reporters module:
1var jasmineReporters = require('jasmine-reporters'); 2jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({ 3 consolidateAll: true, 4 savePath: './', 5 filePrefix: 'xmlresults' 6}));
-
In order to obtain screenshots on failure you can use this piece of code (you have to put it in onPrepare). The directory with screenshots must be in the same location as html report file (e.g. html file is in report directory so screenshots files must be in directory /report/screenshots/).
1var fs = require('fs-extra'); 2 3fs.emptyDir('screenshots/', function (err) { 4 console.log(err); 5 }); 6 7 jasmine.getEnv().addReporter({ 8 specDone: function(result) { 9 if (result.status == 'failed') { 10 browser.getCapabilities().then(function (caps) { 11 var browserName = caps.get('browserName'); 12 13 browser.takeScreenshot().then(function (png) { 14 var stream = fs.createWriteStream('screenshots/' + browserName + '-' + result.fullName+ '.png'); 15 stream.write(new Buffer(png, 'base64')); 16 stream.end(); 17 }); 18 }); 19 } 20 } 21 });
-
Or you can use jasmine2-protractor-utils module to get the screenshots:
1//In exports.config put this: 2plugins: [{ 3 package: 'jasmine2-protractor-utils', 4 disableHTMLReport: true, 5 disableScreenshot: false, 6 screenshotPath:'./screenshots', 7 screenshotOnExpectFailure:false, 8 screenshotOnSpecFailure:true, 9 clearFoldersBeforeTest: true 10 }], 11 ```
If you want to display your screenshots on report you have to pass testBrowser (it's the name of the browser) in testConfig object, because the screenshot's names are in format "browserName-.png" (e.g. "chrome-.png").
Options
- reportTitle
The report title displayed in generated html report. - outputPath
The path where to write html report. - screenshotPath
The path where to look for screenshots (the path must be in the same location as html file report e.g. if html file report is in location /report/test-report.html the screenshots must be placed in directory /report/screenshots/. - testBrowser
The name of browser on which the tests were executed. It's necessary if you want to display screenshots in your report. - browserVersion
The version of the browser. - modifiedSuiteName (bool) default: false
It says if suite names were changed at conf.js level. The suite names can be changed using 'jasmine-reporters' module and using modifySuiteName option. If we change the suite names this will also affect the names of screenshots we are looking for. If modifiedSuiteName is set to true the reporter will remove from the suite name the prefix and a dot (e.g. "firefox.") in order to find correct screenshot name. Unfortunately, the reporter will handle such situation only if we change suite name to "browserName.TestSuiteName" form. - screenshotsOnlyOnFailure (bool) default: true
To display screenshots only in testcases that failed. Default value is "true".
Credits
Credit to the developers of cucumber-html-report for developing pretty HTML reporting. The protractor-html-reporter is based on this one. I've added some new things, some thing were removed and instead of json file this reporter is based on xml file.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
3
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to protractor-html-reporter
protractor-html-reporter-2
To generate HTML report for Protractor test execution with pie charts
protractor-jasmine2-screenshot-reporter
Use the screenshot reporter to capture screenshots after each executed Protractor test case.
jasmine-spec-reporter
Spec reporter for jasmine behavior-driven development framework
protractor-beautiful-reporter
An npm module and which generates your Protractor test reports in HTML (angular) with screenshots