diff --git a/README.md b/README.md
index e01d43e..8054479 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Open [KindPath locally](http://127.0.0.1:5173/). The API listens on `127.0.0.1:3
`npm run dev` builds the current scanner and firewall runtime images before starting the API and Vite. The first build can download public packages and images; subsequent builds reuse Docker's cache. Browser QA images are only needed for the browser checks, not normal development. If Docker is unavailable, setup stops with an explanation; Chromium never runs directly on the host as a fallback. Ctrl+C stops the dev processes.
-Website scanning and capture are **enabled by default for local use**. Enter a URL, select **Scan website**, and download the JSON report or open **Visual preview**. Addresses without a scheme default to HTTPS. The URL scan button waits for the bounded capability check before accepting a submission. Ordinary URL submissions never silently become sample findings. The explicitly labelled example and built-in pages remain available separately.
+Website scanning and capture are **enabled by default for local use**. Enter a URL, select **Scan website**, and download the JSON report or open **Visual preview**. Addresses without a scheme default to HTTPS. The URL scan button waits for the bounded capability check before accepting a submission. Ordinary URL submissions never silently become sample findings. The landing page includes a static side-by-side illustration of blur and a red–green colour vision simulation.
To disable real scanning or capture in a local process:
@@ -50,7 +50,7 @@ Real-page previews use a JPEG rendered in the same isolated visit as the report.
- Captures are bounded to the scan viewport's width (up to 1,280 pixels), the first 6,000 pixels of height, and 1.5 MB of JPEG data. Long-page truncation is labelled. Horizontal overflow outside the scan viewport, content requiring interaction, and resources not loaded by the source browser are not included.
- A screenshot is an image rather than a semantic, responsive or interactive replica. Changing the panel width scales the captured desktop page; it does not rerun its responsive layout. Live content can change between scans.
-Images are independently validated and embedded in sandboxed, opaque-origin iframes. The image document permits only embedded image data and trusted styling; scripts, external connections, frames, forms and navigation targets are absent. No third-party page markup or resource URL is copied into it. Legacy controlled DOM previews remain for the built-in illustration checks.
+Images are independently validated and embedded in sandboxed, opaque-origin iframes. The image document permits only embedded image data and trusted styling; scripts, external connections, frames, forms and navigation targets are absent. No third-party page markup or resource URL is copied into it. Controlled DOM previews are also exercised by the automated browser checks.
## API
@@ -59,8 +59,8 @@ Images are independently validated and embedded in sandboxed, opaque-origin ifra
| GET | `/api/health` | Local API status |
| GET | `/api/scanning-capabilities` | Current scanning/capture flags and URL policy |
| POST | `/api/scan-public` | One `{ "url": "https://example.com/" }` request; real report and optional image preview |
-| POST | `/api/scan-fixture` | Scan a fixed built-in page |
-| POST | `/api/analyze` | Explicit illustrative example; never fetches its URL |
+| POST | `/api/scan-fixture` | Scan a fixed fixture for controlled checks |
+| POST | `/api/analyze` | Return an illustrative report without fetching the URL |
For successful scans, KindPath labels clearly identifiable browser verification and sign-in screens in the report and preview. The API and JSON download include an optional `pageNotice` code and a plain-language limitation. Detection uses the rendered page and can miss unfamiliar screens. Findings and previews describe the page KindPath received.
diff --git a/scripts/preview-browser.mjs b/scripts/preview-browser.mjs
index 7a34891..104c047 100644
--- a/scripts/preview-browser.mjs
+++ b/scripts/preview-browser.mjs
@@ -58,15 +58,14 @@ try {
}
const page = await browser.newPage({ viewport: { width: 1280, height: 900 }, serviceWorkers: 'block', acceptDownloads: true });
page.setDefaultTimeout(10000);
- let previews = 0; const unexpected = [];
- let activeReport = data.report;
+ const unexpected = [];
let apiRequests = 0;
- let publicCapabilities = false, publicCalls = 0, captureCapabilities = false;
+ let publicCapabilities = true, publicCalls = 0, captureCapabilities = false;
const publicReport = { ...data.report, mode: 'public', scanId:data.sitePreview.scanId, requestedUrl: 'https://example.com/start', url: 'https://www.example.com/en/start?locale=en',
coverage: {blockedRequests:2,failedRequests:3,omittedRules:1,omittedNodes:4},
scanner: { ...data.report.scanner, fixture: 'public' }, limitations: ['Controlled URL-report UI response; no public site fetched.'] };
let publicResponse = publicReport, publicStatus = 200;
- let demoFailure = false; const demoRequests = [];
+ let publicResponseOverride;
let delayCapabilities=false,capabilitiesHeld=false,releaseCapabilities;
let delayPublic = false, releasePublic, publicHeld = false, notifyPublic;
async function assertDownload(expected, coverage = expected.mode === 'public' ? expected.coverage : undefined) {
@@ -91,7 +90,7 @@ try {
assert.deepEqual(exported.report.scanner, expected.scanner);
assert.deepEqual(exported.report.manualChecks, expected.manualChecks);
for (const limitation of expected.limitations ?? []) assert.ok(exported.report.limitations.includes(limitation));
- assert.equal(exported.source.label, expected.mode === 'demo' ? 'Illustrative report' : expected.mode === 'fixture' ? 'Real fixture scan' : 'Automated page scan');
+ assert.equal(exported.source.label, 'Automated page scan');
assert.ok(exported.report.limitations.some(text => text.includes('do not establish accessibility conformance')));
assert.equal('html' in exported.report, false);
assert.equal('sitePreview' in exported.report, false); assert.equal('scanId' in exported.report, false);
@@ -134,12 +133,6 @@ try {
assert.equal(await printed.isVisible(), false);
return pdf?.toString('base64') ?? null;
}
- let delayScan = false, releaseScan, scanHeld = false;
- let fixtureResponseOverride;
- let delayPreview = false, releasePreview, previewHeld = false;
- let wrongPreview = false;
- const capturedFixtures = [];
- const snapshots = new Map([['garden', data.snapshot], ['barriers', data.barriersSnapshot], ['clear', data.clearSnapshot]]);
await page.route('**/*', async route => {
const url = new URL(route.request().url());
// WebKit routes revoked Blob fetches through this handler; let the browser resolve its own local Blob store.
@@ -147,39 +140,16 @@ try {
if (url.pathname.startsWith('/api/')) apiRequests++;
if (url.hostname !== 'kindpath-ui.invalid') { unexpected.push(url.hostname); await route.abort(); return; }
if (url.pathname === '/api/scanning-capabilities') { if(delayCapabilities){capabilitiesHeld=true;await new Promise(resolve=>releaseCapabilities=resolve);} await route.fulfill({ json: { publicScanningEnabled: publicCapabilities, publicCaptureEnabled: captureCapabilities, urlPolicy: 'public-http-https' } }); return; }
- if (url.pathname === '/api/analyze') {
- demoRequests.push(route.request().postDataJSON());
- await route.fulfill(demoFailure?{status:503,json:{error:'Controlled failure'}}:{json:data.demoReport});return;
- }
if (url.pathname === '/api/scan-public') {
publicCalls++;
assert.deepEqual(route.request().postDataJSON(), { url: publicReport.requestedUrl });
- const response = publicResponse, status = publicStatus, delayed = delayPublic;
+ const response = publicResponseOverride ?? { status: publicStatus, json: publicResponse };
+ const delayed = delayPublic;
if (delayed) { publicHeld = true; notifyPublic?.(); await new Promise(resolve => { releasePublic = resolve; }); }
- try { await route.fulfill({ status, json: response }); } catch (error) { if (!delayed) throw error; }
- return;
- }
- if (url.pathname === '/api/scan-fixture') {
- assert.ok(['barriers', 'clear'].includes(route.request().postDataJSON().fixture));
- const response = fixtureResponseOverride ?? { json: activeReport };
- const delayed = delayScan;
- if (delayed) { scanHeld = true; await new Promise(resolve => { releaseScan = resolve; }); }
- try { await route.fulfill(response); } catch (error) { if (!delayed) throw error; } // The delayed request is deliberately cancelled below.
- return;
- }
- if (url.pathname === '/api/preview-fixture') {
- previews++;
- const { fixture } = route.request().postDataJSON();
- assert.deepEqual(Object.keys(route.request().postDataJSON()), ['fixture']);
- assert.ok(snapshots.has(fixture)); capturedFixtures.push(fixture);
- const snapshot = wrongPreview ? data.clearSnapshot : snapshots.get(fixture);
- wrongPreview = false;
- const delayed = delayPreview;
- if (delayed) { previewHeld = true; await new Promise(resolve => { releasePreview = resolve; }); }
- await new Promise(done => setTimeout(done, 300));
- try { await route.fulfill(previews === 1 ? { status: 503, json: { error: 'Fixture preview is temporarily unavailable. Try again.' } } : { json: snapshot }); } catch (error) { if (!delayed) throw error; }
+ try { await route.fulfill(response); } catch (error) { if (!delayed) throw error; }
return;
}
+ if (url.pathname.startsWith('/api/')) unexpected.push(url.pathname);
const asset = data.assets[url.pathname];
await route.fulfill(asset ? { body: asset.body, contentType: asset.type } : { status: 404, body: '' });
});
@@ -188,23 +158,61 @@ try {
assert.equal(await websiteEntry.getAttribute('type'),'text');
assert.equal(await websiteEntry.getAttribute('inputmode'),'url');
assert.match(await websiteEntry.getAttribute('aria-describedby'),/website-entry-note/);
- await page.getByText('Enter a website address. HTTPS is added if you leave it out.',{exact:true}).waitFor();
- demoFailure=true;
- await websiteEntry.fill(' Example.com ');await page.getByRole('button',{name:'Just exploring? Try an example',exact:true}).click();
- await page.getByRole('alert').waitFor();
- assert.equal(await websiteEntry.inputValue(),'https://example.com/');
- assert.deepEqual(demoRequests.at(-1),{url:'https://example.com/'});
- demoFailure=false;
- const demoRetry=page.getByRole('button',{name:'Try again',exact:true});
- assert.equal(await demoRetry.evaluate(node=>node===document.activeElement),true);
- await demoRetry.click();
- await page.getByRole('region',{name:'Example issues to explore',exact:true}).waitFor();
- assert.deepEqual(demoRequests.slice(-2),[{url:'https://example.com/'},{url:'https://example.com/'}]);
- assert.equal(publicCalls,0,'Disabled mode must not submit a public scan');
- const demosBeforeDisabled=demoRequests.length;
- await websiteEntry.fill('example.com');await websiteEntry.press('Enter');
+ await page.getByText('One public page per scan. HTTPS is added if you leave it out.', {exact:true}).waitFor();
+ assert.equal(await page.getByText(/How it works|Local Preview|Design mockups|Try an example|Scan built-in page/i).count(), 0);
+ await page.getByRole('button', {name:'Scan website',exact:true}).waitFor();
+ await page.getByRole('link', {name:'Skip to content',exact:true}).focus();
+ await page.keyboard.press('Enter');
+ assert.equal(await page.evaluate(() => document.activeElement?.id), 'main');
+ await page.keyboard.press('Tab');
+ assert.equal(await websiteEntry.evaluate(node => node === document.activeElement), true);
+ await websiteEntry.blur();
+ const landing = page.locator('.hero');
+ const panes = landing.locator('.landing-comparison-page');
+ assert.equal(await panes.count(), 2);
+ const filterId = await panes.nth(1).locator('filter').getAttribute('id');
+ assert.equal(await panes.nth(0).locator('filter').count(), 0);
+ assert.equal(await panes.nth(1).locator('svg > g').getAttribute('filter'), `url(#${filterId})`);
+ assert.equal(await panes.nth(1).locator('feColorMatrix').count(), 1);
+ assert.equal(await panes.nth(1).locator('feGaussianBlur').count(), 1);
+ const landingImages = {};
+ for (const [size, width, height] of [['desktop', 1200, 720], ['mobile', 390, 740]]) {
+ await page.setViewportSize({width, height});
+ const [left, right] = await panes.evaluateAll(nodes => nodes.map(node => node.getBoundingClientRect().toJSON()));
+ const form = await landing.locator('form').boundingBox();
+ assert.equal(left.top, right.top);
+ assert.ok(left.right < right.left);
+ if (size === 'mobile') assert.ok(left.top > form.y + form.height);
+ else {
+ const heading = await landing.getByRole('heading', {level:1}).boundingBox();
+ const instructions = await landing.getByText('Scan a public webpage', {exact:false}).boundingBox();
+ const comparison = await landing.locator('figure').boundingBox();
+ const footer = await page.getByRole('contentinfo').boundingBox();
+ assert.ok(comparison.y >= heading.y + heading.height);
+ assert.ok(comparison.y + comparison.height <= instructions.y);
+ assert.ok(instructions.y + instructions.height <= form.y);
+ assert.ok(footer.height <= 38, 'The desktop footer must remain a compact row');
+ assert.ok(footer.y + footer.height <= height, 'The compact landing page must fit the desktop viewport');
+ }
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
+ landingImages[size] = (await page.screenshot({fullPage:true})).toString('base64');
+ }
+ for (const width of [760, 761]) {
+ await page.setViewportSize({width,height:800});
+ const comparison = await landing.locator('figure').boundingBox();
+ const form = await landing.locator('form').boundingBox();
+ assert.equal(comparison.y < form.y, width > 760);
+ }
+ await page.setViewportSize({width:320,height:740});
+ assert.ok(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth));
+ assert.ok((await landing.getByRole('button', {name:'Scan website',exact:true}).boundingBox()).height >= 44);
+ await page.setViewportSize({width:1280,height:900});
+ publicCapabilities = false;
+ await page.reload();
+ await page.getByRole('button', {name:'Scan website',exact:true}).waitFor();
+ await websiteEntry.fill('example.com'); await websiteEntry.press('Enter');
await page.getByRole('alert').filter({hasText:'Website scanning is unavailable'}).waitFor();
- assert.equal(demoRequests.length,demosBeforeDisabled,'Normal URL submission must never become demo findings');
+ assert.equal(publicCalls, 0);
for(const entry of ['javascript:alert(1)','https:/example.com','https:///example.com','user@example.com','https://user:pass@example.com']) {
const before=apiRequests;await websiteEntry.fill(entry);await websiteEntry.press('Enter');
await page.getByRole('alert').waitFor();assert.equal(apiRequests,before);
@@ -213,343 +221,6 @@ try {
await websiteEntry.fill('');
await page.getByRole('button',{name:'Scan website',exact:true}).click();
assert.equal(await websiteEntry.evaluate(node=>node.validity.valueMissing),true);
- await page.getByRole('button', { name: 'Scan built-in page' }).click();
- // First exercise the actual bounded report returned by the fixture scanner.
- const violations = page.getByRole('region', { name: 'Confirmed automated violations', exact: true });
- await violations.waitFor();
- assert.equal(await violations.locator('article').count(), data.report.findings.length);
- const firstWithElements = data.report.findings.find(finding => finding.elements.length > 0);
- if (firstWithElements) {
- const card = violations.locator('article').filter({ has: page.getByRole('heading', { name: firstWithElements.title, exact: true }) });
- await card.locator('summary').click();
- assert.equal(await card.locator('.element-target code').first().textContent(), firstWithElements.elements[0].targets.join(' → ') || 'Page (no selector provided)');
- assert.equal(await card.locator('.element-summary').first().textContent(), firstWithElements.elements[0].guidance);
- }
- await page.getByRole('button', { name: 'Just exploring? Try an example', exact: true }).click();
- await page.getByRole('region', { name: 'Example issues to explore', exact: true }).waitFor();
- await page.getByRole('button', { name: /Visual preview/ }).click();
- assert.equal(await page.locator('iframe').count(), 0);
- await page.getByRole('button', { name: 'Generate fixture snapshot' }).click();
- await page.getByRole('button', { name: 'Generating snapshot…' }).waitFor();
- await page.getByRole('alert').filter({ hasText: 'temporarily unavailable' }).waitFor();
- await page.getByRole('button', { name: 'Generate fixture snapshot' }).click();
- const original = page.frameLocator('iframe').first();
- await original.locator('.cta').waitFor();
- assert.equal(await page.locator('iframe').count(), 2);
- for (const frame of await page.locator('iframe').all()) assert.equal(await frame.getAttribute('sandbox'), '');
- assert.equal(await page.evaluate(() => document.querySelector('iframe').contentDocument), null);
- assert.equal(await original.locator('script, form, [href], [src], [onclick]').count(), 0);
- assert.equal(await original.locator('input').isDisabled(), true);
- assert.equal(await original.locator('button').isDisabled(), true);
- assert.equal(await original.locator('html').getAttribute('lang'), 'en');
- const before = await original.locator('.cta').evaluate(element => getComputedStyle(element).backgroundColor);
- await original.locator('.cta').hover(); await page.waitForTimeout(200);
- assert.notEqual(await original.locator('.cta').evaluate(element => getComputedStyle(element).backgroundColor), before);
- const addresses = page.frames().map(frame => frame.url());
- await original.locator('.cta').click();
- assert.deepEqual(page.frames().map(frame => frame.url()), addresses);
- assert.equal(page.context().pages().length, 1);
- await original.locator('.ad').scrollIntoViewIfNeeded(); assert.equal(await original.locator('.ad').isVisible(), true);
- const modified = page.locator('iframe').nth(1);
- const slider = name => page.getByRole('slider', { name, exact: true });
- const names = ['Colour strength', 'Contrast reduction', 'Blur strength', 'Peripheral restriction'];
- assert.equal(await page.getByRole('slider').count(), 4);
- assert.equal(await slider('Colour strength').inputValue(), '100');
- for (const name of names.slice(1)) assert.equal(await slider(name).inputValue(), '0');
- const modifiedBody = page.frameLocator('iframe').nth(1).locator('body');
- const matrix = page.frameLocator('iframe').nth(1).locator('feColorMatrix');
- const waitForModifiedDocument=async()=>{
- const source=await modified.getAttribute('srcdoc');
- const expectedFilter=source.match(/
{const element=document.createElement('div');element.style.filter=value;return element.style.filter;},expectedFilter);
- let last;
- const expectedMatrix=source.match(/({filter:body.style.filter,matrix:body.ownerDocument.querySelector('feColorMatrix')?.getAttribute('values')??null}));
- last=actual;
- if(actual.filter===normalizedFilter&&actual.matrix===expectedMatrix)return actual.filter;
- }catch{/* A preset replaces srcdoc; wait for the new opaque document. */}
- await page.waitForTimeout(20);
- }
- throw new Error('The modified preview did not finish loading its current effects: '+JSON.stringify({expected:normalizedFilter,expectedMatrix,actual:last}));
- };
- const matrixValues=async()=>{await waitForModifiedDocument();return matrix.getAttribute('values');};
-
- const presets = page.getByRole('group', {name:'Vision presets',exact:true});
- const selectedPreset = () => presets.getByRole('button', {pressed:true});
- const presetCases = [
- ['Original',[0,0,0,0]], ['Protanopia',[100,0,0,0]],
- ['Deuteranopia',[100,0,0,0]], ['Tritanopia',[100,0,0,0]], ['Blurred vision',[0,0,50,0]],
- ['Reduced peripheral vision',[0,0,0,65]],
- ];
- assert.equal(await presets.getByRole('button').count(),6);
- assert.equal(await selectedPreset().innerText(),'Deuteranopia');
- const callsBeforePresets = apiRequests;
- const frameAddressesBeforePresets = page.frames().map(frame=>frame.url());
- for (const [name,strengths] of presetCases) {
- const button = presets.getByRole('button',{name,exact:true});
- await button.focus(); await button.press('Enter');
- assert.equal(await button.evaluate(element=>element===document.activeElement),true);
- assert.equal(await selectedPreset().count(),1);assert.equal(await selectedPreset().innerText(),name);
- for (let index=0;indexelement.style.filter),'');
- if(name==='Original') {
- assert.equal(await waitForModifiedDocument(),'');assert.equal(await page.locator('.field-mask').count(),0);
- } else if(name==='Blurred vision') {
- assert.equal(await waitForModifiedDocument(),'blur(2px)');assert.equal(await page.locator('.field-mask').count(),0);
- } else if(name==='Reduced peripheral vision') {
- assert.equal(await waitForModifiedDocument(),'');assert.equal(await page.locator('.field-mask').evaluate(element=>element.style.opacity),'0.65');
- } else {
- assert.match(await waitForModifiedDocument(),/url\(/);
- assert.equal(await page.getByLabel('Colour preset',{exact:true}).inputValue(),name.toLowerCase());
- }
- }
- await page.getByRole('button',{name:'Apply visual effects',exact:true}).press('Space');
- assert.equal(await selectedPreset().count(),0);assert.equal(await page.locator('.field-mask').count(),0);
- await presets.getByRole('button',{name:'Blurred vision',exact:true}).press('Space');
- assert.equal(await selectedPreset().innerText(),'Blurred vision');assert.equal(await waitForModifiedDocument(),'blur(2px)');
- await slider('Blur strength').press('ArrowRight');
- assert.equal(await selectedPreset().count(),0);
- await page.getByText('Custom visual settings are applied to the modified snapshot only.',{exact:true}).waitFor();
- assert.equal(apiRequests,callsBeforePresets,'Preset changes must not fetch or recapture a page');
- assert.deepEqual(page.frames().map(frame=>frame.url()),frameAddressesBeforePresets);
- await page.getByRole('button',{name:'Reset effects',exact:true}).press('Enter');
- assert.equal(await selectedPreset().innerText(),'Deuteranopia');
- await slider('Colour strength').press('ArrowLeft');
- assert.equal(await slider('Colour strength').inputValue(), '99');
- assert.equal((await matrixValues()).split(' ')[0], '0.369885');
- assert.equal(await selectedPreset().count(),0);
- await slider('Colour strength').press('End');
- const deuteranopia = await matrixValues();
- await page.getByLabel('Colour preset', { exact: true }).selectOption('tritanopia');
- assert.notEqual(await matrixValues(), deuteranopia);
- await page.getByLabel('Colour preset', { exact: true }).selectOption('grayscale');
- await slider('Colour strength').press('End');
- const gray = (await matrixValues()).split(' ').map(Number);
- assert.deepEqual(gray.slice(0,3), gray.slice(5,8)); assert.deepEqual(gray.slice(0,3), gray.slice(10,13));
- await slider('Blur strength').press('End');
- await slider('Contrast reduction').press('End');
- await slider('Peripheral restriction').press('End');
- assert.match(await waitForModifiedDocument(), /url\(["']?#vision-.*contrast\(.*blur\(4px\)/);
- assert.equal(await page.locator('.field-mask').evaluate(element => element.style.opacity), '1');
- assert.equal(await page.locator('iframe').first().evaluate(element => element.style.filter), '');
- const toggle = page.getByRole('button', { name: 'Apply visual effects', exact: true });
- await toggle.press('Space');
- assert.equal(await toggle.getAttribute('aria-pressed'), 'false');
- assert.equal(await waitForModifiedDocument(), '');
- assert.equal(await page.locator('.field-mask').count(), 0);
- for (const name of names) assert.equal(await slider(name).inputValue(), '100');
- await slider('Blur strength').press('Home'); await slider('Blur strength').press('ArrowRight');
- assert.equal(await slider('Blur strength').inputValue(), '1');
- assert.equal(await waitForModifiedDocument(), '');
- await toggle.press('Space');
- assert.match(await waitForModifiedDocument(), /blur\(0.04px\)/);
- for (const [name, value] of [['Mild',25], ['Moderate',50], ['Strong',80]]) {
- await page.getByRole('button', { name, exact: true }).press('Enter');
- for (const label of names) assert.equal(await slider(label).inputValue(), String(value));
- assert.equal(await page.getByRole('button', { name, exact: true }).getAttribute('aria-pressed'), 'true');
- assert.equal(await page.getByLabel('Colour preset', { exact: true }).inputValue(), 'grayscale');
- }
- await page.getByRole('button', { name: 'Reset effects' }).press('Enter');
- assert.equal(await page.getByLabel('Colour preset', { exact: true }).inputValue(), 'deuteranopia');
- assert.equal(await slider('Colour strength').inputValue(), '100');
- for (const name of names.slice(1)) assert.equal(await slider(name).inputValue(), '0');
- assert.equal(await toggle.getAttribute('aria-pressed'), 'true');
- for (const name of names) await slider(name).press('Home');
- assert.equal(await waitForModifiedDocument(), '');
- assert.equal(await page.locator('.field-mask').count(), 0);
- await page.getByText('All strengths are zero. Both snapshots show the original appearance.', { exact: true }).waitFor();
- const neutralPixels = await modified.screenshot();
- await slider('Blur strength').press('End');
- const blurPixels = await modified.screenshot();
- assert.notDeepEqual(blurPixels, neutralPixels, 'Blur must change rendered pixels, not just the style attribute');
- await slider('Colour strength').press('End');
- const combinedPixels = await modified.screenshot();
- assert.notDeepEqual(combinedPixels, neutralPixels, 'Combined colour and blur must change the rendered snapshot');
- assert.notDeepEqual(combinedPixels, blurPixels, 'Colour must still affect pixels when combined with blur');
-
- await page.getByRole('button', { name: 'Mild', exact: true }).click();
- await page.getByLabel('Colour preset', { exact: true }).selectOption('tritanopia');
- await page.getByRole('button', { name: /Accessibility findings/ }).click();
- await page.getByRole('button', { name: /Visual preview/ }).click();
- assert.equal(previews, 2, 'Tab switches must retain the snapshot');
- assert.equal(await page.getByLabel('Colour preset', { exact: true }).inputValue(), 'tritanopia');
- for (const name of names) assert.equal(await slider(name).inputValue(), '25');
- await page.getByRole('button', { name: 'Refresh fixture snapshot' }).click();
- await page.getByRole('button', { name: 'Refresh fixture snapshot' }).waitFor();
- assert.equal(previews, 3);
- for (const name of names) assert.equal(await slider(name).inputValue(), '25');
- await page.setViewportSize({ width: 1280, height: 2200 });
- await page.locator('.results').scrollIntoViewIfNeeded();
- for (const frame of page.frames().slice(1)) await frame.evaluate(() => scrollTo(0, 0));
- const desktop = (await page.locator('.results').screenshot()).toString('base64');
- await page.setViewportSize({ width: 390, height: 844 });
- assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
- await page.locator('iframe').first().scrollIntoViewIfNeeded();
- await original.locator('.cta').scrollIntoViewIfNeeded();
- assert.equal(await original.locator('.cta').isVisible(), true);
- // Paint both opaque frames in-view before taking the complete narrow-layout figure.
- await page.setViewportSize({ width: 390, height: 3600 });
- await page.locator('.results').scrollIntoViewIfNeeded();
- for (const frame of page.frames().slice(1)) await frame.evaluate(() => scrollTo(0, 0));
- await page.evaluate(() => new Promise(done => requestAnimationFrame(() => requestAnimationFrame(done))));
- const mobile = (await page.locator('.results').screenshot()).toString('base64');
- // Controlled UI responses cover severity ordering and review/empty states without scanning a public URL.
- const makeFinding = (severity, index) => ({ id: `controlled-${index}`, severity,
- title: `${severity} controlled rule`, impact: 'Controlled explanation', elements: [
- { targets: ['#first'], guidance: 'Repair the first element' },
- { targets: ['#second', '#nested'], guidance: '\nRepair the second element' },
- ] });
- activeReport = { ...data.report, generatedAt: '2026-11-08T00:00:00.000Z', findings:
- ['Minor', 'Unknown', 'Moderate', 'Critical', 'Serious'].map(makeFinding),
- scanner: { ...data.report.scanner, incomplete: [{ ...makeFinding('Serious', 8), title: 'Controlled inconclusive check', elements: [] }] }, limitations: ['Controlled coverage limitation'] };
- await page.getByRole('button', { name: 'Scan built-in page' }).click();
- const filter = page.getByLabel('Filter violations by severity', { exact: true });
- await violations.getByRole('heading', { name: 'Critical controlled rule', exact: true }).waitFor();
- // Keep named role queries in Playwright's utility world: Firefox 159 crashes when
- // aria-labelledby reflection crosses worlds (microsoft/playwright#43967).
- assert.deepEqual(await Promise.all((await violations.getByRole('heading', { level: 4 }).all()).map(heading => heading.textContent())),
- ['Critical', 'Serious', 'Moderate', 'Minor', 'Unknown'].map(level => `${level} controlled rule`));
- const reviews = page.getByRole('region', { name: 'Checks needing manual review (1)', exact: true });
- await reviews.getByText('Controlled inconclusive check', { exact: true }).waitFor();
- for (const item of await page.getByRole('list', { name: 'Violation counts by severity' }).getByRole('listitem').all()) {
- assert.equal(await item.locator('strong').textContent(), '1');
- }
- // Report completion schedules focus in requestAnimationFrame; observe it before sending keys.
- await page.waitForFunction(() => document.activeElement?.matches('.results'));
- await filter.focus(); await filter.press('Home'); await filter.press('ArrowDown');
- assert.equal(await filter.inputValue(), 'Critical');
- assert.equal(await violations.locator('article').count(), 1);
- assert.equal(await reviews.locator('article').count(), 1);
- assert.equal(await page.locator('.finding-status').textContent(), 'Showing 1 of 5 rules with violations.');
- const exportedUrl = await assertDownload(activeReport);
- await page.evaluate(() => { window.__kindpathPrintCalls = 0; window.print = () => { window.__kindpathPrintCalls++; }; });
- await page.getByRole('button', { name: 'Print / save as PDF', exact: true }).press('Enter');
- assert.equal(await page.evaluate(() => window.__kindpathPrintCalls), 1);
- const fixturePdf = await printablePdf(activeReport);
- assert.equal(await filter.inputValue(), 'Critical', 'Printing does not change the on-screen filter');
- await page.getByRole('button', { name: /Visual preview/ }).click();
- await page.getByRole('button', { name: /Accessibility findings/ }).click();
- assert.equal(await filter.inputValue(), 'Critical', 'Tab switches retain the severity filter');
- await page.getByRole('button', { name: 'Clear severity filter' }).press('Enter');
- assert.equal(await filter.evaluate(element => element === document.activeElement), true);
- assert.equal(await violations.locator('article').count(), 5);
- const firstCard = violations.locator('article').first();
- await firstCard.locator('summary').press('Enter');
- assert.deepEqual(await Promise.all((await firstCard.locator('.element-target code').all()).map(target => target.textContent())), ['#first', '#second → #nested']);
- assert.equal(await firstCard.locator('.element-summary').nth(1).textContent(), '\nRepair the second element');
- assert.equal(await firstCard.locator('img').count(), 0, 'Guidance must be displayed as text');
- await reviews.locator('summary').click();
- await reviews.getByText('No element details were returned. Review this rule manually.', { exact: true }).waitFor();
- await page.setViewportSize({ width: 1280, height: 1800 });
- const findingsDesktop = (await page.locator('.results').screenshot()).toString('base64');
- await page.setViewportSize({ width: 390, height: 844 });
- assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
- const findingsMobile = (await page.locator('.results').screenshot()).toString('base64');
- // A new report resets filters; a severity with no matches differs from an empty report.
- await filter.selectOption('Minor');
- activeReport = { ...activeReport, generatedAt: '2026-11-08T00:00:01.000Z', findings: [makeFinding('Serious', 0)] };
- await page.getByRole('button', { name: 'Scan built-in page' }).click();
- await page.getByRole('heading', { name: 'Serious controlled rule', exact: true }).waitFor();
- assert.equal(await page.evaluate(async url => { try { await fetch(url); return false; } catch { return true; } }, exportedUrl), true, 'The old export Blob URL must be revoked');
- assert.equal(await filter.inputValue(), 'All');
- await filter.selectOption('Critical');
- await page.getByText('No violations match this severity. Other findings are still in this report.', { exact: true }).waitFor();
- assert.equal(await reviews.locator('article').count(), 1);
- await page.getByLabel('Built-in page', { exact: true }).selectOption('clear');
- activeReport = { ...data.clearReport, generatedAt: '2026-11-08T00:00:02.000Z' };
- await page.getByRole('button', { name: 'Scan built-in page' }).click();
- await page.getByText('No automated violations were reported. This does not establish accessibility conformance; review the checks below and test manually.', { exact: true }).waitFor();
- assert.equal(await filter.inputValue(), 'All');
- if (!data.clearReport.scanner.incomplete.length) await page.getByText('No inconclusive checks were returned. Keyboard, screen reader, and usability review are still needed.', { exact: true }).waitFor();
- await assertDownload(activeReport);
- await page.getByRole('button', { name: 'Just exploring? Try an example', exact: true }).click();
- const examples = page.getByRole('region', { name: 'Example issues to explore', exact: true });
- await examples.waitFor();
- assert.equal(await examples.locator('article').count(), 3);
- assert.equal(await page.getByRole('region', { name: /Checks needing manual review/ }).count(), 0);
- await page.getByText('Illustrative report', { exact: true }).waitFor();
- await examples.locator('article').first().locator('summary').click();
- assert.equal(await examples.locator('article').first().locator('.element-summary').textContent(), data.demoReport.findings[0].elements[0].guidance);
- // Match real scanning fixtures to their own previews and discard old work on selection changes.
- const fixtureChoice = page.getByLabel('Built-in page', { exact: true });
- const scanButton = page.getByRole('button', { name: 'Scan built-in page', exact: true });
- const results = page.locator('.results');
- await fixtureChoice.selectOption('barriers');
- assert.equal(await results.count(), 0);
- activeReport = data.report;
- await scanButton.click(); await violations.waitFor();
- await page.getByText('Scanned fixture: Garden form with barriers', { exact: true }).waitFor();
- await page.getByRole('button', { name: /Visual preview/ }).click();
- assert.equal(await page.locator('iframe').count(), 0, 'The previous demo snapshot must not appear for a scanned page');
- wrongPreview = true;
- await page.getByRole('button', { name: 'Generate fixture snapshot', exact: true }).click();
- await page.getByRole('alert').filter({ hasText: 'preview response was invalid' }).waitFor();
- assert.equal(await page.locator('iframe').count(), 0);
- await page.getByRole('button', { name: 'Generate fixture snapshot', exact: true }).click();
- await page.getByRole('button', { name: 'Refresh fixture snapshot', exact: true }).waitFor();
- assert.equal(capturedFixtures.at(-1), 'barriers');
- await page.getByRole('heading', { name: 'Built-in Garden form with barriers snapshot', exact: true }).waitFor();
- assert.equal(await page.locator('iframe').first().getAttribute('title'), 'Original Garden form with barriers fixture snapshot');
- assert.equal(await page.frameLocator('iframe').first().locator('.kindpath-image-placeholder').count(), 1);
- for (const frame of await page.locator('iframe').all()) assert.equal(await frame.getAttribute('sandbox'), '');
- assert.equal(await page.evaluate(() => document.querySelector('iframe').contentDocument), null);
- assert.equal(await page.frameLocator('iframe').first().locator('input').isDisabled(), true);
- assert.equal(await page.frameLocator('iframe').first().locator('button').isDisabled(), true);
- await page.setViewportSize({ width: 1280, height: 2200 });
- await results.scrollIntoViewIfNeeded();
- const matchingDesktop = (await results.screenshot()).toString('base64');
- await page.emulateMedia({ media: 'print' });
- assert.equal(await page.locator('.print-report').isVisible(), true);
- for (const frame of await page.locator('iframe').all()) assert.equal(await frame.isVisible(), false, 'Loaded preview frames must not appear in print');
- await page.emulateMedia({ media: 'screen' });
-
- await page.setViewportSize({ width: 390, height: 844 });
- assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
- await page.setViewportSize({ width: 390, height: 3600 });
- await results.scrollIntoViewIfNeeded();
- const matchingMobile = (await results.screenshot()).toString('base64');
- delayPreview = true;
- const heldPreviewRequest = page.waitForRequest(request => request.url().endsWith('/api/preview-fixture'));
- await page.getByRole('button', { name: 'Refresh fixture snapshot', exact: true }).click(); await heldPreviewRequest;
- assert.equal(previewHeld, true);
- await fixtureChoice.selectOption('clear');
- assert.equal(await results.count(), 0);
- assert.equal(await page.locator('iframe').count(), 0);
- delayPreview = false; releasePreview();
- activeReport = data.clearReport;
- await scanButton.click();
- await page.getByText('Scanned fixture: Labelled garden form', { exact: true }).waitFor();
- await page.getByRole('button', { name: /Visual preview/ }).click();
- assert.equal(await page.locator('iframe').count(), 0);
- await page.getByRole('button', { name: 'Generate fixture snapshot', exact: true }).click();
- await page.getByRole('button', { name: 'Refresh fixture snapshot', exact: true }).waitFor();
- assert.equal(capturedFixtures.at(-1), 'clear');
- assert.equal(await page.locator('iframe').first().getAttribute('title'), 'Original Labelled garden form fixture snapshot');
- await page.frameLocator('iframe').first().getByText('Email address', { exact: true }).waitFor();
- assert.equal(await page.frameLocator('iframe').first().locator('.kindpath-image-placeholder').count(), 0);
- // A delayed scan response for clear must not replace a newly selected barriers page.
- delayScan = true;
- const heldScanRequest = page.waitForRequest(request => request.url().endsWith('/api/scan-fixture'));
- await scanButton.click(); await heldScanRequest;
- assert.equal(scanHeld, true);
- assert.equal(await results.count(), 0, 'Starting another scan clears its old report and snapshot');
- await fixtureChoice.selectOption('barriers');
- delayScan = false; releaseScan();
- activeReport = data.clearReport; // Deliberate mismatched response.
- await scanButton.click();
- await page.getByRole('alert').filter({ hasText: 'report did not match' }).waitFor();
- assert.equal(await results.count(), 0);
- activeReport = data.report;
- await scanButton.click(); await violations.waitFor();
- assert.equal(await page.locator('iframe').count(), 0);
- await page.getByText('Scanned fixture: Garden form with barriers', { exact: true }).waitFor();
- await page.getByRole('button', { name: 'Just exploring? Try an example', exact: true }).click();
- await page.getByRole('region', { name: 'Example issues to explore', exact: true }).waitFor();
- await page.waitForFunction(() => document.activeElement?.matches('.results'));
- await assertDownload(data.demoReport);
- const demoPdf = await printablePdf(data.demoReport);
// Mock capability/HTTP responses inside network-none only. The actual app/API gates stay disabled.
publicCapabilities = true;delayCapabilities=true;
await page.reload();
@@ -607,15 +278,12 @@ try {
await printablePdf(publicResponse);
}
publicResponse=publicReport;
+ await publicButton.click();
+ await page.locator('.results').waitFor();
await page.getByRole('button', { name: /Visual preview/ }).click();
assert.equal(await page.locator('iframe').count(), 0);
- await page.getByText('This built-in illustration is separate from the website report. Public websites are not captured.', { exact: true }).waitFor();
- // Example exploration must remain a demo even when URL scanning is available.
- const scansBeforeExample = publicCalls;
- await page.getByRole('button', { name: 'Just exploring? Try an example', exact: true }).click();
- await page.getByRole('region', { name: 'Example issues to explore', exact: true }).waitFor();
- assert.equal(publicCalls, scansBeforeExample);
- assert.equal(await page.locator('.results .scan-coverage').count(),0,'Demo reports do not inherit public coverage');
+ await page.getByText('Website image capture is disabled. Your accessibility report and JSON download are still available.', {exact:true}).waitFor();
+ await assertDownload(publicResponse);
await page.getByLabel('Your website URL').fill(publicReport.requestedUrl);
for(const scanId of [undefined,'old']){
publicResponse={...publicReport,scanId};await publicButton.click();
@@ -630,7 +298,7 @@ try {
{ ...publicReport, url: 'http://example.com/start' },
{ ...publicReport, url: 'http://printer.local/' },
{ ...publicReport, url: 'https://user:pass@example.org/' },
- { ...publicReport, url: 'https://example.org:8443/' }, data.demoReport]) {
+ { ...publicReport, url: 'https://example.org:8443/' }, { ...publicReport, mode: 'demo' }]) {
publicResponse = wrong;
await publicButton.click();
await page.getByRole('alert').filter({ hasText: 'report did not match' }).waitFor();
@@ -669,20 +337,6 @@ try {
assert.deepEqual((await retryRequest).postDataJSON(), { url: publicReport.requestedUrl });
await page.locator('.results').waitFor();
assert.equal(await scanRetry.count(), 0);
- delayPublic = true;
- const publicStarted = new Promise(resolve => { notifyPublic = resolve; });
- await publicButton.click();
- await page.waitForFunction(() => document.querySelector('form').getAttribute('aria-busy') === 'true');
- let heldTimer;
- try { await Promise.race([publicStarted, new Promise((_, reject) => { heldTimer = setTimeout(() => reject(new Error('Controlled URL request was not intercepted')), 10000); })]); }
- finally { clearTimeout(heldTimer); }
- assert.equal(publicHeld, true);
- await page.getByLabel('Built-in page').selectOption('clear');
- activeReport = data.clearReport;
- delayPublic = false; releasePublic();
- await page.getByRole('button', { name: 'Scan built-in page' }).click();
- await page.getByText('Scanned fixture: Labelled garden form', { exact: true }).waitFor();
- assert.equal(await page.locator('.results').getByText('Scanned page: ' + publicReport.url, { exact: true }).count(), 0);
// The capture-enabled test response still never fetches an external page or enables the real API.
captureCapabilities = true;
publicResponse = { ...publicReport, scanId:data.sitePreview.scanId, sitePreview:data.sitePreview };
@@ -760,6 +414,23 @@ try {
assert.equal(await frame.locator('script,form,iframe,a[href]').count(),0);
assert.equal(await frame.locator('body').evaluate(()=>{try{void parent.document;return false;}catch{return true;}}),true);
}
+ const slider = name => page.getByRole('slider', { name, exact: true });
+ const waitForModifiedDocument=async()=>{
+ const source=await page.locator('iframe').nth(1).getAttribute('srcdoc');
+ const expectedFilter=source.match(/{const element=document.createElement('div');element.style.filter=value;return element.style.filter;},expectedFilter);
+ let last;
+ const expectedMatrix=source.match(/({filter:body.style.filter,matrix:body.ownerDocument.querySelector('feColorMatrix')?.getAttribute('values')??null}));
+ last=actual;
+ if(actual.filter===normalizedFilter&&actual.matrix===expectedMatrix)return actual.filter;
+ }catch{/* A preset replaces srcdoc; wait for the new opaque document. */}
+ await page.waitForTimeout(20);
+ }
+ throw new Error('The modified preview did not finish loading its current effects: '+JSON.stringify({expected:normalizedFilter,expectedMatrix,actual:last}));
+ };
const imageOriginalStyle=await imageFrames.first().getAttribute('style');
for(const name of ['Original','Protanopia','Deuteranopia','Tritanopia','Blurred vision','Reduced peripheral vision']){
await page.getByRole('group',{name:'Vision presets',exact:true}).getByRole('button',{name,exact:true}).click();
@@ -885,38 +556,102 @@ try {
assert.equal(await page.getByRole('region',{name:'Confirmed automated violations',exact:true}).locator('article').count(),publicReport.findings.length);
await page.getByRole('link',{name:'Download report JSON',exact:true}).waitFor();
}
- // Cancellation and retry preserve the selected action and reject late responses.
- publicCapabilities=false; captureCapabilities=false;
- await page.reload();
- activeReport=data.clearReport; delayScan=true; scanHeld=false;
- const heldCancellation=page.waitForRequest(request=>request.url().endsWith('/api/scan-fixture'));
- await page.getByRole('button',{name:'Scan built-in page',exact:true}).click(); await heldCancellation;
- assert.equal(await page.getByLabel('Your website URL').isDisabled(),true);
- await page.getByRole('button',{name:'Cancel request',exact:true}).click();
- await page.getByRole('status').filter({hasText:'Request cancelled'}).waitFor();
- assert.equal(await page.locator('.results').count(),0);
- assert.equal(await page.getByRole('button',{name:'Try again',exact:true}).evaluate(node=>node===document.activeElement),true);
- delayScan=false; activeReport=data.report; releaseScan();
- // Malformed proxy/error bodies must not become UI diagnostics, and a failed retry keeps usable focus.
- const retryButton=page.getByRole('button',{name:'Try again',exact:true});
- for (const response of [
- {status:503,contentType:'text/html',body:'private-response-marker: invalid response'},
- {json:null},
- ]) {
- fixtureResponseOverride=response;
- await retryButton.click();
- await page.getByRole('alert').filter({hasText: response.status ? 'The response could not be read.' : 'The report did not match the requested scan.'}).waitFor();
- assert.equal(await page.locator('.results').count(),0);
- assert.equal(await page.getByText(/private-response-marker/).count(),0);
- assert.equal(await retryButton.evaluate(node=>node===document.activeElement),true);
+ // Controlled UI responses cover severity ordering and review/empty states without scanning a public URL.
+ const violations = page.getByRole('region', { name: 'Confirmed automated violations', exact: true });
+ const makeFinding = (severity, index) => ({ id: `controlled-${index}`, severity,
+ title: `${severity} controlled rule`, impact: 'Controlled explanation', elements: [
+ { targets: ['#first'], guidance: 'Repair the first element' },
+ { targets: ['#second', '#nested'], guidance: '\nRepair the second element' },
+ ] });
+ publicResponse = { ...publicReport, previewUnavailable: true, generatedAt: '2026-11-08T00:00:00.000Z', findings:
+ ['Minor', 'Unknown', 'Moderate', 'Critical', 'Serious'].map(makeFinding),
+ scanner: { ...publicReport.scanner, incomplete: [{ ...makeFinding('Serious', 8), title: 'Controlled inconclusive check', elements: [] }] }, limitations: ['Controlled coverage limitation'] };
+ await publicButton.click();
+ const filter = page.getByLabel('Filter violations by severity', { exact: true });
+ await violations.getByRole('heading', { name: 'Critical controlled rule', exact: true }).waitFor();
+ // Keep named role queries in Playwright's utility world: Firefox 159 crashes when
+ // aria-labelledby reflection crosses worlds (microsoft/playwright#43967).
+ assert.deepEqual(await Promise.all((await violations.getByRole('heading', { level: 4 }).all()).map(heading => heading.textContent())),
+ ['Critical', 'Serious', 'Moderate', 'Minor', 'Unknown'].map(level => `${level} controlled rule`));
+ const reviews = page.getByRole('region', { name: 'Checks needing manual review (1)', exact: true });
+ await reviews.getByText('Controlled inconclusive check', { exact: true }).waitFor();
+ for (const item of await page.getByRole('list', { name: 'Violation counts by severity' }).getByRole('listitem').all()) {
+ assert.equal(await item.locator('strong').textContent(), '1');
}
- fixtureResponseOverride=undefined;
- await retryButton.click();
- await page.getByText('Scanned fixture: Garden form with barriers',{exact:true}).waitFor();
- assert.equal(await page.getByText('Scanned fixture: Labelled garden form',{exact:true}).count(),0);
+ // Report completion schedules focus in requestAnimationFrame; observe it before sending keys.
+ await page.waitForFunction(() => document.activeElement?.matches('.results'));
+ await filter.focus(); await filter.press('Home'); await filter.press('ArrowDown');
+ assert.equal(await filter.inputValue(), 'Critical');
+ assert.equal(await violations.locator('article').count(), 1);
+ assert.equal(await reviews.locator('article').count(), 1);
+ assert.equal(await page.locator('.finding-status').textContent(), 'Showing 1 of 5 rules with violations.');
+ const exportedUrl = await assertDownload(publicResponse);
+ await page.evaluate(() => { window.__kindpathPrintCalls = 0; window.print = () => { window.__kindpathPrintCalls++; }; });
+ await page.getByRole('button', { name: 'Print / save as PDF', exact: true }).press('Enter');
+ assert.equal(await page.evaluate(() => window.__kindpathPrintCalls), 1);
+ const reportPdf = await printablePdf(publicResponse);
+ assert.equal(await filter.inputValue(), 'Critical', 'Printing does not change the on-screen filter');
+ await page.getByRole('button', { name: /Visual preview/ }).click();
+ await page.getByRole('button', { name: /Accessibility findings/ }).click();
+ assert.equal(await filter.inputValue(), 'Critical', 'Tab switches retain the severity filter');
+ await page.getByRole('button', { name: 'Clear severity filter' }).press('Enter');
+ assert.equal(await filter.evaluate(element => element === document.activeElement), true);
+ assert.equal(await violations.locator('article').count(), 5);
+ const firstCard = violations.locator('article').first();
+ await firstCard.locator('summary').press('Enter');
+ assert.deepEqual(await Promise.all((await firstCard.locator('.element-target code').all()).map(target => target.textContent())), ['#first', '#second → #nested']);
+ assert.equal(await firstCard.locator('.element-summary').nth(1).textContent(), '\nRepair the second element');
+ assert.equal(await firstCard.locator('img').count(), 0, 'Guidance must be displayed as text');
+ await reviews.locator('summary').click();
+ await reviews.getByText('No element details were returned. Review this rule manually.', { exact: true }).waitFor();
+ await page.setViewportSize({ width: 1280, height: 1800 });
+ const findingsDesktop = (await page.locator('.results').screenshot()).toString('base64');
+ await page.setViewportSize({ width: 390, height: 844 });
+ assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
+ const findingsMobile = (await page.locator('.results').screenshot()).toString('base64');
+ // A new report resets filters; a severity with no matches differs from an empty report.
+ await filter.selectOption('Minor');
+ publicResponse = { ...publicResponse, generatedAt: '2026-11-08T00:00:01.000Z', findings: [makeFinding('Serious', 0)] };
+ await publicButton.click();
+ await page.getByRole('heading', { name: 'Serious controlled rule', exact: true }).waitFor();
+ assert.equal(await page.evaluate(async url => { try { await fetch(url); return false; } catch { return true; } }, exportedUrl), true, 'The old export Blob URL must be revoked');
+ assert.equal(await filter.inputValue(), 'All');
+ await filter.selectOption('Critical');
+ await page.getByText('No violations match this severity. Other findings are still in this report.', { exact: true }).waitFor();
+ assert.equal(await reviews.locator('article').count(), 1);
+ publicResponse = { ...publicReport, previewUnavailable: true, findings: [], scanner: {...publicReport.scanner, incomplete: []}, generatedAt: '2026-11-08T00:00:02.000Z' };
+ await publicButton.click();
+ await page.getByText('No automated violations were reported. This does not establish accessibility conformance; review the checks below and test manually.', { exact: true }).waitFor();
+ assert.equal(await filter.inputValue(), 'All');
+ await page.getByText('No inconclusive checks were returned. Keyboard, screen reader, and usability review are still needed.', { exact: true }).waitFor();
+ await assertDownload(publicResponse);
+ // Cancel a held URL scan and retry without accepting its late response.
+ publicResponse = {...publicReport, previewUnavailable: true, generatedAt: '2026-11-08T01:00:00.000Z'};
+ delayPublic = true;
+ const heldCancellation = new Promise(resolve => { notifyPublic = resolve; });
+ await publicButton.click();
+ await heldCancellation;
+ assert.equal(publicHeld, true);
+ assert.equal(await websiteEntry.isDisabled(), true);
+ await page.getByRole('button', {name:'Cancel request',exact:true}).click();
+ await page.getByRole('status').filter({hasText:'Request cancelled'}).waitFor();
+ assert.equal(await page.locator('.results').count(), 0);
+ assert.equal(await scanRetry.evaluate(node => node === document.activeElement), true);
+ delayPublic = false;
+ releasePublic();
+ publicResponseOverride = {status:503,contentType:'text/html',body:'private-response-marker: invalid response'};
+ await scanRetry.click();
+ await page.getByRole('alert').filter({hasText:'The response could not be read.'}).waitFor();
+ assert.equal(await page.locator('.results').count(), 0);
+ assert.equal(await page.getByText(/private-response-marker/).count(), 0);
+ assert.equal(await scanRetry.evaluate(node => node === document.activeElement), true);
+ publicResponseOverride = undefined;
+ await scanRetry.click();
+ await page.locator('.results').waitFor();
+ await assertDownload(publicResponse);
// Editing a URL clears the prior report instead of showing it under a new address.
await page.getByLabel('Your website URL').fill('https://example.com/new-request');
assert.equal(await page.locator('.results').count(),0);
assert.deepEqual(unexpected, []);
- process.stdout.write(JSON.stringify({ passed: true, engine, version: browser.version(), desktop, mobile, findingsDesktop, findingsMobile, matchingDesktop, matchingMobile, coverageDesktop, coverageMobile, qualityEmpty, qualitySparse, fixturePdf, demoPdf }));
+ process.stdout.write(JSON.stringify({ passed: true, engine, version: browser.version(), landingDesktop: landingImages.desktop, landingMobile: landingImages.mobile, findingsDesktop, findingsMobile, coverageDesktop, coverageMobile, qualityEmpty, qualitySparse, reportPdf }));
} finally { await browser.close(); }
diff --git a/server/preview.integration.ts b/server/preview.integration.ts
index bc4f754..ff2d50f 100644
--- a/server/preview.integration.ts
+++ b/server/preview.integration.ts
@@ -6,21 +6,14 @@ import { homedir, tmpdir } from 'node:os';
import { join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { randomUUID } from 'node:crypto';
-import { captureFixturePreview } from './scanner/fixturePreview.js';
import { scanFixture } from './scanner/fixtureScanner.js';
import { mapSitePreview } from './scanner/sitePreview.js';
-import { createDemoReport } from './services/analyze.js';
import { openLocalDockerSession, removeAndConfirm } from './scanner/dockerWorker.js';
import { assertContainerIsolation, containerArguments, IMAGE, QA_IMAGE } from './scanner/containerPolicy.js';
// Fulfill the app's requests from the built assets and real fixture responses, entirely inside network none.
test('reports, exports and isolated previews work in Chromium, Firefox and WebKit', { timeout: 240000 }, async () => {
- const snapshot = await captureFixturePreview();
- const barriersSnapshot = await captureFixturePreview('barriers');
- const clearSnapshot = await captureFixturePreview('clear');
const report = await scanFixture('barriers');
- const clearReport = await scanFixture('clear');
- const demoReport = createDemoReport(new URL('https://example.com'));
const sitePreview = mapSitePreview({url:'https://www.example.com/en/start?locale=en',capturedAt:new Date().toISOString(),omittedSubtrees:0,omittedText:0,omittedStyles:0,nodes:[
{tag:'h1',attributes:{},style:{},hover:{},children:[{text:'Captured website marker'}]},
{tag:'a',attributes:{},style:{color:'rgb(0, 0, 0)'},hover:{color:'rgb(255, 0, 0)'},children:[{text:'Captured link'}]},
@@ -72,14 +65,14 @@ test('reports, exports and isolated previews work in Chromium, Firefox and WebKi
{ env: { PATH: '/usr/bin:/bin', LANG: 'C.UTF-8' }, timeout: 90000, maxBuffer: 5 * 1024 * 1024 },
(error, output) => error ? reject(error) : resolve(output));
child.stdin!.on('error', () => {});
- child.stdin!.end(JSON.stringify({ browser, snapshot, barriersSnapshot, clearSnapshot, report, clearReport, demoReport, sitePreview, imagePreview, qualityPreviews, assets }));
+ child.stdin!.end(JSON.stringify({ browser, report, sitePreview, imagePreview, qualityPreviews, assets }));
});
const result = JSON.parse(stdout); assert.equal(result.passed, true); assert.equal(result.engine, browser);
console.info(`${browser} ${result.version}: controlled browser checks passed`);
- for (const kind of browser === 'chromium' ? ['fixture', 'demo'] : []) {
- await writeFile(join(outputRoot, `kindpath-report-export-${kind}.pdf`), Buffer.from(result[`${kind}Pdf`], 'base64'));
+ if (browser === 'chromium') {
+ await writeFile(join(outputRoot, 'kindpath-report-export-public.pdf'), Buffer.from(result.reportPdf, 'base64'));
}
- for (const size of ['desktop', 'mobile', 'findingsDesktop', 'findingsMobile', 'matchingDesktop', 'matchingMobile', 'coverageDesktop', 'coverageMobile', 'qualityEmpty', 'qualitySparse']) {
+ for (const size of ['landingDesktop', 'landingMobile', 'findingsDesktop', 'findingsMobile', 'coverageDesktop', 'coverageMobile', 'qualityEmpty', 'qualitySparse']) {
await writeFile(join(outputRoot, `kindpath-${browser}-static-preview-${size}.png`), Buffer.from(result[size], 'base64'));
}
} finally {
diff --git a/src/App.tsx b/src/App.tsx
index ffeaa3f..ae1fac2 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -2,8 +2,6 @@ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
import type { FormEvent } from 'react';
import { navigationRejection } from '../scanner/gateway/navigation.mjs';
import { websiteUrl } from '../scanner/gateway/url.mjs';
-import { fixtureTitle, isFixture } from '../shared/fixtures';
-import type { FixtureId } from '../shared/fixtures';
import { scanPageNoticeText } from '../shared/scanPageNotice';
import type { Report } from '../shared/types';
import { normalizeWebsiteEntry } from './components/websiteEntry';
@@ -14,16 +12,13 @@ import { ReportExports } from './components/ReportExports';
import { ScanCoverageNotice } from './components/ScanCoverageNotice';
import { PrintableReport } from './components/PrintableReport';
import { FindingsReport } from './components/FindingsReport';
+import { LandingComparison } from './components/LandingComparison';
import { SiteVisualPreview } from './components/SiteVisualPreview';
import { hasMatchingCaptureResult } from './components/sitePreview';
-import { VisualPreview } from './components/VisualPreview';
-import { SampleSite } from './components/SampleSite';
-type AnalysisMode = 'demo' | 'fixture' | 'public';
export function App() {
const [url, setUrl] = useState('');
- const [selectedFixture, setSelectedFixture] = useState('barriers');
const [capabilitiesReady,setCapabilitiesReady]=useState(false);
const [publicEnabled, setPublicEnabled] = useState(false);
const [publicCaptureEnabled,setPublicCaptureEnabled] = useState(false);
@@ -43,7 +38,7 @@ export function App() {
}, []);
const [report, setReport] = useState(null);
const [busy, setBusy] = useState(false);
- const [lastAttempt,setLastAttempt] = useState<{value:string;mode:AnalysisMode}|null>(null);
+ const [lastAttempt,setLastAttempt] = useState(null);
const [cancelled,setCancelled] = useState(false);
const [failure, setFailure] = useState(null);
const [view, setView] = useState<'findings' | 'preview'>('findings');
@@ -65,30 +60,20 @@ export function App() {
function changeUrl(value: string) {
setUrl(value); setReport(null); setFailure(null); setCancelled(false); setLastAttempt(null); setView('findings');
}
- function changeFixture(fixture: FixtureId) {
- if (!isFixture(fixture) || fixture === selectedFixture) return;
- analysisRequest.current?.abort(); analysisRequest.current = null;
- setSelectedFixture(fixture); setReport(null); setFailure(null); setBusy(false); setView('findings');
- setLastAttempt(null); setCancelled(false);
- }
- async function analyze(value: string, mode: AnalysisMode = 'public') {
- if (analysisRequest.current || (mode==='public'&&!capabilitiesReady)) return;
- const abort = new AbortController(); analysisRequest.current = abort;
+ async function analyze(value: string) {
+ if (analysisRequest.current || !capabilitiesReady) return;
+ const abort = new AbortController();
+ analysisRequest.current = abort;
setBusy(true); setFailure(null); setReport(null); setView('findings'); setCancelled(false);
- setLastAttempt({value,mode});
- const fixture = mode === 'fixture';
+ setLastAttempt(value);
let timeout: AbortSignal | undefined;
try {
- if (!fixture) {
- value = normalizeWebsiteEntry(value);
- if (mode === 'public') value = websiteUrl(value).href;
- if (mode === 'demo') setUrl(value);
- setLastAttempt({value,mode});
- }
- if(mode==='public'&&!publicEnabled)throw new Error('Website scanning is unavailable. Start the local API or use the explicitly labelled example.');
- timeout = AbortSignal.timeout(mode === 'demo' ? 10000 : 90000);
- const response = await fetch(mode === 'fixture' ? '/api/scan-fixture' : mode === 'public' ? '/api/scan-public' : '/api/analyze', {
- method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(fixture ? { fixture: value } : { url: value }),
+ value = websiteUrl(normalizeWebsiteEntry(value)).href;
+ setLastAttempt(value);
+ if (!publicEnabled) throw new Error('Website scanning is unavailable.');
+ timeout = AbortSignal.timeout(90000);
+ const response = await fetch('/api/scan-public', {
+ method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: value }),
signal: AbortSignal.any([abort.signal, timeout]),
});
let data;
@@ -105,26 +90,21 @@ export function App() {
setFailure(scanFailureFeedback(data, response.status));
return;
}
- if (!data || typeof data !== 'object' || Array.isArray(data) || data.mode !== mode) {
+ if (!data || typeof data !== 'object' || Array.isArray(data) || data.mode !== 'public') {
throw new Error('The report did not match the requested scan.');
}
- if (mode === 'public') {
- let matches = false;
- try {
- // Bind the request and allow only the agreed single-page URL changes.
- const requested = websiteUrl(value), scanned = websiteUrl(data.url);
- matches = data.requestedUrl === requested.href && data.url === scanned.href
- && !navigationRejection(requested.href, scanned.href);
- } catch { /* Reject missing or malformed report URLs without displaying their contents. */ }
- if (!matches) throw new Error('The report did not match the requested website.');
- if (!hasMatchingCaptureResult(data,publicCaptureEnabled)) {
- throw new Error('The website snapshot did not match this scan.');
- }
- }
- if (fixture && (data.mode !== 'fixture' || data.scanner?.fixture !== value || data.url !== `fixture:${value}`)) {
- throw new Error('The report did not match the requested built-in page.');
+ let matches = false;
+ try {
+ // Bind the result to the submitted URL and the allowed single-page navigation.
+ const scanned = websiteUrl(data.url);
+ matches = data.requestedUrl === value && data.url === scanned.href
+ && !navigationRejection(value, scanned.href);
+ } catch { /* Reject malformed report URLs without displaying their contents. */ }
+ if (!matches) throw new Error('The report did not match the requested website.');
+ if (!hasMatchingCaptureResult(data, publicCaptureEnabled)) {
+ throw new Error('The website snapshot did not match this scan.');
}
- if (mode === 'public') setUrl(value);
+ setUrl(value);
setReport(data); setView('findings');
} catch (cause) {
if (abort.signal.aborted || analysisRequest.current !== abort) return;
@@ -135,7 +115,7 @@ export function App() {
} else {
setFailure({
message: cause instanceof Error ? cause.message : 'The scan could not finish. No report was created.',
- retryable: timeout !== undefined && mode !== 'public',
+ retryable: false,
});
}
} finally {
@@ -149,19 +129,50 @@ export function App() {
return <>
{report && }
Skip to content
- k↗KindPath{import.meta.env.DEV && LOCAL PREVIEW}
-
-
✳ A MORE INCLUSIVE INTERNET STARTS HERE
A clearer web. For everyone.
See your website from a different perspective. Find accessibility barriers, understand their impact, and take the next step toward a more welcoming web.
{report.mode === 'fixture' ? 'These are real automated results for the selected built-in page. The visual preview uses that same page. No public website was fetched.' : report.mode === 'demo' ? `This is demo data, not an assessment of ${new URL(report.url).hostname}.` : 'Automated results for the final scanned page only. Manual review is still required.'}{report.mode === 'demo' && !report.sitePreview && ' The visual preview uses a separate built-in fixture, not the submitted URL.'}
Automated results for the final scanned page only. Manual review is still required.
+ {pageNotice &&
{pageNotice}
}
+
+
+
+
+
+
+
+
+ {report.sitePreview ? :
+
+ {report.previewUnavailable ? 'The website image could not be captured.' : 'Website image capture is disabled.'} Your accessibility report and JSON download are still available.
+
;
-}
diff --git a/src/components/VisualPreview.tsx b/src/components/VisualPreview.tsx
deleted file mode 100644
index ba78734..0000000
--- a/src/components/VisualPreview.tsx
+++ /dev/null
@@ -1,59 +0,0 @@
-import { fixtureTitle } from '../../shared/fixtures';
-import type { PreviewFixtureId } from '../../shared/fixtures';
-import { useEffect, useRef, useState } from 'react';
-import type { FixturePreview } from '../../shared/types';
-import { SnapshotFrame } from './SnapshotFrame';
-import { defaultVisionSettings } from './visualEffects';
-import { VisionControls } from './VisionControls';
-
-export function VisualPreview({ fixture }: { fixture: PreviewFixtureId }) {
- const title = fixtureTitle(fixture);
- const [settings, setSettings] = useState(defaultVisionSettings);
- const [snapshot, setSnapshot] = useState(null);
- const [busy, setBusy] = useState(false);
- const [error, setError] = useState('');
- const request = useRef(null);
- useEffect(() => () => request.current?.abort(), []);
- async function generate() {
- if (request.current) return;
- const abort = new AbortController(); request.current = abort;
- setBusy(true); setError('');
- try {
- const response = await fetch('/api/preview-fixture', {
- method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ fixture }),
- signal: AbortSignal.any([abort.signal, AbortSignal.timeout(90000)]),
- });
- const data = await response.json();
- if (!response.ok) throw new Error(data.error || 'Unable to generate the fixture snapshot.');
- if (data.mode !== 'fixture' || data.fixture !== fixture || data.title !== title
- || typeof data.html !== 'string' || data.html.length > 100000 || typeof data.capturedAt !== 'string'
- || !Number.isFinite(Date.parse(data.capturedAt))) throw new Error('The preview response was invalid. Try generating it again.');
- if (!abort.signal.aborted) setSnapshot(data);
- } catch (cause) {
- if (!abort.signal.aborted) setError(cause instanceof Error && cause.name !== 'TimeoutError' ? cause.message : 'Snapshot generation timed out. Try again.');
- } finally {
- request.current = null;
- if (!abort.signal.aborted) setBusy(false);
- }
- }
- return
-
-
Built-in {title} snapshot
{fixture === 'garden' ? 'This built-in illustration is separate from the website report.' : 'This preview uses the same built-in page as the fixture findings above.'} Public websites are not captured.
- {snapshot &&
Captured at . Scroll within each preview to explore the whole page.
}
-
-
-
{busy ? 'Capturing the built-in fixture in the isolated worker…' : snapshot ? 'Fixture snapshot ready.' : ''}
{fixture === 'garden' ? 'Hover over “Explore the garden” to see its style change. The advertisement is a static placeholder. ' : ''}Links and form controls are inactive. Images, when present, are static placeholders.
- > :
A page you can explore without leaving KindPath.
Generate the built-in fixture snapshot to compare its appearance with a visual effect.
}
-
Educational approximations. Vision varies between people; these effects do not reproduce a medical condition or replace accessibility testing.
Scan this built-in page, then preview the same page. Changing the selection clears current results.{!publicScanningEnabled && ' Public URL scanning is disabled.'}