Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axe-playwright

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axe-playwright - npm Package Compare versions

Comparing version 1.1.11 to 1.1.12

dist/index.d.ts

39

dist/index.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -34,6 +38,8 @@ if (k2 === undefined) k2 = k;

Object.defineProperty(exports, "__esModule", { value: true });
exports.checkA11y = exports.reportViolations = exports.getViolations = exports.getAxeResults = exports.configureAxe = exports.injectAxe = void 0;
exports.DefaultTerminalReporter = exports.checkA11y = exports.reportViolations = exports.getViolations = exports.getAxeResults = exports.configureAxe = exports.injectAxe = void 0;
const fs = __importStar(require("fs"));
const utils_1 = require("./utils");
const defaultTerminalReporter_1 = __importDefault(require("./reporter/defaultTerminalReporter"));
exports.DefaultTerminalReporter = defaultTerminalReporter_1.default;
const terminalReporterV2_1 = __importDefault(require("./reporter/terminalReporterV2"));
/**

@@ -77,3 +83,3 @@ * Injects axe executable commands in the active window

const getViolations = (page, context, options) => __awaiter(void 0, void 0, void 0, function* () {
const result = yield exports.getAxeResults(page, context, options);
const result = yield (0, exports.getAxeResults)(page, context, options);
return result.violations;

@@ -99,13 +105,20 @@ });

*/
const checkA11y = (page, context, options, skipFailures, reporter) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
if (context === void 0) { context = undefined; }
if (options === void 0) { options = undefined; }
if (skipFailures === void 0) { skipFailures = false; }
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 === null || options === void 0 ? void 0 : options.axeOptions);
const impactedViolations = utils_1.getImpactedViolations(violations, options === null || options === void 0 ? void 0 : options.includedImpacts);
yield exports.reportViolations(impactedViolations, reporter);
utils_1.testResultDependsOnViolations(impactedViolations, skipFailures);
const checkA11y = (page, context = undefined, options = undefined, skipFailures = false, reporter = 'default') => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b, _c;
const violations = yield (0, exports.getViolations)(page, context, options === null || options === void 0 ? void 0 : options.axeOptions);
const impactedViolations = (0, utils_1.getImpactedViolations)(violations, options === null || options === void 0 ? void 0 : options.includedImpacts);
let reporterWithOptions;
if (reporter === 'default') {
reporterWithOptions = 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, (_b = options === null || options === void 0 ? void 0 : options.verbose) !== null && _b !== void 0 ? _b : true);
}
else if (reporter === 'v2') {
reporterWithOptions = new terminalReporterV2_1.default((_c = options === null || options === void 0 ? void 0 : options.verbose) !== null && _c !== void 0 ? _c : false);
}
else {
reporterWithOptions = reporter;
}
yield (0, exports.reportViolations)(impactedViolations, reporterWithOptions);
if (reporter !== 'v2')
(0, utils_1.testResultDependsOnViolations)(impactedViolations, skipFailures);
});
exports.checkA11y = checkA11y;

@@ -14,5 +14,6 @@ "use strict";

