axe-playwright 1.1.10 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
31
31
  return (mod && mod.__esModule) ? mod : { "default": mod };
32
32
  };
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
- exports.checkA11y = exports.reportViolations = exports.getViolations = exports.configureAxe = exports.injectAxe = void 0;
34
+ exports.checkA11y = exports.reportViolations = exports.getViolations = exports.getAxeResults = exports.configureAxe = exports.injectAxe = void 0;
35
35
  const fs = __importStar(require("fs"));
36
36
  const utils_1 = require("./utils");
37
37
  const defaultTerminalReporter_1 = __importDefault(require("./reporter/defaultTerminalReporter"));
@@ -54,16 +54,26 @@ const configureAxe = (page, configurationOptions = {}) => __awaiter(void 0, void
54
54
  });
55
55
  exports.configureAxe = configureAxe;
56
56
  /**
57
- * Runs axe-core tools on the relevant page and returns all accessibility violations detected on the page
57
+ * Runs axe-core tools on the relevant page and returns all results
58
58
  * @param page
59
59
  * @param context
60
60
  * @param options
61
61
  */
62
- const getViolations = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () {
62
+ const getAxeResults = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () {
63
63
  const result = yield page.evaluate(([context, options]) => {
64
- const axeOptions = options ? options['axeOptions'] : {};
65
- return window.axe.run(context || window.document, axeOptions);
64
+ return window.axe.run(context || window.document, options);
66
65
  }, [context, options]);
66
+ return result;
67
+ });
68
+ exports.getAxeResults = getAxeResults;
69
+ /**
70
+ * Runs axe-core tools on the relevant page and returns all accessibility violations detected on the page
71
+ * @param page
72
+ * @param context
73
+ * @param options
74
+ */
75
+ const getViolations = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () {
76
+ const result = yield exports.getAxeResults(page, context, options);
67
77
  return result.violations;
68
78
  });
69
79
  exports.getViolations = getViolations;
@@ -90,7 +100,7 @@ const checkA11y = (page, context, options, skipFailures, reporter) => __awaiter(
90
100
  if (options === void 0) { options = undefined; }
91
101
  if (skipFailures === void 0) { skipFailures = false; }
92
102
  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); }
93
- const violations = yield exports.getViolations(page, context, options);
103
+ const violations = yield exports.getViolations(page, context, options === null || options === void 0 ? void 0 : options.axeOptions);
94
104
  const impactedViolations = utils_1.getImpactedViolations(violations, options === null || options === void 0 ? void 0 : options.includedImpacts);
95
105
  yield exports.reportViolations(impactedViolations, reporter);
96
106
  utils_1.testResultDependsOnViolations(impactedViolations, skipFailures);
package/index.d.ts CHANGED
@@ -75,7 +75,7 @@ export function configureAxe(page: Page, options?: ConfigOptions): Promise<void>
75
75
  * @param context
76
76
  * @param options
77
77
  */
78
- export function getAxeResults(page: Page, context?: ElementContext, options?: RunOptions): Promise<AxeResults[]>
78
+ export function getAxeResults(page: Page, context?: ElementContext, options?: RunOptions): Promise<AxeResults>
79
79
 
80
80
  /**
81
81
  * Runs axe-core tools on the relevant page and returns all accessibility violations detected on the page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axe-playwright",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "description": "Custom Playwright commands to inject axe-core and test for a11y",
5
5
  "main": "dist/index.js",
6
6
  "types": "index.d.ts",