![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
protractor-multiple-cucumber-html-reporter-plugin
Advanced tools
A protractor plugin to use multiple-cucumber-html-reporter with CucumberJs 1, 2 or 3
This plugin will connect Protractor, CucumberJS and protractor-cucumber-framework to generate unique JSON files per feature with only a few lines of code. It will also replace the extra CucumberJS hook you needed to make in CucumberJS 1 and 2 to generate unique JSON report files.
It was born when CucucmberJS 3 removed the
registerHandler
andregisterListener
. As of version 3 Protractor and CucumberJS users don't have the possibility to generate and create unique JSON report files. With this module they have.
You will also get multiple-cucumber-html-reporter as a dependency and use it on the fly to generate beautiful reports. A sample can be found here
Node.js | Protractor | CucumberJS | protractor-cucumber-framework | multiple-cucumber-html-reporter |
---|---|---|---|---|
6.x | 4.x | 1.x | 3.1.2 or higher | 1.0.0 or higher |
7.x | 5.x | 2.x | ||
8.x | 3.x |
npm install protractor-multiple-cucumber-html-reporter-plugin --save-dev
You need to do 2 things.
format: 'json:.tmp/results.json'
to your cucumberOpts
in the config. This will tell CucumbjerJS to generate a JSON-file. As of protractor-cucumber-framework
version 3.1.2 you will get unique JSON files, see also here.protractor-multiple-cucumber-html-reporter-plugin
in the plugins
block inside
protractor.config.js
.!!The path that is defined in the
format
is the path where all files and reports are saved. Advice is not to save the CucumberJS JSON report fil in the root of the project but in for example a.tmp/
folder!!
Here is a short config example of both steps.
const path = require('path');
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: [
path.resolve(process.cwd(), './**/*.steps.js')
],
// Tell CucumberJS to save the JSON report
format: 'json:.tmp/results.json',
strict: true
},
specs: [
'*.feature'
],
multiCapabilities: [{
browserName: 'chrome',
shardTestFiles: true,
maxInstances: 2,
chromeOptions: {
args: ['disable-infobars']
}
}],
// Here the magic happens
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options:{
// read the options part
}
}]
};
If you don't provide options
the pluging will use the defaults as mentioned below. Options can be added by creating an object like this:
plugins: [{
package: 'protractor-multiple-cucumber-html-reporter-plugin',
options:{
// read the options part for more options
automaticallyGenerateReport: true,
removeExistingJsonReportFile: true
}
}]
automaticallyGenerateReport
boolean
false
Setting this option will autimatically generate a new report with multiple-cucumber-html-reporter
. It will generate a log at the end of the testexection where you can find the report and looks like this. This means that you don't need to call the report module in a seperate node process. For the options of the report see the options openReportInBrowser
, reportPath
and saveCollectedJSON
=====================================================================================================
Multiple Cucumber HTML report generated in:
/Users/wswebcreation/protractor-multiple-cucumber-html-reporter-plugin/.tmp/report/index.html
Tnx for using Multiple Cucumber HTML report
Grtz wswebcreation
=====================================================================================================
jsonOutputPath
string
json-output-folder
The directory that will hold all the unique generated JSON files, relative from where the script is started.
N.B.: If you use a npm script from the command line, like for example npm run generate-report
the jsonOutputPath
will be relative from the path where the script is executed. Executing it from the root of your project will also search for the jsonOutputPath
from the root of you project.
If you DON'T provide this it will generate a json-output-folder
-folder in the path
that it defined the cucumberOpts.format
.
openReportInBrowser
boolean
false
Settign this option will automatically open the generated report in the default browser of the operating system. See also here.
removeExistingJsonReportFile
boolean
false
Settign this option will remove the previous unique JSON report file if it exists. It will prevent double reports of 1 feature + browser execution combination when generating te report with multiple-cucumber-html-reporter
. This may come in handy when you rerun your flakey features with for example protractor-flake
removeOriginalJsonReportFile
boolean
false
Setting this option will remove the original json report file, defined in the cucumberOpts.format
. It will clean up the folder where you save all your results and may be needed if you have a lot of JSON-files with screenshots in it.
reportPath
string
report
The directory in which the report needs to be saved, relative from where the script is started. See also here.
If you DON'T provide this it will generate a report
-folder in the path
that it defined the cucumberOpts.format
.
N.B.: If you use a npm script from the command line, like for example npm run generate-report
the reportPath
will be relative from the path where the script is executed. Executing it from the root of your project will also save the report in the reportPath
in the root of you project.
saveCollectedJSON
boolean
false
multiple-cucumber-html-reporter
will first merge all the JSON-files to 1 file and then enrich it with data that is used for the report. If saveCollectedJSON :true
the merged JSON AND the enriched JSON will be saved in the reportPath
. They will be saved as:
merged-output.json
enriched-output.json
See also here
The report can also show on which browser / device a feature has been executed. It is shown on the featurs overview in the table as well as on the feature overview in a container. You can add this by adding the following object to your capabilities
or multiCapabilities
capabilities: {
browserName: 'chrome',
chromeOptions: {
args: ['disable-infobars']
},
// Add this
metadata: {
browser: {
name: 'chrome',
version: '58'
},
device: 'MacBook Pro 15',
platform: {
name: 'OSX',
version: '10.12.6'
}
}
}
// Or
multiCapabilities: [{
browserName: 'chrome',
chromeOptions: {
args: ['disable-infobars']
},
// Add this
metadata: {
browser: {
name: 'chrome',
version: '58'
},
device: 'MacBook Pro 15',
platform: {
name: 'OSX',
version: '10.12.6'
}
}
}
See the metadata information here for the correct values.
If you don't provide a
browser.name
or abrowser.version
the module will try to determine this automatically. The rest will be shown as questionmarks in the report
The Changelog can be found here
How to contribute can be found here
When creating this plugin I got a lot of inspiration from:
If this plugin was helpful for you, please give it a ★ Star on Github and npm
FAQs
A protractor plugin to use multiple-cucumber-html-reporter with CucumberJs 1, 2 or 3
The npm package protractor-multiple-cucumber-html-reporter-plugin receives a total of 0 weekly downloads. As such, protractor-multiple-cucumber-html-reporter-plugin popularity was classified as not popular.
We found that protractor-multiple-cucumber-html-reporter-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.