axe-playwright
Advanced tools
Comparing version 1.1.10 to 1.1.11
@@ -34,3 +34,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.checkA11y = exports.reportViolations = exports.getViolations = exports.configureAxe = exports.injectAxe = void 0; | ||
exports.checkA11y = exports.reportViolations = exports.getViolations = exports.getAxeResults = exports.configureAxe = exports.injectAxe = void 0; | ||
const fs = __importStar(require("fs")); | ||
@@ -58,2 +58,15 @@ const utils_1 = require("./utils"); | ||
/** | ||
* Runs axe-core tools on the relevant page and returns all results | ||
* @param page | ||
* @param context | ||
* @param options | ||
*/ | ||
const getAxeResults = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield page.evaluate(([context, options]) => { | ||
return window.axe.run(context || window.document, options); | ||
}, [context, options]); | ||
return result; | ||
}); | ||
exports.getAxeResults = getAxeResults; | ||
/** | ||
* Runs axe-core tools on the relevant page and returns all accessibility violations detected on the page | ||
@@ -65,6 +78,3 @@ * @param page | ||
const getViolations = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () { | ||
const result = yield page.evaluate(([context, options]) => { | ||
const axeOptions = options ? options['axeOptions'] : {}; | ||
return window.axe.run(context || window.document, axeOptions); | ||
}, [context, options]); | ||
const result = yield exports.getAxeResults(page, context, options); | ||
return result.violations; | ||
@@ -96,3 +106,3 @@ }); | ||
if (reporter === void 0) { reporter = new defaultTerminalReporter_1.default(options === null || options === void 0 ? void 0 : options.detailedReport, (_a = options === null || options === void 0 ? void 0 : options.detailedReportOptions) === null || _a === void 0 ? void 0 : _a.html); } | ||
const violations = yield exports.getViolations(page, context, options); | ||
const violations = yield exports.getViolations(page, context, options === null || options === void 0 ? void 0 : options.axeOptions); | ||
const impactedViolations = utils_1.getImpactedViolations(violations, options === null || options === void 0 ? void 0 : options.includedImpacts); | ||
@@ -99,0 +109,0 @@ yield exports.reportViolations(impactedViolations, reporter); |
@@ -78,3 +78,3 @@ import { AxeResults, Check, ElementContext, ImpactValue, Locale, Result, Rule, RunOptions } from 'axe-core' | ||
*/ | ||
export function getAxeResults(page: Page, context?: ElementContext, options?: RunOptions): Promise<AxeResults[]> | ||
export function getAxeResults(page: Page, context?: ElementContext, options?: RunOptions): Promise<AxeResults> | ||
@@ -81,0 +81,0 @@ /** |
{ | ||
"name": "axe-playwright", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"description": "Custom Playwright commands to inject axe-core and test for a11y", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31116
533