@capagents/forgeqe 2.9.4 → 2.9.5
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 +6 -2
- package/dist/docs-site/docs/architecture/index.html +1 -1
- package/dist/docs-site/docs/index.html +7 -8
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +1652 -1644
- package/dist/web/assets/{Agent-djRg2i0o.js → Agent-BU8FKiQt.js} +1 -1
- package/dist/web/assets/{ApiTests-Becz5PP-.js → ApiTests-Bsv3NhD5.js} +1 -1
- package/dist/web/assets/{Browse-_TcGuZ8l.js → Browse-D-ho9bS_.js} +2 -2
- package/dist/web/assets/{Chat-VERzcB2r.js → Chat-czaM5kUi.js} +1 -1
- package/dist/web/assets/{CommandPalette-5QEcqEYi.js → CommandPalette-CrLuxoE5.js} +1 -1
- package/dist/web/assets/{Compare-Dl4z18KO.js → Compare-DfHMTNGi.js} +1 -1
- package/dist/web/assets/{Cost-B_i8IzAR.js → Cost-BYb3T8-c.js} +1 -1
- package/dist/web/assets/{Data-DKSQEWFO.js → Data-EF_k6c_T.js} +1 -1
- package/dist/web/assets/{Desktop-DkNohPJ7.js → Desktop-DY5Q1Sd3.js} +1 -1
- package/dist/web/assets/{DesktopReview-BUgkvk9D.js → DesktopReview-DFKpYor2.js} +1 -1
- package/dist/web/assets/{Evidence-Bmr0i0nA.js → Evidence-Db9H4-Nu.js} +1 -1
- package/dist/web/assets/{Explore-oz_P_CL1.js → Explore-B0EkFCFe.js} +1 -1
- package/dist/web/assets/{Features-CxcjdJkb.js → Features-8jsv2A1d.js} +1 -1
- package/dist/web/assets/{Flags-DF0H61Vl.js → Flags-DtzmOA5o.js} +1 -1
- package/dist/web/assets/{Flaky-DkjqrHrF.js → Flaky-BCzOx7Mq.js} +1 -1
- package/dist/web/assets/{Impact-DiTAOm8k.js → Impact-Da9L1tDd.js} +1 -1
- package/dist/web/assets/{Jobs-DR_mV4Mu.js → Jobs-CHw00lcx.js} +1 -1
- package/dist/web/assets/{KindPage-CLRfAada.js → KindPage-DiOmtzVZ.js} +1 -1
- package/dist/web/assets/{Migration-DQgCEr0G.js → Migration-Cu4JgOj1.js} +1 -1
- package/dist/web/assets/{Product-165KSr60.js → Product-DmvUI7pH.js} +1 -1
- package/dist/web/assets/{Production-DoF4CcF-.js → Production-CLoOV4jl.js} +1 -1
- package/dist/web/assets/{Quality-CEVce0Rs.js → Quality-ylTg9e0c.js} +1 -1
- package/dist/web/assets/{Readiness-DcnpsaAD.js → Readiness-BMD5Uj8D.js} +1 -1
- package/dist/web/assets/{Record-B7hLtTK5.js → Record-CoCnmfqW.js} +1 -1
- package/dist/web/assets/{Regression-BMftRz5h.js → Regression-D_Hy9bMt.js} +1 -1
- package/dist/web/assets/{Reports-sL20ZyMf.js → Reports-DXphAHAy.js} +1 -1
- package/dist/web/assets/{Response-C2roHnWk.js → Response-PDQ8zEZU.js} +1 -1
- package/dist/web/assets/{RunDiff-C0AZaAAA.js → RunDiff-C3MIKipo.js} +1 -1
- package/dist/web/assets/{Runs-CIgHrNZ7.js → Runs-DSQZwCpE.js} +1 -1
- package/dist/web/assets/{Steps-GPPeoUP-.js → Steps-CY6WROAr.js} +1 -1
- package/dist/web/assets/{TestCases-xpJiurmK.js → TestCases-BjgWdtPi.js} +1 -1
- package/dist/web/assets/{TestData-D07oKCRW.js → TestData-CDziNp2d.js} +1 -1
- package/dist/web/assets/{TestDebt-BaXdxqnZ.js → TestDebt-D59zFYSu.js} +1 -1
- package/dist/web/assets/{Tosca-BfIh2vCw.js → Tosca-umw1O224.js} +1 -1
- package/dist/web/assets/{WhatsNew-rQKGxI3X.js → WhatsNew-DqNMAytd.js} +1 -1
- package/dist/web/assets/{dataParts-D9LZxYD6.js → dataParts-DGVc48Ed.js} +1 -1
- package/dist/web/assets/{fold-D1JElpyx.js → fold-BKAl2p_2.js} +1 -1
- package/dist/web/assets/{frame-CgFXIaLn.js → frame-B0nzdTfN.js} +2 -2
- package/dist/web/assets/{index-BoLw7yMm.js → index-BLUj4Sgh.js} +5 -5
- package/dist/web/assets/{logos-BGd4nsug.js → logos-J0WPxDqj.js} +1 -1
- package/dist/web/assets/{palette-BWPcuOsU.js → palette-DViz4KwG.js} +1 -1
- package/dist/web/assets/{qualityParts-9olnn4fj.js → qualityParts-DnbSeK-G.js} +1 -1
- package/dist/web/assets/{rows-BWeaaykT.js → rows-CbXelp5_.js} +1 -1
- package/dist/web/assets/{thread-B8W__QtF.js → thread-BIUxcjeu.js} +1 -1
- package/dist/web/assets/{usePageChat-DvfE62rZ.js → usePageChat-DMOtRwzT.js} +1 -1
- package/dist/web/index.html +2 -2
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/user-guide.html +7 -8
- package/forgeqe.example.yaml +2 -0
- package/package.json +1 -1
- package/prompts/README.md +1 -0
- package/prompts/heal.md +2 -0
- package/prompts/page-differs.md +16 -0
- package/prompts/test-agent.md +4 -3
- package/prompts/test-rules.md +1 -10
- package/py/forgeqe_engine/copilot_gateway.py +31 -0
- package/py/forgeqe_engine/persona.py +28 -11
- package/py/forgeqe_engine/service.py +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.5",
|
|
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": {
|
package/prompts/README.md
CHANGED
|
@@ -8,6 +8,7 @@ project; leave it as it is to keep getting ForgeQE's improvements when you updat
|
|
|
8
8
|
| brain.md | ForgeQE's own agent: reads every request in the shell, `forgeqe run`, and `forgeqe mcp`, and picks the tools |
|
|
9
9
|
| test-agent.md | Scribe, the coding agent: turns a verified browser run into a test in your repository |
|
|
10
10
|
| test-rules.md | Rules for any test the agents write or change (included in test-agent, test-reviewer, heal) |
|
|
11
|
+
| page-differs.md | What to do when the test's browser gets a different page than ForgeQE's: sent with Scribe's failure prompts, and included in heal |
|
|
11
12
|
| test-reviewer.md | The reviewer that checks a passing test tests the right thing the right way |
|
|
12
13
|
| test-plan.md | Plans how a test you recorded by hand (`forgeqe record`) fits your repository, for you to agree before Scribe writes it |
|
|
13
14
|
| heal.md | Heals tests the application has outgrown, and tells them apart from real bugs |
|
package/prompts/heal.md
CHANGED
|
@@ -51,6 +51,8 @@ Skills:
|
|
|
51
51
|
Each test that you heal or change follows these rules:
|
|
52
52
|
{{> test-rules}}
|
|
53
53
|
|
|
54
|
+
{{> page-differs}}
|
|
55
|
+
|
|
54
56
|
## Output
|
|
55
57
|
The structured result: each test that failed, as healed, app_bug, or not_healed, and the files that you changed. For each test, give:
|
|
56
58
|
- The command that runs only that test from the repository root, with no prompts, and with a non-zero exit code on failure.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: page-differs
|
|
3
|
+
description: "What to do when the test's browser gets a different page than ForgeQE's did. Sent with a failure, not with every call: {{> page-differs}}."
|
|
4
|
+
used_by: "Scribe's fix, blocked and stall prompts; heal"
|
|
5
|
+
kind: fragment
|
|
6
|
+
---
|
|
7
|
+
When the page of the test differs from what ForgeQE saw:
|
|
8
|
+
1. Look at the page in the browser of the test. Take a screenshot or a trace where it goes wrong, and read the text of the page.
|
|
9
|
+
2. From inside the browser of the test, compare navigator.userAgent, navigator.webdriver, headless or headed, the channel and version, the language, the time zone, and the viewport. Many sites refuse a "HeadlessChrome" user agent.
|
|
10
|
+
3. Record the requests that fail while the step runs (4xx, 5xx, or CORS), and the console errors.
|
|
11
|
+
4. The framework can add headers to each request, such as a run id or tracing. Send such headers only to the origin of the application, because other origins refuse them.
|
|
12
|
+
5. Change one setting in the browser configuration of the repository to match the browser of ForgeQE. Run again, until the page is the same.
|
|
13
|
+
|
|
14
|
+
- You MUST NOT judge the site with webfetch, curl, or HTTP libraries. Bot protection gives them a challenge page.
|
|
15
|
+
- You MAY report status blocked only as a last resort: you cannot get to the application, or it still refuses when the browsers agree on each point above.
|
|
16
|
+
- With blocked, you MUST give what you compared and what you saw, with the path of a screenshot or a trace.
|
package/prompts/test-agent.md
CHANGED
|
@@ -18,7 +18,7 @@ Move a verified browser flow into a test that fits this repository, so that it p
|
|
|
18
18
|
|
|
19
19
|
## Execution contract
|
|
20
20
|
**Preconditions**: you know the test framework, its configuration, how to run one test, and the page objects, fixtures, helpers, test data, and browser configuration that this test uses.
|
|
21
|
-
**Tools**: your own tools to read and edit files, and to build. The code_* tools: the code graph of this repository, which ForgeQE keeps up to date as you edit. After a repeated failure, ForgeQE turns on the live_browser_* tools: a Chrome with the same setup as the browser of ForgeQE.
|
|
21
|
+
**Tools**: your own tools to read and edit files, and to build. The code_* tools: the code graph of this repository, which ForgeQE keeps up to date as you edit. After a repeated failure, or from the start when ForgeQE's replay of the steps did not get through the flow, ForgeQE turns on the live_browser_* tools: a Chrome with the same setup as the browser of ForgeQE.
|
|
22
22
|
**Procedure**:
|
|
23
23
|
1. Learn the repository. With notes from earlier jobs, start from them, and read only the files that this test uses. Without notes, read AGENTS.md, README, and the contributing notes.
|
|
24
24
|
With the code_* tools, find code with them before grep or reading files:
|
|
@@ -36,8 +36,8 @@ Move a verified browser flow into a test that fits this repository, so that it p
|
|
|
36
36
|
When your message lists approaches that failed in earlier tries, you MUST NOT use them again in the same form. Use a different approach to that step.
|
|
37
37
|
5. When the live_browser_* tools are on, use them on the failing step before you change code: navigate, snapshot, click, type, press_key, select_option, take_screenshot, console_messages, and network_requests.
|
|
38
38
|
6. Without these tools, you MAY examine the failing step with a short scratch script in the framework of the repository. Delete it when you finish.
|
|
39
|
-
**Stop when**: the test is
|
|
40
|
-
**On failure**: when a page differs from what the handoff describes, follow the steps
|
|
39
|
+
**Stop when**: the test is written and builds, or a blocker stops you. Give the structured result then: ForgeQE runs the test and tells you whether it passes.
|
|
40
|
+
**On failure**: when a page differs from what the handoff describes, follow the steps that ForgeQE sends with the failure to compare the two browsers.
|
|
41
41
|
**Evidence**: the test file, the command, and what you used again and changed.
|
|
42
42
|
|
|
43
43
|
## Rules
|
|
@@ -67,6 +67,7 @@ Code:
|
|
|
67
67
|
|
|
68
68
|
Running:
|
|
69
69
|
- You MUST NOT run the test yourself. ForgeQE runs the command that you give.
|
|
70
|
+
- You MUST NOT read the files you wrote again, or run git status or git diff again, to review your change. Reading does not check the test; ForgeQE's run and its reviewer do. Each extra call sends the whole conversation to the model again.
|
|
70
71
|
- You MAY build or compile to find compile errors.
|
|
71
72
|
- You SHOULD take live_browser_snapshot only at the failing step. Each result stays in this conversation and costs tokens on each later call.
|
|
72
73
|
|
package/prompts/test-rules.md
CHANGED
|
@@ -21,16 +21,7 @@ kind: fragment
|
|
|
21
21
|
- Browser settings MUST apply to the full suite, unless the repository configures browsers for each project. You MUST NOT put them in a test or a page object.
|
|
22
22
|
- The browser of ForgeQE used this application from this computer some minutes ago. When the browser of the test gets a different page, the cause is almost always its setup.
|
|
23
23
|
|
|
24
|
-
When the page of the test differs from what ForgeQE saw
|
|
25
|
-
1. Look at the page in the browser of the test. Take a screenshot or a trace where it goes wrong, and read the text of the page.
|
|
26
|
-
2. From inside the browser of the test, compare navigator.userAgent, navigator.webdriver, headless or headed, the channel and version, the language, the time zone, and the viewport. Many sites refuse a "HeadlessChrome" user agent.
|
|
27
|
-
3. Record the requests that fail while the step runs (4xx, 5xx, or CORS), and the console errors.
|
|
28
|
-
4. The framework can add headers to each request, such as a run id or tracing. Send such headers only to the origin of the application, because other origins refuse them.
|
|
29
|
-
5. Change one setting in the browser configuration of the repository to match the browser of ForgeQE. Run again, until the page is the same.
|
|
30
|
-
|
|
31
|
-
- You MUST NOT judge the site with webfetch, curl, or HTTP libraries. Bot protection gives them a challenge page.
|
|
32
|
-
- You MAY report status blocked only as a last resort: you cannot get to the application, or it still refuses when the browsers agree on each point above.
|
|
33
|
-
- With blocked, you MUST give what you compared and what you saw, with the path of a screenshot or a trace.
|
|
24
|
+
- When the page of the test differs from what ForgeQE saw, ForgeQE sends you the steps to compare the two browsers with the failure.
|
|
34
25
|
|
|
35
26
|
## Code standards
|
|
36
27
|
- You MUST follow the conventions of the repository for its structure: .editorconfig, analyzers and lint rules, names, folder layout, base classes, fixtures, the assertion library, and test attributes.
|
|
@@ -22,6 +22,7 @@ It listens on 127.0.0.1 only, compares the key in constant time and refuses requ
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
24
|
import asyncio
|
|
25
|
+
import hashlib
|
|
25
26
|
import hmac
|
|
26
27
|
import json
|
|
27
28
|
import logging
|
|
@@ -87,6 +88,35 @@ def open_gateway_log() -> Optional[str]:
|
|
|
87
88
|
return path
|
|
88
89
|
|
|
89
90
|
|
|
91
|
+
# The last prompt seen for each system prompt (by its hash), to tell whether a request continues the one before it.
|
|
92
|
+
_LAST_PROMPTS: Dict[str, str] = {}
|
|
93
|
+
_LAST_PROMPTS_KEPT = 8
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def cache_note(req: Dict[str, Any], usage: Dict[str, Any]) -> str:
|
|
97
|
+
"""
|
|
98
|
+
One log line on caching, with no prompt text: input and cached tokens, the system prompt's hash and length, the
|
|
99
|
+
prompt's length, and whether it starts with the last prompt that had the same system prompt. Each request is a new
|
|
100
|
+
Copilot session; when a request continues the last one and still little is cached, the cache was lost on Copilot's
|
|
101
|
+
side (what its session adds before the conversation), not in what the caller sent.
|
|
102
|
+
"""
|
|
103
|
+
system = str(req.get("system") or "")
|
|
104
|
+
prompt = str(req.get("prompt") or "")
|
|
105
|
+
key = hashlib.sha256(system.encode("utf-8", "replace")).hexdigest()[:12]
|
|
106
|
+
last = _LAST_PROMPTS.get(key)
|
|
107
|
+
# Only the conversation part: the trailing tool instruction is added to every request after the last message.
|
|
108
|
+
body = prompt.split("\n\nTo use a tool, call it through the tool interface", 1)[0]
|
|
109
|
+
continues = "first" if last is None else "yes" if body.startswith(last) else "no"
|
|
110
|
+
_LAST_PROMPTS.pop(key, None)
|
|
111
|
+
_LAST_PROMPTS[key] = body
|
|
112
|
+
while len(_LAST_PROMPTS) > _LAST_PROMPTS_KEPT:
|
|
113
|
+
_LAST_PROMPTS.pop(next(iter(_LAST_PROMPTS)))
|
|
114
|
+
inp = int(usage.get("input") or 0)
|
|
115
|
+
cached = int(usage.get("cached") or 0)
|
|
116
|
+
share = f"{round(100 * cached / inp)}%" if inp else "-"
|
|
117
|
+
return f"cache: input {inp}, cached {cached} ({share}); system {key} ({len(system)} chars); prompt {len(prompt)} chars, continues the last one: {continues}"
|
|
118
|
+
|
|
119
|
+
|
|
90
120
|
# ---------------------------------------------------------------------------------------------------------------------
|
|
91
121
|
# OpenAI chat completions → one Copilot session
|
|
92
122
|
|
|
@@ -623,6 +653,7 @@ class Copilot:
|
|
|
623
653
|
raise GatewayError(502, "GitHub Copilot kept refusing the names of the caller's tools.")
|
|
624
654
|
if errors and not calls:
|
|
625
655
|
raise self.refusal(errors[-1], statuses[-1] if statuses else None)
|
|
656
|
+
gateway_log(rid, cache_note(req, usage))
|
|
626
657
|
data = getattr(reply, "data", None)
|
|
627
658
|
content = (data.content or "") if isinstance(data, AssistantMessageData) else ""
|
|
628
659
|
if calls:
|
|
@@ -4,7 +4,8 @@ each barrier it meets. ForgeQE sends the persona with the run request (src/a11y/
|
|
|
4
4
|
that changes the browser or the agent's actions comes from fixed lists, never from the persona's text.
|
|
5
5
|
|
|
6
6
|
- perception "screen_reader": no screenshots; the agent reads the page through the accessibility tree
|
|
7
|
-
(screen_reader_view) and what each key press puts in focus, as a screen reader announces it
|
|
7
|
+
(screen_reader_view) and what each key press puts in focus, as a screen reader announces it, never a CSS query of the
|
|
8
|
+
page's markup (find_elements).
|
|
8
9
|
- input "keyboard": the mouse actions (click, input, select_dropdown, upload, scripts) are taken away; the agent moves
|
|
9
10
|
with press_key and types with type_text into the focused field.
|
|
10
11
|
- vision, zoom and media: Chrome's own emulation (a colour vision deficiency or blur, a zoomed page, reduced motion,
|
|
@@ -16,6 +17,7 @@ operate and understand it. Each barrier is recorded with record_accessibility_is
|
|
|
16
17
|
|
|
17
18
|
import json
|
|
18
19
|
import logging
|
|
20
|
+
import re
|
|
19
21
|
from pathlib import Path
|
|
20
22
|
from typing import Any, Dict, List, Optional
|
|
21
23
|
|
|
@@ -46,9 +48,13 @@ MEDIA = {
|
|
|
46
48
|
}
|
|
47
49
|
SEVERITIES = ("critical", "serious", "moderate", "minor")
|
|
48
50
|
FINDINGS_FILE = "persona-findings.json"
|
|
51
|
+
WCAG = re.compile(r"\d{1,2}(\.\d{1,2}){1,2}")
|
|
49
52
|
|
|
50
53
|
# Actions a person using only the keyboard does not have: each points at an element or runs script, as a mouse would.
|
|
51
54
|
MOUSE_ACTIONS = ("click", "input", "select_dropdown", "dropdown_options", "upload_file", "click_selector", "evaluate")
|
|
55
|
+
# Actions that read the page's markup rather than what is announced (a CSS query of the DOM, its attributes and hidden
|
|
56
|
+
# parts): a screen reader user has no such view.
|
|
57
|
+
MARKUP_ACTIONS = ("find_elements",)
|
|
52
58
|
|
|
53
59
|
# Keys press_key sends: (key, code, windowsVirtualKeyCode, text).
|
|
54
60
|
KEYS: Dict[str, tuple] = {
|
|
@@ -169,12 +175,17 @@ def exclude_mouse(tools: Any) -> None:
|
|
|
169
175
|
tools.registry.exclude_action(name)
|
|
170
176
|
|
|
171
177
|
|
|
178
|
+
def exclude_markup(tools: Any) -> None:
|
|
179
|
+
for name in MARKUP_ACTIONS:
|
|
180
|
+
tools.registry.exclude_action(name)
|
|
181
|
+
|
|
182
|
+
|
|
172
183
|
async def _cdp(browser_session: BrowserSession):
|
|
173
184
|
return await browser_session.get_or_create_cdp_session()
|
|
174
185
|
|
|
175
186
|
|
|
176
187
|
async def apply_emulation(browser_session: BrowserSession, persona: Dict[str, Any], viewport: Optional[List[int]], applied: Dict[str, Any]) -> None:
|
|
177
|
-
"""Vision, zoom and media of the persona on the page in focus
|
|
188
|
+
"""Vision, zoom and media of the persona on the page in focus: vision and media once per tab, zoom whenever it is gone."""
|
|
178
189
|
if persona["vision"] == "none" and persona["zoom"] <= 1 and not persona["media"]:
|
|
179
190
|
return
|
|
180
191
|
try:
|
|
@@ -183,20 +194,24 @@ async def apply_emulation(browser_session: BrowserSession, persona: Dict[str, An
|
|
|
183
194
|
logger.debug("persona emulation: no page: %s", ex)
|
|
184
195
|
return
|
|
185
196
|
sid = cdp.session_id
|
|
186
|
-
if applied.get(sid):
|
|
187
|
-
return
|
|
188
197
|
send = cdp.cdp_client.send
|
|
189
198
|
try:
|
|
190
|
-
if
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
199
|
+
if not applied.get(sid):
|
|
200
|
+
if persona["vision"] != "none":
|
|
201
|
+
await send.Emulation.setEmulatedVisionDeficiency(params={"type": VISION[persona["vision"]]}, session_id=sid)
|
|
202
|
+
if persona["media"]:
|
|
203
|
+
await send.Emulation.setEmulatedMedia(params={"features": [{"name": MEDIA[m][0], "value": MEDIA[m][1]} for m in persona["media"]]}, session_id=sid)
|
|
204
|
+
applied[sid] = True
|
|
194
205
|
if persona["zoom"] > 1:
|
|
195
206
|
# Zooming a page is a smaller viewport in CSS pixels at a larger scale: the page reflows as it does at that zoom.
|
|
196
207
|
w, h = (viewport or [1280, 800])[:2]
|
|
197
208
|
z = persona["zoom"]
|
|
198
|
-
|
|
199
|
-
|
|
209
|
+
width = max(320, round(w / z))
|
|
210
|
+
# The browser library sets its own viewport again whenever a tab gains focus (a navigation, a new tab), which
|
|
211
|
+
# undoes the zoom: it is checked before every step and applied again once it is gone, never resized otherwise.
|
|
212
|
+
now = ((await send.Runtime.evaluate(params={"expression": "innerWidth", "returnByValue": True}, session_id=sid)).get("result") or {}).get("value")
|
|
213
|
+
if now != width:
|
|
214
|
+
await send.Emulation.setDeviceMetricsOverride(params={"width": width, "height": max(256, round(h / z)), "deviceScaleFactor": z, "mobile": False}, session_id=sid)
|
|
200
215
|
except Exception as ex:
|
|
201
216
|
logger.warning("persona emulation not applied: %s", ex)
|
|
202
217
|
|
|
@@ -356,7 +371,8 @@ def register_persona_tools(tools: Any, persona: Dict[str, Any], findings: List[D
|
|
|
356
371
|
if sev not in SEVERITIES:
|
|
357
372
|
return ActionResult(error=f"severity is one of {', '.join(SEVERITIES)}.")
|
|
358
373
|
criterion = clip(wcag, 12)
|
|
359
|
-
|
|
374
|
+
# A success criterion is 1.1.1 or 2.4 in shape (what ForgeQE's report keeps, src/a11y/run.ts readFindings).
|
|
375
|
+
if not WCAG.fullmatch(criterion):
|
|
360
376
|
criterion = ""
|
|
361
377
|
url = ""
|
|
362
378
|
try:
|
|
@@ -381,6 +397,7 @@ def register_persona_tools(tools: Any, persona: Dict[str, Any], findings: List[D
|
|
|
381
397
|
spec = next((v for k, v in KEYS.items() if k.lower() == name.lower()), None)
|
|
382
398
|
if spec is None or (shift and name.lower() != "tab"):
|
|
383
399
|
return ActionResult(error=f"Not a key this person presses: {raw!r}. Use one of: {', '.join(KEYS)}, Shift+Tab.")
|
|
400
|
+
name = next(k for k, v in KEYS.items() if v is spec)
|
|
384
401
|
k, code, vk, txt = spec
|
|
385
402
|
try:
|
|
386
403
|
cdp = await _cdp(browser_session)
|
|
@@ -1446,6 +1446,8 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1446
1446
|
personas.save_findings(req.out_dir, persona, persona_findings)
|
|
1447
1447
|
if personas.keyboard_only(persona):
|
|
1448
1448
|
personas.exclude_mouse(agent_tools)
|
|
1449
|
+
if not personas.uses_vision(persona):
|
|
1450
|
+
personas.exclude_markup(agent_tools)
|
|
1449
1451
|
# A screen reader user does not see the page: the agent gets no screenshots.
|
|
1450
1452
|
agent_kw["use_vision"] = personas.uses_vision(persona)
|
|
1451
1453
|
emit({"type": "log", "level": "info", "text": f"Accessibility persona: {persona['name']} ({'screen reader' if persona['perception'] == 'screen_reader' else 'sight'}, {'keyboard only' if personas.keyboard_only(persona) else 'mouse and keyboard'})"})
|