fix(capture): a11y evidence via ariaSnapshot (page.accessibility removed in playwright >=1.5x)
CI (SIAX Cloud) / security (push) Successful in 15s
CI (SIAX Cloud) / contracts (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 46s
CI (SIAX Cloud) / contracts (push) Successful in 48s
CI (SIAX Cloud) / quality (push) Successful in 49s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m5s
CI (SIAX Cloud) / security (push) Successful in 15s
CI (SIAX Cloud) / contracts (pull_request) Successful in 15s
CI (SIAX Cloud) / security (pull_request) Successful in 46s
CI (SIAX Cloud) / contracts (push) Successful in 48s
CI (SIAX Cloud) / quality (push) Successful in 49s
CI (SIAX Cloud) / quality (pull_request) Successful in 1m5s
This commit is contained in:
@@ -21,6 +21,7 @@ export interface CapturedPage {
|
||||
value: string | null;
|
||||
children?: unknown[];
|
||||
} | null;
|
||||
ariaSnapshot: string | null;
|
||||
har: {
|
||||
entries: { url: string; method: string; status: number; mimeType: string | null; size: number | null }[];
|
||||
entryCount: number;
|
||||
@@ -95,10 +96,11 @@ export function buildEvidence(targetId: string, page: CapturedPage): CaptureEvid
|
||||
requests: page.networkRequests,
|
||||
}, tool),
|
||||
];
|
||||
if (page.accessibilityTree) {
|
||||
if (page.accessibilityTree || page.ariaSnapshot) {
|
||||
evidence.push(
|
||||
record(targetId, page.finalUrl, "accessibility", {
|
||||
tree: page.accessibilityTree,
|
||||
tree: page.accessibilityTree ?? undefined,
|
||||
ariaSnapshot: page.ariaSnapshot ?? undefined,
|
||||
}, tool),
|
||||
);
|
||||
}
|
||||
@@ -234,8 +236,11 @@ export async function capturePage(
|
||||
// Screenshot failure is an evidence gap, not a capture failure.
|
||||
screenshotBase64 = null;
|
||||
}
|
||||
// Accessibility tree (measured; null on failure = explicit evidence gap).
|
||||
// Accessibility evidence (measured). Legacy page.accessibility first
|
||||
// (older runtimes), else ariaSnapshot on body (playwright >= 1.49).
|
||||
// Failure = explicit evidence gap (null), never a capture failure.
|
||||
let accessibilityTree: CapturedPage["accessibilityTree"] = null;
|
||||
let ariaSnapshot: string | null = null;
|
||||
try {
|
||||
const acc = (page as unknown as { accessibility?: { snapshot(): Promise<unknown> } })
|
||||
.accessibility;
|
||||
@@ -243,6 +248,13 @@ export async function capturePage(
|
||||
} catch {
|
||||
accessibilityTree = null;
|
||||
}
|
||||
if (!accessibilityTree) {
|
||||
try {
|
||||
ariaSnapshot = await page.locator("body").ariaSnapshot({ timeout: 5000 });
|
||||
} catch {
|
||||
ariaSnapshot = null;
|
||||
}
|
||||
}
|
||||
// HAR (measured; condensed to entry-level metadata).
|
||||
let har: CapturedPage["har"] = null;
|
||||
try {
|
||||
@@ -269,6 +281,7 @@ export async function capturePage(
|
||||
...captured,
|
||||
networkRequests,
|
||||
accessibilityTree,
|
||||
ariaSnapshot,
|
||||
har,
|
||||
screenshotBase64,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user