Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/accessibility/results-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ In your CI workflow that runs your Cypress tests,

:::info

If you record multiple runs in a single CI build, you must record these runs using the `--tag` parameter and then call `getAccessibilityResults`with the `runTags` argument for each run. 
If you record multiple runs in a single CI build, you must record these runs using the `--tag` parameter and then call `getAccessibilityResults`with the `runTags` argument for each run.

This is necessary to identify each unique run and return a corresponding set of results. The tags are how each run is uniquely identified.

Expand Down
42 changes: 18 additions & 24 deletions docs/ui-coverage/results-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,41 +52,35 @@ getUICoverageResults({
projectId: '...', // optional if set from env
recordKey: '...', // optional if set from env
runTags: [process.env.RUN_TAGS], // required if recording multiple runs
})
.then((results) => {
const {
runNumber,
uiCoverageReportUrl,
summary,
views
} = results
}).then((results) => {
const { runNumber, uiCoverageReportUrl, summary, views } = results

console.log(`Received ${summary.isPartialReport ? 'partial' : ''} results for run #${runNumber}.`).
console.log(`See full report at ${uiCoverageReportUrl}.`)
console
.log(
`Received ${summary.isPartialReport ? 'partial' : ''} results for run #${runNumber}.`
)
.console.log(`See full report at ${uiCoverageReportUrl}.`)

// verify project coverage
if (summary.coverage < 80) {
throw new Error(`Project coverage is ${summary.coverage}, which does not meet the minimum coverage of 80%.`)
if (summary.coverage < 80) {
throw new Error(
`Project coverage is ${summary.coverage}, which does not meet the minimum coverage of 80%.`
)
}

const criticalViews = [
/login/,
/checkout/
]
const criticalViews = [/login/, /checkout/]

// verify critical view coverage
const criticalViewResults = views.forEach((view) => {
const {
displayName,
coverage,
uiCoverageReportUrl
} = view
const { displayName, coverage, uiCoverageReportUrl } = view

const isCriticalView = criticalViews.some((rx) => rx.test(displayName))
if (!isCriticalView) return

if (coverage &#x3C; 95) {
throw new Error(`The critical view ${displayName} has the coverage of ${coverage}, which does not meet the critical view coverage of 95%. See report at ${uiCoverageReportUrl}.`)
if (coverage < 95) {
throw new Error(
`The critical view ${displayName} has the coverage of ${coverage}, which does not meet the critical view coverage of 95%. See report at ${uiCoverageReportUrl}.`
)
}
})

Expand Down Expand Up @@ -185,7 +179,7 @@ In your CI workflow that runs your Cypress tests,

:::info

If you record multiple runs in a single CI build, you must record these runs using the `--tag` parameter and then call `getUICoverageResults`with the `runTags` argument for each run.&#x20;
If you record multiple runs in a single CI build, you must record these runs using the `--tag` parameter and then call `getUICoverageResults`with the `runTags` argument for each run.

This is necessary to identify each unique run and return a corresponding set of results. The tags are how each run is uniquely identified.

Expand Down