protractor-har-reporter
v1.1.0
Published
Protractor reporter for capturing browser HAR files
Downloads
1,080
Maintainers
Readme
protractor-har-reporter
Protractor HAR reporter is capturing HAR files from browser network traffic and saves them to simplify debugging of failed tests.
Credits
Inspiration and some pieces of code come from https://github.com/Everettss/puppeteer-har
Install
npm i --save protractor-har-reporter
Usage
In your Protractor configuration file:
import { Config } from 'protractor';
import { HARReporter } from 'protractor-har-reporter'
export let config: Config = {
capabilities: {
browserName: 'chrome',
loggingPrefs: {
performance: 'ALL'
}
},
onPrepare: () => {
const harReporter = new HARReporter({
resultsDir: './results'
});
jasmine.getEnv().addReporter(harReporter);
}
}
HARReporter([config])
config
<[Object]>resultsDir
<[string]> path to save HAR fileprintLogs?
<[boolean]> when set totrue
, full path of saved HAR file will be printed after each spec, defaults tofalse
saveOnlyForFailedSpecs?
<[boolean]> when set totrue
, HAR file will be saved only for failed specs, defaults tofalse
Additional info
- HAR files will be saved in the
harfiles
subdir ofresultsDir
- HAR files collection works only on Chrome browser with enabled performance logging
- One HAR file is generated for one
it
block in spec file, file name corresponds todescribe
name followed byit
name