@capagents/forgeqe 3.1.9 → 3.2.0
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/HOW_TO_USE.md +18 -2
- package/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/docs-site/docs/area-quality/index.html +17 -3
- package/dist/docs-site/docs/area-setup/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1878 -1875
- package/dist/template.html +12 -12
- package/dist/vendor/ibm-ace.js +2 -0
- package/dist/web/assets/{3d-force-graph-CGHQthr3.js → 3d-force-graph-Bhmgjf_7.js} +1 -1
- package/dist/web/assets/Agent-Dx4aOB_h.js +8 -0
- package/dist/web/assets/{AgentWork-DEZVZTuJ.js → AgentWork-D0MS10up.js} +2 -2
- package/dist/web/assets/ApiTests-DUoEh0nX.js +10 -0
- package/dist/web/assets/Browse-BGgyLuL3.js +1 -0
- package/dist/web/assets/Chat-CEHUI2ty.js +3 -0
- package/dist/web/assets/{CommandPalette-sokhT5PA.js → CommandPalette-rY8rp79k.js} +1 -1
- package/dist/web/assets/{Compare-ChWSXkvf.js → Compare-B_NCvogR.js} +1 -1
- package/dist/web/assets/Cost-sm-6tWRQ.js +1 -0
- package/dist/web/assets/Data-CFyxbwPS.js +6 -0
- package/dist/web/assets/Desktop-A_D4LTis.js +1 -0
- package/dist/web/assets/DesktopReview-CM7xmpHS.js +2 -0
- package/dist/web/assets/Evidence-BlTkmzfE.js +1 -0
- package/dist/web/assets/Explore-DyGqAEff.js +2 -0
- package/dist/web/assets/Features-BjPR9gCe.js +1 -0
- package/dist/web/assets/Flags-C_DneXS9.js +2 -0
- package/dist/web/assets/Flaky-l5ugC_ER.js +1 -0
- package/dist/web/assets/Impact-7TXQHcsW.js +3 -0
- package/dist/web/assets/Jobs-xRLNI-8l.js +5 -0
- package/dist/web/assets/KindPage-BZu1Zo4S.js +6 -0
- package/dist/web/assets/Migration-DKsyDwDO.js +8 -0
- package/dist/web/assets/Observability-CVwKJ-fI.js +1 -0
- package/dist/web/assets/PageAgent-C1X5ot6v.js +1 -0
- package/dist/web/assets/Product-iHqLyIhD.js +12 -0
- package/dist/web/assets/Production-C8eGcwCi.js +1 -0
- package/dist/web/assets/Quality-BVsN6u0E.js +1 -0
- package/dist/web/assets/Readiness-BWlbiTeu.js +1 -0
- package/dist/web/assets/Record-C7qgNFqs.js +1 -0
- package/dist/web/assets/Regression-ChleHlqe.js +5 -0
- package/dist/web/assets/{RelationGraph-CeBfmWYf.js → RelationGraph-CzR_Hs8A.js} +1 -1
- package/dist/web/assets/Reports-CIcKyoHH.js +2 -0
- package/dist/web/assets/Response-D2ZeO8uW.js +9 -0
- package/dist/web/assets/Responsive-DCfw-Oz3.js +3 -0
- package/dist/web/assets/{RunDiff-T4e0xs_5.js → RunDiff-COaxhvKm.js} +1 -1
- package/dist/web/assets/Runs-3qx2qf56.js +2 -0
- package/dist/web/assets/Settings-DG2k3Lno.js +21 -0
- package/dist/web/assets/Steps-CN4n8U1I.js +3 -0
- package/dist/web/assets/TestCases-BEfJFp5h.js +1 -0
- package/dist/web/assets/TestData-SO2qqaAF.js +2 -0
- package/dist/web/assets/{TestDebt-WuBkOmz5.js → TestDebt-DIYhbhjh.js} +1 -1
- package/dist/web/assets/TestManagement-D7q6G3YN.js +4 -0
- package/dist/web/assets/WhatsNew-DqBLhhgk.js +1 -0
- package/dist/web/assets/{coverage-CWE1aatw.js → coverage-DCtiu73T.js} +4 -4
- package/dist/web/assets/{dataParts-ClIBv7-8.js → dataParts-BdmBLsU9.js} +3 -3
- package/dist/web/assets/{diff-CZ0iWWGv.js → diff-DEgLgw6R.js} +1 -1
- package/dist/web/assets/families-CrnKBjis.js +1 -0
- package/dist/web/assets/{highlight-CGRzYrMa.js → highlight-DSLpJ_Dq.js} +1 -1
- package/dist/web/assets/index-DAteDsgB.css +2 -0
- package/dist/web/assets/index-RJ1kEHuo.js +64 -0
- package/dist/web/assets/{input-1RVqxCVH.js → input-Be3YOEK2.js} +1 -1
- package/dist/web/assets/logLevel-Dq8s6DZz.js +3 -0
- package/dist/web/assets/palette-Dcoz5crU.js +1 -0
- package/dist/web/assets/{paletteCommands-DU0boMQR.js → paletteCommands-fwv5XVOS.js} +1 -1
- package/dist/web/assets/{parts-CTmOGb8E.js → parts-CkI14hIv.js} +1 -1
- package/dist/web/assets/productParts-BOUMBM_H.js +1 -0
- package/dist/web/assets/qualityParts-8KI3JCY8.js +1 -0
- package/dist/web/assets/{recordTest-H42EwQYC.js → recordTest-kf2ykEQF.js} +1 -1
- package/dist/web/assets/{route-Mq0QZuqV.js → route-D8G-pTdk.js} +1 -1
- package/dist/web/assets/{stepper-ceEfHcbV.js → stepper-CQSK6KS0.js} +1 -1
- package/dist/web/index.html +6 -6
- package/docs/user-guide.html +17 -3
- package/forgeqe.example.yaml +2 -1
- package/package.json +2 -1
- package/prompts/browser-persona.md +1 -1
- package/py/forgeqe_engine/diagnostics.py +119 -2
- package/py/forgeqe_engine/persona.py +3 -2
- package/py/forgeqe_engine/service.py +4 -1
- package/dist/web/assets/Agent-lzvUoYv1.js +0 -8
- package/dist/web/assets/ApiTests-k9bR9dXo.js +0 -10
- package/dist/web/assets/Browse-4bm1SVvY.js +0 -1
- package/dist/web/assets/Chat-CbyylnvP.js +0 -3
- package/dist/web/assets/Cost-DlZnyY_C.js +0 -1
- package/dist/web/assets/Data-CElI9cSA.js +0 -6
- package/dist/web/assets/Desktop-YtONOq0M.js +0 -1
- package/dist/web/assets/DesktopReview-CldegMwj.js +0 -2
- package/dist/web/assets/Evidence-B9wlQQy6.js +0 -1
- package/dist/web/assets/Explore-Cp3eqrm2.js +0 -2
- package/dist/web/assets/Features-ySmycsYI.js +0 -1
- package/dist/web/assets/Flags-CnjZtCU3.js +0 -2
- package/dist/web/assets/Flaky-D7VtH51H.js +0 -1
- package/dist/web/assets/Impact-Dx1cn9WD.js +0 -3
- package/dist/web/assets/Jobs-BwfvwxGd.js +0 -5
- package/dist/web/assets/KindPage-BHGa8zq7.js +0 -6
- package/dist/web/assets/Migration-f-gLkpSC.js +0 -4
- package/dist/web/assets/Observability-CibZbiOA.js +0 -1
- package/dist/web/assets/PageAgent-UTRXl1j4.js +0 -1
- package/dist/web/assets/Product-LJxwGFzs.js +0 -12
- package/dist/web/assets/Production-DXwaHzaa.js +0 -1
- package/dist/web/assets/Quality-Di4cF4nd.js +0 -1
- package/dist/web/assets/Readiness-Bu1OXgnc.js +0 -1
- package/dist/web/assets/Record-olwaN1G1.js +0 -1
- package/dist/web/assets/Regression-DBu-34b_.js +0 -5
- package/dist/web/assets/Reports-hoagfsmM.js +0 -2
- package/dist/web/assets/Response-CJSq1qN7.js +0 -9
- package/dist/web/assets/Responsive-DYhEQEpT.js +0 -3
- package/dist/web/assets/Runs-CcG9BELK.js +0 -2
- package/dist/web/assets/Settings-lWl74aQY.js +0 -21
- package/dist/web/assets/Steps-BefTJLTB.js +0 -3
- package/dist/web/assets/TestCases-CyzfvT_X.js +0 -1
- package/dist/web/assets/TestData-DSusRbgZ.js +0 -2
- package/dist/web/assets/TestManagement-HwkjrA4a.js +0 -4
- package/dist/web/assets/WhatsNew-B-w1pGj6.js +0 -1
- package/dist/web/assets/families-CfIM4f2s.js +0 -1
- package/dist/web/assets/index-Cg0SmlXN.js +0 -64
- package/dist/web/assets/index-tPgJ7dv2.css +0 -2
- package/dist/web/assets/logLevel-CFPS8IkY.js +0 -3
- package/dist/web/assets/palette-5nApQc76.js +0 -1
- package/dist/web/assets/productParts-CL2E8Uaf.js +0 -1
- package/dist/web/assets/qualityParts-CnlpML55.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e}from"./route-
|
|
1
|
+
import{O as e}from"./route-D8G-pTdk.js";import{t}from"./jsx-runtime-LKYXHABd.js";import{A as n}from"./input-Be3YOEK2.js";var r=t();function i({steps:t,at:i,reached:a,onGo:o,label:s=`Steps`}){return(0,r.jsx)(`nav`,{"aria-label":s,children:(0,r.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:t.map((s,c)=>{let l=c<=a,u=c===i,d=c<a&&!u;return(0,r.jsxs)(`li`,{className:n(`flex items-center gap-2`,c<t.length-1&&`flex-1`),children:[(0,r.jsxs)(`button`,{type:`button`,disabled:!l,"aria-current":u?`step`:void 0,onClick:()=>o(c),"aria-label":s.name,"data-tip":s.tip,className:n(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,l&&!u?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:n(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,d?`bg-pass text-white`:u?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:d?(0,r.jsx)(e,{size:13,strokeWidth:3}):c+1}),(0,r.jsx)(`span`,{className:n(u?`font-medium text-ink`:l?`text-ink-2`:`text-muted`,!u&&`hidden @xl:inline`),children:s.name})]}),c<t.length-1&&(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,r.jsx)(`span`,{className:n(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,c<a?`w-full`:`w-0`)})})]},s.name)})})})}export{i as t};
|
package/dist/web/index.html
CHANGED
|
@@ -7,15 +7,15 @@
|
|
|
7
7
|
<!-- Light and dark both: before the app has set its mode, the page is the computer's (src/index.css, :root). -->
|
|
8
8
|
<meta name="color-scheme" content="light dark" />
|
|
9
9
|
<title>ForgeQE</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-RJ1kEHuo.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="/assets/route-
|
|
12
|
+
<link rel="modulepreload" crossorigin href="/assets/route-D8G-pTdk.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/agents-BUWN-VJv.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-LKYXHABd.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/input-
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/logLevel-
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/assets/palette-
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/input-Be3YOEK2.js">
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/logLevel-Dq8s6DZz.js">
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/assets/palette-Dcoz5crU.js">
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DAteDsgB.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<div id="root"></div>
|
package/docs/user-guide.html
CHANGED
|
@@ -3623,7 +3623,7 @@ Signing in stays <code>/auth</code> and <code>forgeqe login</code>; <code>forgeq
|
|
|
3623
3623
|
<tr><td><code>forgeqe pr-tests [pr] [--base BRANCH] [--run] [--post]</code></td><td>The tests a pull request can break; <code>--run</code> makes it a CI gate (see <a href="#doc-how_to_use-tests-for-a-pull-request">Tests for a pull request</a>)</td></tr>
|
|
3624
3624
|
<tr><td><code>forgeqe impact <repo> <base> <head> | <repo> --pr LINK [--gate] [--post] [--json] [--quick]</code></td><td>What a change in a product repository reaches, and whether it is ready; <code>--gate</code> exits 1 when it is blocked</td></tr>
|
|
3625
3625
|
<tr><td><code>forgeqe report <file|folder>... [--title T] [--out DIR]</code>, <code>forgeqe report setup [--repo DIR]</code></td><td>report.html from JUnit XML or TRX run outside ForgeQE (see <a href="#doc-how_to_use-reports-for-tests-run-outside-forgeqe">Reports for tests run outside ForgeQE</a>)</td></tr>
|
|
3626
|
-
<tr><td><code>forgeqe a11y "<goal>" --persona a,b [--url URL]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
|
|
3626
|
+
<tr><td><code>forgeqe a11y "<goal>" --persona a,b [--url URL] [--engine E] [--standard S] [--best-practice]</code>, <code>forgeqe a11y personas</code></td><td>Accessibility testing as personas (see <a href="#doc-how_to_use-accessibility-testing-with-personas">Accessibility testing with personas</a>)</td></tr>
|
|
3627
3627
|
<tr><td><code>forgeqe persona [list] | show | create | export | import</code></td><td>Business personas (see <a href="#doc-how_to_use-business-personas">Business personas</a>)</td></tr>
|
|
3628
3628
|
<tr><td><code>forgeqe flags list [--env NAME]</code>, <code>forgeqe flags run <pack> <flag=v1,v2> --env NAME</code></td><td>A regression pack once per feature-flag combination (see <a href="#doc-how_to_use-feature-flag-matrix">Feature-flag matrix</a>)</td></tr>
|
|
3629
3629
|
<tr><td><code>forgeqe defects [--folder DIR]</code>, <code>forgeqe defects predict [--repo DIR] [--base REF] [--head REF]</code></td><td>Defect trends, and where a change is likely to cause defects</td></tr>
|
|
@@ -10311,6 +10311,7 @@ in <strong>Settings › Settings as text</strong>.</li>
|
|
|
10311
10311
|
accessibility:
|
|
10312
10312
|
standard: wcag21aa # wcag2a, wcag21aa (default), wcag22aa, wcag21aaa, section508, en301549, best-practice
|
|
10313
10313
|
best_practice: false # also the best-practice rules
|
|
10314
|
+
engine: axe # axe (axe-core, default), ibm (IBM Equal Access), basic (ForgeQE's own checks)
|
|
10314
10315
|
budgets:
|
|
10315
10316
|
accessibility: # most violations per page by impact; unset impacts have no limit (or: accessibility: true for 0 critical, 0 serious)
|
|
10316
10317
|
critical: 0
|
|
@@ -10324,6 +10325,13 @@ in <strong>Settings › Settings as text</strong>.</li>
|
|
|
10324
10325
|
pages: # by path prefix; the longest match wins
|
|
10325
10326
|
/search: { lcp_ms: 4000 }
|
|
10326
10327
|
</code></pre>
|
|
10328
|
+
<p><strong>Rule engine.</strong> <code>engine: ibm</code> checks each page with IBM Equal Access (accessibility-checker-engine, shipped with
|
|
10329
|
+
ForgeQE) instead of axe-core: the standard picks its ruleset (WCAG 2.0, 2.1 or 2.2 at A or AA; Section 508 as WCAG 2.0
|
|
10330
|
+
AA; EN 301 549 as WCAG 2.1 AA; best practice as IBM's own ruleset with its recommendations). IBM's rules stop at AA, so a
|
|
10331
|
+
<code>wcag21aaa</code> standard is checked at AA with it and the run says so. Impact comes from IBM's toolkit level (1 critical,
|
|
10332
|
+
2 serious, 3 moderate, 4 minor; a recommendation is minor), and rule ids are IBM's (<code>img_alt_valid</code>), so budgets'
|
|
10333
|
+
<code>rules</code> and <code>ignore</code> name IBM's ids when it is the engine. The two engines find different things: run both on a page
|
|
10334
|
+
that matters. The engine runs inside a function on the page, so a page's own <code>window.ace</code> (the Ace editor) is left alone.</p>
|
|
10327
10335
|
<p><strong>Over time.</strong> Every run adds each page's violations and timings to <code>.forgeqe/reports/quality-history.json</code> (keep it between CI runs as a cache). Ask "did accessibility regress?" or "is checkout getting slower?". The trends show each page's violations over the last runs, the rules that newly fail or were fixed since the previous run, and each timing against its usual value (the median of the last 10 runs; slower or faster only beyond noise).</p>
|
|
10328
10336
|
<p><strong>Web app</strong></p>
|
|
10329
10337
|
<ol>
|
|
@@ -10373,13 +10381,19 @@ forgeqe quality trends shop.test # per page over time; exits 1 when a page go
|
|
|
10373
10381
|
<p><strong>Web app</strong></p>
|
|
10374
10382
|
<ol>
|
|
10375
10383
|
<li>Open <strong>Accessibility</strong> (Quality Engineering › Specialised testing), on its <strong>Agent</strong> tab.</li>
|
|
10376
|
-
<li>Say what the person should try to do, and who tries it ("act as a blind person and use the website to find accessibility issues", "can a keyboard-only user check out?")
|
|
10377
|
-
|
|
10384
|
+
<li>Say what the person should try to do, and who tries it ("act as a blind person and use the website to find accessibility issues", "can a keyboard-only user check out?").
|
|
10385
|
+
Under the persona chips, <strong>Checked with</strong> picks this session's rule engine (axe-core, IBM Equal Access or the
|
|
10386
|
+
built-in checks) and standard; left on the project's, quality.accessibility decides.</li>
|
|
10387
|
+
<li>Agree to the plan the agent shows, which says the rule checks it will use. Each session's result is on the <strong>Results</strong> tab, and the personas on the <strong>Personas</strong> tab.</li>
|
|
10378
10388
|
</ol>
|
|
10379
10389
|
<p><strong>Terminal</strong></p>
|
|
10380
10390
|
<pre><code class="language-bash">forgeqe a11y "find running shoes and add a pair to the basket" --persona blind,keyboard-only --url https://shop.test
|
|
10391
|
+
forgeqe a11y "check out" --persona blind --engine ibm --standard wcag22aa --best-practice # this session's rule checks
|
|
10381
10392
|
forgeqe a11y personas # the personas: built in, and the project's own
|
|
10382
10393
|
</code></pre>
|
|
10394
|
+
<p><code>--engine</code> (axe, ibm, basic), <code>--standard</code> (wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549,
|
|
10395
|
+
best-practice) and <code>--best-practice</code> choose the session's automated rule checks over <code>quality.accessibility</code>; a value off
|
|
10396
|
+
its list is refused before anything runs. The report and the Results tab say which were used.</p>
|
|
10383
10397
|
<p><strong>How each persona uses the page.</strong> Each persona is one browser run. The agent works the way the person does:</p>
|
|
10384
10398
|
<div class="tbl"><table>
|
|
10385
10399
|
<thead>
|
package/forgeqe.example.yaml
CHANGED
|
@@ -610,11 +610,12 @@ suite:
|
|
|
610
610
|
# top_k: 5
|
|
611
611
|
# timeout_seconds: 20
|
|
612
612
|
|
|
613
|
-
# Accessibility (axe-core, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
|
|
613
|
+
# Accessibility (axe-core or IBM Equal Access, WCAG) and performance (Core Web Vitals) of every page a run visits. Without budgets they
|
|
614
614
|
# are reported and tracked over time; a run fails on them only when a budget below is exceeded.
|
|
615
615
|
# quality:
|
|
616
616
|
# accessibility:
|
|
617
617
|
# standard: wcag21aa # wcag2a, wcag21aa, wcag22aa, wcag21aaa, section508, en301549, best-practice
|
|
618
|
+
# engine: axe # axe (axe-core), ibm (IBM Equal Access: up to AA, no AAA rules), basic (ForgeQE's own)
|
|
618
619
|
# ask_before_run: true # false: a persona session runs its browser runs without asking first
|
|
619
620
|
# visual: # each page compared with its approved screenshot (.forgeqe/visual-baselines)
|
|
620
621
|
# mask: [".clock", "#ad-slot"] # hidden before capture
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "ForgeQE: a browser agent CLI that runs goals and test cases in local Chrome or Chromium, or BrowserStack and TestMu AI/LambdaTest when configured, and turns passing runs into tests in your repo",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"@types/pngjs": "^6.0.5",
|
|
95
95
|
"@types/react": "^19.3.0",
|
|
96
96
|
"@vscode/tree-sitter-wasm": "0.3.1",
|
|
97
|
+
"accessibility-checker-engine": "4.0.34",
|
|
97
98
|
"axe-core": "4.14.0",
|
|
98
99
|
"fast-xml-parser": "^5.11.1",
|
|
99
100
|
"neo4j-driver": "6.2.0",
|
|
@@ -11,4 +11,4 @@ This run is accessibility testing, not functional testing. You act as the person
|
|
|
11
11
|
- You MUST set `wcag` to the WCAG success criterion the barrier fails, such as 1.1.1 or 2.4.7, when one applies.
|
|
12
12
|
- You MUST set `severity`: critical when it stops the person from reaching the goal, serious when they get past it only with a lot of effort or help, moderate when it slows or confuses them, minor for an annoyance.
|
|
13
13
|
- When a barrier stops you, you MUST NOT go around it in a way this person could not, such as a mouse click for a keyboard user. Record it, then try another way this person has, such as another link or the browser's back.
|
|
14
|
-
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you.
|
|
14
|
+
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you. You MUST call done in a step of its own, with no other action: a done that follows another action in the same step, such as record_accessibility_issue, is not carried out. Record the last barrier, then call done in the next step.
|
|
@@ -203,6 +203,74 @@ AXE_RUN = r"""axe.run(document, {runOnly: {type: 'tag', values: %s}, resultTypes
|
|
|
203
203
|
examples: v.nodes.slice(0, 5).map((n) => ({html: (n.html || '').slice(0, 160), target: (n.target || []).join(' '), text: (n.failureSummary || '').slice(0, 300)}))}))
|
|
204
204
|
}))"""
|
|
205
205
|
|
|
206
|
+
# IBM Equal Access (accessibility-checker-engine's ace.js): the engine's source is evaluated inside a function, so its
|
|
207
|
+
# top-level `var ace` stays local: nothing is put on the page's window (a page's own `window.ace`, such as the Ace code
|
|
208
|
+
# editor, is left alone) and the page cannot hand ForgeQE a checker of its own. The rules kept are the ruleset's at the
|
|
209
|
+
# levels asked for (recommendations only when asked); results are made plain here, each rule with up to five elements.
|
|
210
|
+
IBM_RUN = r"""(async ({ruleset, levels, recommendations}) => {
|
|
211
|
+
const ace = (function () {
|
|
212
|
+
/*IBM_ENGINE_SOURCE*/
|
|
213
|
+
;return ace })();
|
|
214
|
+
const checker = new ace.Checker();
|
|
215
|
+
const guide = checker.getGuidelines().find((g) => g.id === ruleset);
|
|
216
|
+
if (!guide) return {error: 'no ruleset ' + ruleset};
|
|
217
|
+
const rules = {};
|
|
218
|
+
for (const cp of guide.checkpoints || []) {
|
|
219
|
+
const sc = /^\d+\.\d+\.\d+$/.test(cp.num || '');
|
|
220
|
+
if (sc ? !levels.includes(cp.wcagLevel) : !recommendations) continue;
|
|
221
|
+
for (const r of cp.rules || []) {
|
|
222
|
+
if (r.level !== 'VIOLATION' && !(recommendations && r.level === 'RECOMMENDATION')) continue;
|
|
223
|
+
const x = rules[r.id] || (rules[r.id] = {criteria: [], level: '', policy: r.level, toolkit: String(r.toolkitLevel || '')});
|
|
224
|
+
if (r.level === 'VIOLATION') x.policy = 'VIOLATION';
|
|
225
|
+
if (sc && !x.criteria.includes(cp.num)) x.criteria.push(cp.num);
|
|
226
|
+
if (sc && (!x.level || cp.wcagLevel.length < x.level.length)) x.level = cp.wcagLevel;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
const report = await checker.check(document, [ruleset]);
|
|
230
|
+
const by = {};
|
|
231
|
+
for (const r of report.results || []) {
|
|
232
|
+
if (!rules[r.ruleId] || !Array.isArray(r.value) || r.value[0] === 'INFORMATION') continue;
|
|
233
|
+
const e = by[r.ruleId] || (by[r.ruleId] = {fail: [], open: 0, pass: 0});
|
|
234
|
+
if (r.value[1] === 'PASS') e.pass++;
|
|
235
|
+
else if (r.value[1] === 'FAIL') e.fail.push(r);
|
|
236
|
+
else if (r.value[1] === 'POTENTIAL' || r.value[1] === 'MANUAL') e.open++;
|
|
237
|
+
}
|
|
238
|
+
const ids = Object.keys(by);
|
|
239
|
+
return {
|
|
240
|
+
passed: ids.filter((id) => by[id].pass && !by[id].fail.length),
|
|
241
|
+
incomplete: ids.filter((id) => by[id].open && !by[id].fail.length),
|
|
242
|
+
violations: ids.filter((id) => by[id].fail.length).map((id) => ({id, policy: rules[id].policy, toolkit: rules[id].toolkit,
|
|
243
|
+
criteria: rules[id].criteria, level: rules[id].level, count: by[id].fail.length, help: String(by[id].fail[0].message || '').slice(0, 300),
|
|
244
|
+
examples: by[id].fail.slice(0, 5).map((n) => ({html: String(n.snippet || '').slice(0, 160), target: String((n.path || {}).dom || ''), text: String(n.message || '').slice(0, 300)}))}))
|
|
245
|
+
};
|
|
246
|
+
})(%s)"""
|
|
247
|
+
|
|
248
|
+
IBM_RULESETS = ("WCAG_2_0", "WCAG_2_1", "WCAG_2_2", "IBM_Accessibility")
|
|
249
|
+
IBM_HELP = "https://able.ibm.com/rules/archives/latest/doc/en-US/{}.html"
|
|
250
|
+
IBM_RULE = re.compile(r"^[A-Za-z0-9_]{1,80}$")
|
|
251
|
+
IBM_SC = re.compile(r"^\d\.\d{1,2}\.\d{1,2}$")
|
|
252
|
+
# A violation's impact from IBM's toolkit level (1: the most essential); a recommendation is minor.
|
|
253
|
+
IBM_IMPACT = {"1": "critical", "2": "serious", "3": "moderate", "4": "minor"}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
def ibm_issue(v: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
257
|
+
"""One IBM rule's failures in accessibility.json's shape (as axe's), read as data; None for one not of its shape."""
|
|
258
|
+
rule = str(v.get("id") or "")
|
|
259
|
+
if not IBM_RULE.fullmatch(rule):
|
|
260
|
+
return None
|
|
261
|
+
criteria = [c for c in (v.get("criteria") or []) if isinstance(c, str) and IBM_SC.fullmatch(c)][:6]
|
|
262
|
+
level = str(v.get("level") or "")
|
|
263
|
+
impact = "minor" if v.get("policy") != "VIOLATION" else IBM_IMPACT.get(str(v.get("toolkit") or ""), "moderate")
|
|
264
|
+
examples = [
|
|
265
|
+
{"html": str(e.get("html") or "")[:160], "target": str(e.get("target") or "")[:300], "text": str(e.get("text") or "")[:300]}
|
|
266
|
+
for e in (v.get("examples") or [])[:5]
|
|
267
|
+
if isinstance(e, dict)
|
|
268
|
+
]
|
|
269
|
+
return {"rule": rule, "wcag": ", ".join(criteria), "level": level if level in ("A", "AA", "AAA") else "", "impact": impact,
|
|
270
|
+
"help": " ".join(str(v.get("help") or "").split())[:300], "helpUrl": IBM_HELP.format(rule),
|
|
271
|
+
"count": max(0, int(v.get("count") or 0)), "examples": examples}
|
|
272
|
+
|
|
273
|
+
|
|
206
274
|
WCAG_SC = re.compile(r"^wcag(\d)(\d)(\d{1,2})$")
|
|
207
275
|
WCAG_LEVEL = re.compile(r"^wcag2\d?(a{1,3})$")
|
|
208
276
|
|
|
@@ -277,7 +345,7 @@ def box_for(browser_state: Any, index: Any) -> Optional[Dict[str, float]]:
|
|
|
277
345
|
|
|
278
346
|
|
|
279
347
|
class Diagnostics:
|
|
280
|
-
def __init__(self, *, accessibility: bool = True, network: bool = True, axe: Optional[Dict[str, Any]] = None, vitals: bool = True, visual: Optional[Dict[str, Any]] = None, keep_headers: Optional[List[str]] = None) -> None:
|
|
348
|
+
def __init__(self, *, accessibility: bool = True, network: bool = True, axe: Optional[Dict[str, Any]] = None, vitals: bool = True, visual: Optional[Dict[str, Any]] = None, keep_headers: Optional[List[str]] = None, ibm: Optional[Dict[str, Any]] = None) -> None:
|
|
281
349
|
self.accessibility = accessibility
|
|
282
350
|
# axe-core: {"script": path to axe.min.js, "tags": ["wcag2a", "wcag2aa"]}; without it, the built-in checks.
|
|
283
351
|
self.axe_tags: List[str] = [str(t) for t in ((axe or {}).get("tags") or ["wcag2a", "wcag2aa"])]
|
|
@@ -287,12 +355,27 @@ class Diagnostics:
|
|
|
287
355
|
self._axe_source = Path(str(axe["script"])).read_text(encoding="utf-8")
|
|
288
356
|
except OSError:
|
|
289
357
|
logger.warning("axe-core not found at %s: using the built-in accessibility checks", axe.get("script"))
|
|
358
|
+
# IBM Equal Access: {"script": path to ace.js, "ruleset": "WCAG_2_1", "levels": ["A", "AA"], "recommendations":
|
|
359
|
+
# bool, "version": "4.0.34"}; it takes the place of axe-core when given and found.
|
|
360
|
+
self._ibm_source: Optional[str] = None
|
|
361
|
+
self.ibm: Dict[str, Any] = {}
|
|
362
|
+
if ibm and ibm.get("script"):
|
|
363
|
+
try:
|
|
364
|
+
self._ibm_source = Path(str(ibm["script"])).read_text(encoding="utf-8")
|
|
365
|
+
self.ibm = {
|
|
366
|
+
"ruleset": str(ibm.get("ruleset") or "WCAG_2_1") if str(ibm.get("ruleset") or "") in IBM_RULESETS else "WCAG_2_1",
|
|
367
|
+
"levels": [x for x in (ibm.get("levels") or ["A", "AA"]) if x in ("A", "AA")] or ["A", "AA"],
|
|
368
|
+
"recommendations": ibm.get("recommendations") is True,
|
|
369
|
+
"version": re.sub(r"[^0-9.]", "", str(ibm.get("version") or ""))[:20],
|
|
370
|
+
}
|
|
371
|
+
except OSError:
|
|
372
|
+
logger.warning("IBM Equal Access not found at %s: using %s", ibm.get("script"), "axe-core" if self._axe_source else "the built-in accessibility checks")
|
|
290
373
|
self.vitals = vitals
|
|
291
374
|
self.perf: Dict[str, Dict[str, Any]] = {}
|
|
292
375
|
# {"mask": [selectors], "pages": {"/path": [selectors]}, "full_page": bool}; None: no visual captures.
|
|
293
376
|
self.visual: Optional[Dict[str, Any]] = visual
|
|
294
377
|
self.shots: Dict[str, Dict[str, Any]] = {}
|
|
295
|
-
self.timeout = CHECK_TIMEOUT * (3 if self._axe_source else 1)
|
|
378
|
+
self.timeout = CHECK_TIMEOUT * (3 if self._axe_source or self._ibm_source else 1)
|
|
296
379
|
self.network: Optional[NetworkCapture] = NetworkCapture(keep_headers) if network else None
|
|
297
380
|
self._net_handlers: Dict[str, Any] = {}
|
|
298
381
|
self.events: List[Dict[str, Any]] = []
|
|
@@ -589,6 +672,21 @@ class Diagnostics:
|
|
|
589
672
|
logger.debug("axe-core did not run", exc_info=True)
|
|
590
673
|
return None
|
|
591
674
|
|
|
675
|
+
async def _ibm(self, session: Any) -> Optional[Dict[str, Any]]:
|
|
676
|
+
"""IBM Equal Access's results for the page, or None when it could not run (axe-core or the built-in checks run instead)."""
|
|
677
|
+
if not self._ibm_source:
|
|
678
|
+
return None
|
|
679
|
+
try:
|
|
680
|
+
# The arguments first, then the engine's source in its place: the source has % signs of its own.
|
|
681
|
+
args = {"ruleset": self.ibm["ruleset"], "levels": self.ibm["levels"], "recommendations": self.ibm["recommendations"]}
|
|
682
|
+
expr = (IBM_RUN % json.dumps(args)).replace("/*IBM_ENGINE_SOURCE*/", self._ibm_source, 1)
|
|
683
|
+
r = await session.cdp_client.send.Runtime.evaluate(params={"expression": expr, "returnByValue": True, "awaitPromise": True}, session_id=session.session_id)
|
|
684
|
+
value = ((r or {}).get("result") or {}).get("value")
|
|
685
|
+
return value if isinstance(value, dict) and isinstance(value.get("violations"), list) else None
|
|
686
|
+
except Exception:
|
|
687
|
+
logger.debug("IBM Equal Access did not run", exc_info=True)
|
|
688
|
+
return None
|
|
689
|
+
|
|
592
690
|
async def _check_page(self, browser: Any, session: Any) -> None:
|
|
593
691
|
try:
|
|
594
692
|
url = str(await browser.get_current_page_url() or "")
|
|
@@ -599,6 +697,25 @@ class Diagnostics:
|
|
|
599
697
|
return
|
|
600
698
|
send = session.cdp_client.send
|
|
601
699
|
order = {"critical": 0, "serious": 1, "moderate": 2, "minor": 3}
|
|
700
|
+
ibm = await self._ibm(session)
|
|
701
|
+
if ibm is not None:
|
|
702
|
+
title = ""
|
|
703
|
+
try:
|
|
704
|
+
title = str(await self._eval(session, "document.title") or "")
|
|
705
|
+
except Exception:
|
|
706
|
+
pass
|
|
707
|
+
found = [i for i in (ibm_issue(v) for v in ibm["violations"] if isinstance(v, dict)) if i]
|
|
708
|
+
plain = lambda xs: [x for x in (xs or []) if isinstance(x, str) and IBM_RULE.fullmatch(x)] # noqa: E731
|
|
709
|
+
self.pages[key] = {
|
|
710
|
+
"url": url,
|
|
711
|
+
"title": title,
|
|
712
|
+
"engine": f"IBM Equal Access {self.ibm['version']}".strip(),
|
|
713
|
+
"tags": [self.ibm["ruleset"], *self.ibm["levels"], *(["recommendations"] if self.ibm["recommendations"] else [])],
|
|
714
|
+
"passed": plain(ibm.get("passed")),
|
|
715
|
+
"incomplete": plain(ibm.get("incomplete")),
|
|
716
|
+
"issues": sorted(found, key=lambda i: (order.get(i["impact"], 9), -i["count"])),
|
|
717
|
+
}
|
|
718
|
+
return
|
|
602
719
|
axe = await self._axe(session)
|
|
603
720
|
if axe is not None:
|
|
604
721
|
issues_list = []
|
|
@@ -88,7 +88,7 @@ This run is accessibility testing, not functional testing. You act as the person
|
|
|
88
88
|
- You MUST set `wcag` to the WCAG success criterion the barrier fails, such as 1.1.1 or 2.4.7, when one applies.
|
|
89
89
|
- You MUST set `severity`: critical when it stops the person from reaching the goal, serious when they get past it only with a lot of effort or help, moderate when it slows or confuses them, minor for an annoyance.
|
|
90
90
|
- When a barrier stops you, you MUST NOT go around it in a way this person could not, such as a mouse click for a keyboard user. Record it, then try another way this person has, such as another link or the browser's back.
|
|
91
|
-
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you.
|
|
91
|
+
- You MUST finish with done. Start the text with "Goal reached: yes", "Goal reached: partly", or "Goal reached: no", then say in a few sentences how it went for this person. Use success=true when you reached the goal and success=false when a barrier stopped you. You MUST call done in a step of its own, with no other action: a done that follows another action in the same step, such as record_accessibility_issue, is not carried out. Record the last barrier, then call done in the next step.
|
|
92
92
|
""".strip()
|
|
93
93
|
|
|
94
94
|
SCREEN_READER_MESSAGE = """
|
|
@@ -381,7 +381,8 @@ def register_persona_tools(tools: Any, persona: Dict[str, Any], findings: List[D
|
|
|
381
381
|
pass
|
|
382
382
|
item = {"title": title, "what_happened": what, "expected": clip(expected, 400), "severity": sev, "wcag": criterion, "element": clip(element, 200), "url": url}
|
|
383
383
|
if any(f["title"].lower() == title.lower() and f["url"] == url for f in findings):
|
|
384
|
-
|
|
384
|
+
# The same barrier again is often a done that the library dropped for sharing a step with this record.
|
|
385
|
+
return ActionResult(extracted_content=f"Already recorded on this page: {title}. Record another barrier, go on, or, when you are finished, call done alone in a step of its own.")
|
|
385
386
|
findings.append(item)
|
|
386
387
|
save_findings(out_dir, persona, findings)
|
|
387
388
|
return ActionResult(extracted_content=f"Recorded barrier ({sev}{f', WCAG {criterion}' if criterion else ''}): {title}")
|
|
@@ -150,6 +150,8 @@ class RunRequest:
|
|
|
150
150
|
keep_headers: List[str] = field(default_factory=list)
|
|
151
151
|
# axe-core for the accessibility checks: {"script": path to axe.min.js, "tags": [...]}; empty: the built-in checks.
|
|
152
152
|
axe: Dict[str, Any] = field(default_factory=dict)
|
|
153
|
+
# IBM Equal Access instead of axe-core: {"script": path to ace.js, "ruleset", "levels", "recommendations", "version"}.
|
|
154
|
+
ibm: Dict[str, Any] = field(default_factory=dict)
|
|
153
155
|
# Core Web Vitals and load timings of each page (performance.json).
|
|
154
156
|
vitals: bool = True
|
|
155
157
|
# Screenshots of each page for visual comparison: {"mask": [...], "pages": {...}, "full_page": bool}; None: off.
|
|
@@ -189,6 +191,7 @@ class RunRequest:
|
|
|
189
191
|
keep_headers=[str(h) for h in (d.get("keep_headers") or [])[:20] if isinstance(h, str)] if isinstance(d.get("keep_headers"), list) else [],
|
|
190
192
|
prompts={str(k): str(v) for k, v in (d.get("prompts") or {}).items()} if isinstance(d.get("prompts"), dict) else {},
|
|
191
193
|
axe=dict(d["axe"]) if isinstance(d.get("axe"), dict) else {},
|
|
194
|
+
ibm=dict(d["ibm"]) if isinstance(d.get("ibm"), dict) else {},
|
|
192
195
|
vitals=d.get("vitals") is not False,
|
|
193
196
|
visual=dict(d["visual"]) if isinstance(d.get("visual"), dict) else None,
|
|
194
197
|
goal=str(d.get("goal") or ""),
|
|
@@ -1114,7 +1117,7 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1114
1117
|
)
|
|
1115
1118
|
_time_llm_calls(llm, llm_calls, lambda c: emit({"type": "call", **c}), failures=model_failures)
|
|
1116
1119
|
use_prompts(req.prompts)
|
|
1117
|
-
diag = Diagnostics(accessibility=req.accessibility, network=req.network, axe=req.axe or None, vitals=req.vitals, visual=req.visual, keep_headers=req.keep_headers)
|
|
1120
|
+
diag = Diagnostics(accessibility=req.accessibility, network=req.network, axe=req.axe or None, ibm=req.ibm or None, vitals=req.vitals, visual=req.visual, keep_headers=req.keep_headers)
|
|
1118
1121
|
|
|
1119
1122
|
browser_cfg = req.browser if isinstance(req.browser, dict) else {}
|
|
1120
1123
|
browser_provider = str(browser_cfg.get("provider") or "local")
|