snap-ally 0.2.1-beta → 0.2.3-beta
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/README.md
CHANGED
|
@@ -7,6 +7,19 @@ A powerful, developer-friendly Playwright reporter for **Accessibility testing**
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## 🤔 Why the name "Snap-Ally"?
|
|
11
|
+
|
|
12
|
+
- **Snap**: Like a snapshot, it provides an instant picture of a website's accessibility state at the moment the tests are executed.
|
|
13
|
+
- **Ally**: It resembles **a11y** (the abbreviation for accessibility) and serves as an ally that allows you to create bugs in Azure DevOps more easily.
|
|
14
|
+
|
|
15
|
+
## 💡 Motivation
|
|
16
|
+
|
|
17
|
+
I have seen closely how much people with disabilities struggle with something as fundamental as finding a job.
|
|
18
|
+
|
|
19
|
+
I believe that with relatively simple changes in HTML, good color contrast, among other things, systems should work and help all people equally. Since about 15% of the world's population lives with some form of disability.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
10
23
|
## 📺 Demo
|
|
11
24
|
|
|
12
25
|
**[▶️ Watch the Demo Video](https://www.loom.com/share/853c04f1f76242a699e8f82e54733007)**
|
package/dist/A11yAuditOverlay.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.A11yAuditOverlay = void 0;
|
|
4
|
-
const test_1 = require("@playwright/test");
|
|
5
4
|
/**
|
|
6
5
|
* Handles visual feedback and Playwright annotations during an accessibility audit.
|
|
7
6
|
*
|
|
@@ -261,7 +260,9 @@ class A11yAuditOverlay {
|
|
|
261
260
|
* @returns The raw screenshot buffer.
|
|
262
261
|
*/
|
|
263
262
|
async captureAndAttachScreenshot(fileName, testInfo) {
|
|
264
|
-
|
|
263
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
264
|
+
const { test } = require('@playwright/test');
|
|
265
|
+
return await test.step('Capture A11y screenshot', async () => {
|
|
265
266
|
const screenshot = await this.page.screenshot({ fullPage: false });
|
|
266
267
|
await testInfo.attach(fileName, { contentType: 'image/png', body: screenshot });
|
|
267
268
|
return screenshot;
|
package/dist/A11yScanner.d.ts
CHANGED
package/dist/A11yScanner.js
CHANGED
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.checkAccessibility = void 0;
|
|
7
7
|
exports.scanA11y = scanA11y;
|
|
8
8
|
const playwright_1 = __importDefault(require("@axe-core/playwright"));
|
|
9
|
-
const test_1 = require("@playwright/test");
|
|
10
9
|
const A11yAuditOverlay_1 = require("./A11yAuditOverlay");
|
|
11
10
|
const models_1 = require("./models");
|
|
12
11
|
const A11yTimeUtils_1 = require("./A11yTimeUtils");
|
|
@@ -96,7 +95,10 @@ async function scanA11y(page, testInfo, options = {}) {
|
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
97
|
// Fail the test if violations found (softly)
|
|
99
|
-
|
|
98
|
+
// Dynamically require to avoid eager loading @playwright/test during config evaluation
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
100
|
+
const { expect } = require('@playwright/test');
|
|
101
|
+
expect
|
|
100
102
|
.soft(violationCount, `Accessibility audit failed with ${violationCount} violations.`)
|
|
101
103
|
.toBe(0);
|
|
102
104
|
// Run Axe Audit
|
|
@@ -167,7 +169,6 @@ async function scanA11y(page, testInfo, options = {}) {
|
|
|
167
169
|
pageUrl: page.url(),
|
|
168
170
|
accessibilityScore: 0, // No longer used, derivation from Lighthouse removed
|
|
169
171
|
a11yErrors: errors,
|
|
170
|
-
video: 'a11y-scan-video.webm', // Reference name for reporter
|
|
171
172
|
criticalColor: models_1.Severity.critical,
|
|
172
173
|
seriousColor: models_1.Severity.serious,
|
|
173
174
|
moderateColor: models_1.Severity.moderate,
|
package/dist/models/index.d.ts
CHANGED
|
@@ -894,10 +894,15 @@ async function submitFinalBug() {
|
|
|
894
894
|
let videoUrl = null;
|
|
895
895
|
if (videoPath) {
|
|
896
896
|
try {
|
|
897
|
-
const
|
|
898
|
-
|
|
897
|
+
const res = await fetch(videoPath);
|
|
898
|
+
if (res.ok) {
|
|
899
|
+
const videoBlob = await res.blob();
|
|
900
|
+
videoUrl = await uploadAttachment(videoBlob, 'session-recording.webm');
|
|
901
|
+
} else {
|
|
902
|
+
console.warn(`[SnapAlly] Video not found or access denied: ${videoPath}. Skipping video upload.`);
|
|
903
|
+
}
|
|
899
904
|
} catch (e) {
|
|
900
|
-
console.
|
|
905
|
+
console.warn(`[SnapAlly] Failed to load video: ${e.message}. Skipping video upload.`);
|
|
901
906
|
}
|
|
902
907
|
}
|
|
903
908
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snap-ally",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3-beta",
|
|
4
4
|
"description": "A custom Playwright reporter for Accessibility testing using Axe, with HTML reporting and Azure DevOps integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|