class DefaultTerminalReporter {
constructor(detailedReport, includeHtml) {
constructor(detailedReport, includeHtml, verbose) {
this.detailedReport = detailedReport;
this.includeHtml = includeHtml;
this.verbose = verbose;
}

@@ -33,3 +34,3 @@ report(violations) {

if (this.detailedReport) {
const nodeViolations = utils_1.describeViolations(violations).map(({ target, html, violations }) => {
const nodeViolations = (0, utils_1.describeViolations)(violations).map(({ target, html, violations }) => {
if (!this.includeHtml) {

@@ -48,3 +49,3 @@ return {

else {
console.log(`No accessibility violations detected!`);
this.verbose && console.log(`No accessibility violations detected!`);
}

@@ -51,0 +52,0 @@ });

{
"name": "axe-playwright",
"version": "1.1.11",
"version": "1.1.12",
"description": "Custom Playwright commands to inject axe-core and test for a11y",
"main": "dist/index.js",
"types": "index.d.ts",
"types": "dist/index.d.ts",
"files": [
"dist/**/*",
"README.md"
],
"keywords": [

@@ -23,3 +27,3 @@ "a11y",

"peerDependencies": {
"playwright-core": ">1.0.0"
"playwright": ">1.0.0"
},

@@ -29,15 +33,15 @@ "author": "Abhinaba Ghosh",

"devDependencies": {
"@types/is-ci": "^3.0.0",
"@types/jest": "^27.0.3",
"@types/node": "^17.0.4",
"jest": "^26.6.3",
"jest-each": "^27.0.2",
"jest-playwright-preset": "^1.3.1",
"playwright": "^1.1.1",
"prettier": "^2.0.5",
"ts-jest": "^26.5.0",
"typescript": "^4.1.3"
"@types/jest": "^28.1.1",
"@types/node": "^18.11.9",
"jest": "^28.1.3",
"jest-each": "^28.1.3",
"jest-playwright-preset": "^2.0.0",
"playwright": "^1.27.1",
"prettier": "^2.7.1",
"ts-jest": "^28.0.8",
"typescript": "^4.8.4"
},
"dependencies": {
"axe-core": "^4.0.1"
"picocolors": "^1.0.0",
"axe-core": "^4.5.1"
},

@@ -44,0 +48,0 @@ "repository": {

@@ -9,3 +9,3 @@ ![logo](./docs/logo.png)

[Axe](https://www.deque.com/axe/) is an accessibility testing engine for websites and other HTML-based user interfaces. This package provides simple axe analyser commands which you can incorporate in your [Playwright](https://www.npmjs.com/package/playwright) tests.The idea is highly inspired by [Andy Van Slaars](https://github.com/avanslaars) cypress-axe project.
[Axe](https://www.deque.com/axe/) is an accessibility testing engine for websites and other HTML-based user interfaces. This package provides simple axe analyser commands which you can incorporate in your [Playwright](https://www.npmjs.com/package/playwright) tests.

@@ -103,3 +103,3 @@ ## Install and configure

The keys consist of [those accepted by `axe.run`'s options argument](https://www.deque.com/axe/documentation/api-documentation/#parameters-axerun) as well as custom `includedImpacts`, `detailedReport`, and `detailedReportOptions` keys.
The keys consist of [those accepted by `axe.run`'s options argument](https://www.deque.com/axe/documentation/api-documentation/#parameters-axerun) as well as custom `includedImpacts`, `detailedReport`, `verbose`, and `detailedReportOptions` keys.

@@ -121,5 +121,7 @@ The `includedImpacts` key is an array of strings that map to `impact` levels in violations. Specifying this array will only include violations where the impact matches one of the included values. Possible impact values are "minor", "moderate", "serious", or "critical".

The `verbose` key is a boolean to whether to print the message `No accessibility violations detected!` when there aren't accessibility violations present in the test. For the `DefaultTerminalReporter` this is true and for the `v2 Reporter` this is false.
##### reporter (optional)
A class instance that implements the `Reporter` interface. Custom reporter instances can be supplied to override default reporting behaviour dictated by `DefaultTerminalReporter`.
A class instance that implements the `Reporter` interface or values `default` and `v2`. Custom reporter instances can be supplied to override default reporting behaviour dictated by `DefaultTerminalReporter` set by the value `default`. `v2` is the new TerminalReporter inspired by the reports from [jest-axe](https://github.com/nickcolley/jest-axe).

@@ -219,7 +221,5 @@ ##### skipFailures (optional, defaults to false)

const violations = await getViolations(page, 'input[name="password"]', {
axeOptions: {
runOnly: {
type: 'tag',
values: ['wcag2a'],
},
runOnly: {
type: 'tag',
values: ['wcag2a'],
},

@@ -226,0 +226,0 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc