Version: 1.2.0
ChromiumCoverage
Coverage gathers information about parts of JavaScript and CSS that were used by the page.
An example of using JavaScript coverage to produce Istambul report for page load:
- chromiumCoverage.startCSSCoverage([options])
- chromiumCoverage.startJSCoverage([options])
- chromiumCoverage.stopCSSCoverage()
- chromiumCoverage.stopJSCoverage()
chromiumCoverage.startCSSCoverage([options])#
options<Object> Set of configurable options for coverageresetOnNavigation<boolean> Whether to reset coverage on every navigation. Defaults totrue.
- returns: <Promise> Promise that resolves when coverage is started
chromiumCoverage.startJSCoverage([options])#
options<Object> Set of configurable options for coverage- returns: <Promise> Promise that resolves when coverage is started
NOTE Anonymous scripts are ones that don't have an associated url. These are scripts that are dynamically created on the page using
evalornew Function. IfreportAnonymousScriptsis set totrue, anonymous scripts will have__playwright_evaluation_script__as their URL.
chromiumCoverage.stopCSSCoverage()#
- returns: <Promise<Array<Object>>> Promise that resolves to the array of coverage reports for all stylesheets
NOTE CSS Coverage doesn't include dynamically injected style tags without sourceURLs.
chromiumCoverage.stopJSCoverage()#
- returns: <Promise<Array<Object>>> Promise that resolves to the array of coverage reports for all scripts
NOTE JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.