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>resetOnNavigation
<boolean> Whether to reset coverage on every navigation. Defaults totrue
.
Returns coverage is started
#
chromiumCoverage.startJSCoverage([options])options
<Object>
Returns 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 eval
or new Function
. If reportAnonymousScripts
is set to true
, anonymous scripts will have __playwright_evaluation_script__
as their URL.
#
chromiumCoverage.stopCSSCoverage()Returns the array of coverage reports for all stylesheets
note
CSS Coverage doesn't include dynamically injected style tags without sourceURLs.
#
chromiumCoverage.stopJSCoverage()Returns the array of coverage reports for all scripts
note
JavaScript Coverage doesn't include anonymous scripts by default. However, scripts with sourceURLs are reported.