@capagents/forgeqe 2.10.3 → 2.10.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.
Files changed (142) hide show
  1. package/HOW_TO_USE.md +36 -7
  2. package/README.md +1 -1
  3. package/THIRD_PARTY_NOTICES.md +1 -0
  4. package/dist/docs-site/docs/architecture/index.html +1 -0
  5. package/dist/docs-site/docs/cost-architecture/index.html +1 -1
  6. package/dist/docs-site/docs/index.html +91 -14
  7. package/dist/docs-site/docs/mobile/index.html +38 -2
  8. package/dist/docs-site/docs/search.js +1 -1
  9. package/dist/forgeqe.js +1966 -1808
  10. package/dist/web/assets/Agent-bSVNDlcU.js +8 -0
  11. package/dist/web/assets/ApiTests-DOxGgoZC.js +10 -0
  12. package/dist/web/assets/Browse-CG8jzqR1.js +2 -0
  13. package/dist/web/assets/Chat-DzufzeGg.js +5 -0
  14. package/dist/web/assets/CommandPalette-D7ufvlUN.js +1 -0
  15. package/dist/web/assets/Compare-6vHuAaKv.js +1 -0
  16. package/dist/web/assets/Cost-DGZ5t-Q_.js +1 -0
  17. package/dist/web/assets/Data-DqGA1ZtQ.js +6 -0
  18. package/dist/web/assets/Desktop-CSOFE8cN.js +1 -0
  19. package/dist/web/assets/DesktopReview-BWtionFH.js +1 -0
  20. package/dist/web/assets/Evidence-D8pLFcbr.js +1 -0
  21. package/dist/web/assets/Explore-TtfTWmGW.js +2 -0
  22. package/dist/web/assets/Features-DazoSiEi.js +1 -0
  23. package/dist/web/assets/Flags-Brja-ZXF.js +2 -0
  24. package/dist/web/assets/Flaky-jJlHFFCa.js +1 -0
  25. package/dist/web/assets/Impact-b60dmhJK.js +3 -0
  26. package/dist/web/assets/Jobs-Y9W9nBgx.js +5 -0
  27. package/dist/web/assets/KindPage-Y72w2UwG.js +6 -0
  28. package/dist/web/assets/Migration-CvIeTB9p.js +2 -0
  29. package/dist/web/assets/Product-BEe2GyO6.js +7 -0
  30. package/dist/web/assets/Production-D2qmPFYy.js +1 -0
  31. package/dist/web/assets/Quality-C4Aak_hw.js +1 -0
  32. package/dist/web/assets/Readiness-ClXnnmLo.js +1 -0
  33. package/dist/web/assets/Record-LaLYhQgk.js +2 -0
  34. package/dist/web/assets/Regression-DKz05MC_.js +5 -0
  35. package/dist/web/assets/{RelationGraph-D_ZVeOBh.js → RelationGraph-DLeEarQd.js} +1 -1
  36. package/dist/web/assets/Reports-ClSAzQOh.js +2 -0
  37. package/dist/web/assets/Response-De60pk_7.js +10 -0
  38. package/dist/web/assets/RunDiff-0ibEcmI5.js +1 -0
  39. package/dist/web/assets/Runs-T8yF8Hi0.js +2 -0
  40. package/dist/web/assets/Steps-CB30w6BA.js +2 -0
  41. package/dist/web/assets/TestCases-Ba6bUE4i.js +1 -0
  42. package/dist/web/assets/TestData-DefDzeMW.js +2 -0
  43. package/dist/web/assets/TestDebt-zohltDHp.js +1 -0
  44. package/dist/web/assets/Tosca-jAtdiG28.js +3 -0
  45. package/dist/web/assets/WhatsNew-D7n48IsG.js +1 -0
  46. package/dist/web/assets/capture.worklet-C2TjBQ56.js +11 -0
  47. package/dist/web/assets/capture.worklet-UcNywATd.js +1 -0
  48. package/dist/web/assets/dataParts-CZAcb4L_.js +3 -0
  49. package/dist/web/assets/{families-zlLgApNV.js → families-D2ygriY6.js} +1 -1
  50. package/dist/web/assets/filters-CYaF2RvC.js +1 -0
  51. package/dist/web/assets/fold-BhYvId2X.js +1 -0
  52. package/dist/web/assets/frame-DeJBYtBX.js +11 -0
  53. package/dist/web/assets/index-CYlacOTX.css +2 -0
  54. package/dist/web/assets/index-DXpBYobT.js +67 -0
  55. package/dist/web/assets/{line-icons-CQ-3V8ax.js → line-icons-DBwNPSmu.js} +1 -1
  56. package/dist/web/assets/{logos-CMkTgBD8.js → logos-DmK40tlV.js} +1 -1
  57. package/dist/web/assets/{markdown-nTIj9lyp.js → markdown-Bej6qyls.js} +7 -7
  58. package/dist/web/assets/paletteCommands-CKBMmhb4.js +1 -0
  59. package/dist/web/assets/parts-BOpbd90H.js +1 -0
  60. package/dist/web/assets/{productParts-DK3ULNpv.js → productParts-B3_FGd-T.js} +1 -1
  61. package/dist/web/assets/qualityParts-B8yJRVpP.js +1 -0
  62. package/dist/web/assets/{recordTest-CqxnF953.js → recordTest-CZUrGm8I.js} +1 -1
  63. package/dist/web/assets/rows-BcG6gFCy.js +1 -0
  64. package/dist/web/assets/segmented-ffWUfF8N.js +1 -0
  65. package/dist/web/assets/{usePageChat-DWmmQrbC.js → usePageChat-T6vQY_1C.js} +1 -1
  66. package/dist/web/index.html +6 -6
  67. package/docs/ARCHITECTURE.md +1 -0
  68. package/docs/COST_ARCHITECTURE.md +1 -1
  69. package/docs/MOBILE.md +40 -0
  70. package/docs/user-guide.html +91 -14
  71. package/evals/prompts/brain/browser-narrow-with-filters.yaml +20 -0
  72. package/forgeqe.example.yaml +11 -1
  73. package/package.json +2 -1
  74. package/prompts/brain.md +4 -0
  75. package/prompts/browser-goal-verification.md +2 -0
  76. package/prompts/refine.md +2 -0
  77. package/prompts/test-reviewer.md +2 -1
  78. package/prompts/test-rules.md +3 -0
  79. package/py/forgeqe_desktop/workflow.py +6 -4
  80. package/py/forgeqe_engine/capture.py +5 -4
  81. package/py/forgeqe_engine/diagnostics.py +2 -2
  82. package/py/forgeqe_engine/lenient_json.py +96 -0
  83. package/py/forgeqe_engine/llm.py +4 -0
  84. package/py/forgeqe_engine/network.py +93 -15
  85. package/py/forgeqe_engine/neutral_log.py +16 -1
  86. package/py/forgeqe_engine/recordsession.py +79 -1
  87. package/py/forgeqe_engine/service.py +22 -3
  88. package/py/forgeqe_mobile/appium_driver.py +9 -0
  89. package/py/forgeqe_mobile/apps.py +4 -0
  90. package/py/forgeqe_mobile/maestro.py +3 -0
  91. package/py/forgeqe_mobile/record.py +610 -0
  92. package/py/forgeqe_mobile/service.py +37 -7
  93. package/py/forgeqe_voice/worker.py +121 -0
  94. package/skills/dotnet-nunit-playwright/SKILL.md +1 -0
  95. package/skills/playwright-typescript/SKILL.md +1 -1
  96. package/dist/web/assets/Agent-DyyAZPKr.js +0 -8
  97. package/dist/web/assets/ApiTests-p_cbulD4.js +0 -10
  98. package/dist/web/assets/Browse-DOAlK-ox.js +0 -2
  99. package/dist/web/assets/Chat-BCV5OsEz.js +0 -3
  100. package/dist/web/assets/CommandPalette-o9PuLas2.js +0 -1
  101. package/dist/web/assets/Compare-Bf1LhXmj.js +0 -1
  102. package/dist/web/assets/Cost-r7D19VSG.js +0 -1
  103. package/dist/web/assets/Data-CRttp4iM.js +0 -6
  104. package/dist/web/assets/Desktop-DcaKyfKA.js +0 -1
  105. package/dist/web/assets/DesktopReview-BjplTYfH.js +0 -1
  106. package/dist/web/assets/Evidence-BAAKcK0h.js +0 -1
  107. package/dist/web/assets/Explore-D_RZhVAc.js +0 -2
  108. package/dist/web/assets/Features-B6azjGtN.js +0 -1
  109. package/dist/web/assets/Flags-BQR4dRaK.js +0 -2
  110. package/dist/web/assets/Flaky-Ci1bvglt.js +0 -1
  111. package/dist/web/assets/Impact-CPB7NjQF.js +0 -3
  112. package/dist/web/assets/Jobs-CR8SxpWA.js +0 -5
  113. package/dist/web/assets/KindPage-Bl7q-2b8.js +0 -6
  114. package/dist/web/assets/Migration-BecNlszU.js +0 -2
  115. package/dist/web/assets/Product-AMUC5arL.js +0 -7
  116. package/dist/web/assets/Production-CZ-EG3t2.js +0 -1
  117. package/dist/web/assets/Quality-k2U9v2Dn.js +0 -1
  118. package/dist/web/assets/Readiness-D3_S6lDT.js +0 -1
  119. package/dist/web/assets/Record-Ba6XRn7c.js +0 -2
  120. package/dist/web/assets/Regression-jpkQRkt_.js +0 -5
  121. package/dist/web/assets/Reports-BHKtb9Oi.js +0 -2
  122. package/dist/web/assets/Response-CVNWGdun.js +0 -4
  123. package/dist/web/assets/RunDiff-dbcFibiJ.js +0 -1
  124. package/dist/web/assets/Runs-ij-80l3A.js +0 -2
  125. package/dist/web/assets/Steps-BDSeIznj.js +0 -2
  126. package/dist/web/assets/TestCases-BW8laQ_8.js +0 -1
  127. package/dist/web/assets/TestData-0f1XzLdc.js +0 -2
  128. package/dist/web/assets/TestDebt-C-2y3RTV.js +0 -1
  129. package/dist/web/assets/Tosca-DnfpS6Zf.js +0 -3
  130. package/dist/web/assets/WhatsNew-C1HUalPw.js +0 -1
  131. package/dist/web/assets/dataParts-DWD2uUxL.js +0 -3
  132. package/dist/web/assets/filters-CflRmNDz.js +0 -1
  133. package/dist/web/assets/fold-o_l3hXTU.js +0 -1
  134. package/dist/web/assets/frame-CdUL-UeQ.js +0 -4
  135. package/dist/web/assets/index-BmJOj6t1.js +0 -67
  136. package/dist/web/assets/index-DP3riJZe.css +0 -2
  137. package/dist/web/assets/palette-D-wSuihi.js +0 -1
  138. package/dist/web/assets/parts-C53RxMcR.js +0 -1
  139. package/dist/web/assets/qualityParts-DS83Q0nG.js +0 -1
  140. package/dist/web/assets/rows-DYYObxPx.js +0 -1
  141. package/dist/web/assets/segmented-CAf_qz5Z.js +0 -1
  142. package/dist/web/assets/thread-Cnjdo5ve.js +0 -5
@@ -14,6 +14,7 @@ from __future__ import annotations
14
14
 
15
15
  import json
16
16
  import os
17
+ import queue
17
18
  import sys
18
19
  import threading
19
20
  import time
@@ -189,7 +190,7 @@ def _maestro_steps(wf: Mapping[str, Any], commands: List[Mapping[str, Any]], ok:
189
190
  """Each workflow step's result from Maestro's command results, as to_flow writes them: a type step is three Maestro
190
191
  commands, and a launch is launchApp then an optional tap for each dismiss target (which never fails the launch)."""
191
192
  dismiss = len(wf.get("dismiss") or [])
192
- per_step = [3 if s["op"] == "type" else 1 + dismiss if s["op"] == "launch" else 1 for s in wf["steps"]]
193
+ per_step = [3 if s["op"] == "type" else 2 if s["op"] == "select" else 1 + dismiss if s["op"] == "launch" else 1 for s in wf["steps"]]
193
194
  if not commands and not ok:
194
195
  # No step's result is known (Maestro wrote none, or the job's results did not come back): the run's error says
195
196
  # what failed, rather than a step that may have passed.
@@ -294,6 +295,16 @@ def _remember(memory: Any, goal: str, app: str, workflow: Optional[Mapping[str,
294
295
  return {"dir": str(memory.root), "kind": outcome.get("memory") or "", "replayed": int(outcome.get("replayed") or 0), "flow": flow}
295
296
 
296
297
 
298
+ def run_record_mode(req: Mapping[str, Any], events: Events, stop: threading.Event, commands: "queue.Queue[Mapping[str, Any]]", driver_factory: Optional[Callable[[], Any]] = None) -> Dict[str, Any]:
299
+ """A recording by hand (record.py): the page's commands come on stdin, the screen and steps go out as events."""
300
+ from .record import run_record
301
+
302
+ out = _out_dir(req)
303
+ mobile = _mobile(req)
304
+ apps = load_mobile_apps(mobile)
305
+ return run_record(req, events, stop, commands, driver_factory or (lambda: appium_driver(mobile)), apps, _secret_names(mobile), out)
306
+
307
+
297
308
  def run_flows(req: Mapping[str, Any], events: Events, maestro_run: Optional[Callable[..., Any]] = None, cloud_run: Optional[Callable[..., Any]] = None) -> Dict[str, Any]:
298
309
  """The team's own Maestro flows: each checked against the allowlist, then run together."""
299
310
  out = _out_dir(req)
@@ -360,11 +371,27 @@ def _app_of_flows(flows: List[str], apps: Mapping[str, Any]) -> Any:
360
371
  raise WorkflowError(f"no mobile app with app_id {app_id} is configured; add it (with its app build or lt:// id) to env.yaml or mobile.apps")
361
372
 
362
373
 
363
- def _watch_stop(stream: IO[str], stop: threading.Event) -> None:
374
+ MAX_COMMAND_LINE = 10_000
375
+
376
+
377
+ def _watch_stop(stream: IO[str], stop: threading.Event, commands: "Optional[queue.Queue[Mapping[str, Any]]]" = None) -> None:
378
+ """``stop`` on a line of its own stops the run. A recording's commands come as JSON objects, one per line, and go
379
+ to ``commands``; any other line is ignored."""
364
380
  for line in stream:
365
- if line.strip() == "stop":
381
+ text = line.strip()
382
+ if text == "stop":
366
383
  stop.set()
384
+ if commands is not None:
385
+ commands.put({"cmd": "stop"})
367
386
  return
387
+ if commands is None or not text.startswith("{") or len(text) > MAX_COMMAND_LINE:
388
+ continue
389
+ try:
390
+ cmd = json.loads(text)
391
+ except ValueError:
392
+ continue
393
+ if isinstance(cmd, dict):
394
+ commands.put(cmd)
368
395
 
369
396
 
370
397
  def serve(
@@ -382,17 +409,20 @@ def serve(
382
409
  req = json.loads(stdin.readline() or "{}")
383
410
  if not isinstance(req, dict):
384
411
  raise WorkflowError("the request must be a JSON object")
385
- threading.Thread(target=_watch_stop, args=(stdin, stop), daemon=True).start()
386
- out = _out_dir(req)
387
412
  mode = req.get("mode")
388
- if mode == "replay":
413
+ commands: "Optional[queue.Queue[Mapping[str, Any]]]" = queue.Queue() if mode == "record" else None
414
+ threading.Thread(target=_watch_stop, args=(stdin, stop, commands), daemon=True).start()
415
+ out = _out_dir(req)
416
+ if mode == "record" and commands is not None:
417
+ result = run_record_mode(req, events, stop, commands, driver_factory)
418
+ elif mode == "replay":
389
419
  result = run_replay(req, events, stop, driver_factory, model_factory, maestro_run, cloud_run)
390
420
  elif mode == "explore":
391
421
  result = run_explore(req, events, stop, driver_factory, model_factory)
392
422
  elif mode == "maestro":
393
423
  result = run_flows(req, events, maestro_run, cloud_run)
394
424
  else:
395
- raise WorkflowError(f"mode must be replay, explore or maestro, not {mode!r}")
425
+ raise WorkflowError(f"mode must be replay, explore, maestro or record, not {mode!r}")
396
426
  except Exception as e:
397
427
  result = {"ok": False, "error": f"{type(e).__name__}: {e}" if not isinstance(e, (WorkflowError, ValueError)) else str(e)}
398
428
  result.setdefault("format", MOBILE_FORMAT)
@@ -0,0 +1,121 @@
1
+ """Speech to text and text to speech for the web app's Talk mode (src/voice/worker.ts), on this computer only.
2
+
3
+ Run by ForgeQE as ``python -I worker.py <models folder>`` in its own environment (~/.forgeqe/voice/.venv), with no shell,
4
+ an environment of system settings only (src/voice/setup.ts, ``voiceEnv``) and Hugging Face kept offline: the models are
5
+ the files ForgeQE downloaded and checked by SHA-256, read from the folder given, and nothing is fetched here.
6
+
7
+ It reads one JSON request per line on stdin and writes one JSON answer per line on stdout:
8
+
9
+ - ``{"id": 1, "op": "transcribe", "pcm": "<base64>", "language": "en"}``: 16 kHz mono 16-bit PCM, at most
10
+ ``MAX_SECONDS``, to ``{"id": 1, "ok": true, "text": "..."}`` (faster-whisper, its Silero voice filter on).
11
+ - ``{"id": 2, "op": "speak", "text": "...", "voice": "af_heart"}``: at most ``MAX_TEXT`` characters to
12
+ ``{"id": 2, "ok": true, "wav": "<base64>"}`` (Kokoro), a 24 kHz mono 16-bit WAV.
13
+
14
+ Everything a request carries is checked again here (sizes, the voice's shape and that Kokoro has it, the language
15
+ of a fixed list). An error is ``{"id": n, "ok": false, "error": "..."}`` on one line, never a traceback.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import base64
21
+ import io
22
+ import json
23
+ import re
24
+ import sys
25
+ import wave
26
+ from pathlib import Path
27
+
28
+ FORMAT = 1
29
+ RATE_IN = 16_000
30
+ MAX_SECONDS = 30
31
+ MAX_TEXT = 600
32
+ VOICE = re.compile(r"^[ab][fm]_[a-z]{2,12}$")
33
+ LANGUAGES = {"en", "de", "es", "fr", "it", "nl", "pt", "pl", "hi", "ja", "zh"}
34
+ # Words ForgeQE's people say often, so Whisper spells them as they are written.
35
+ PROMPT = "ForgeQE, Playwright, Cypress, Selenium, regression pack, staging, test case, Jira, Azure DevOps."
36
+
37
+
38
+ def _say(msg: dict) -> None:
39
+ sys.stdout.write(json.dumps(msg) + "\n")
40
+ sys.stdout.flush()
41
+
42
+
43
+ class Voice:
44
+ def __init__(self, models: Path) -> None:
45
+ from faster_whisper import WhisperModel
46
+ from kokoro_onnx import Kokoro
47
+
48
+ self.whisper = WhisperModel(str(models / "whisper-base"), device="cpu", compute_type="int8")
49
+ self.kokoro = Kokoro(str(models / "kokoro" / "kokoro-v1.0.int8.onnx"), str(models / "kokoro" / "voices-v1.0.bin"))
50
+ self.voices = set(self.kokoro.get_voices())
51
+
52
+ def transcribe(self, req: dict) -> dict:
53
+ import numpy as np
54
+
55
+ raw = base64.b64decode(str(req.get("pcm", "")), validate=True)
56
+ if not raw or len(raw) % 2 or len(raw) > RATE_IN * 2 * MAX_SECONDS:
57
+ raise ValueError("The recording is empty, cut, or longer than ForgeQE takes.")
58
+ language = req.get("language") or "en"
59
+ if language not in LANGUAGES:
60
+ raise ValueError("That language is not one Talk offers.")
61
+ audio = np.frombuffer(raw, dtype="<i2").astype(np.float32) / 32768.0
62
+ segments, _ = self.whisper.transcribe(audio, language=language, beam_size=1, vad_filter=True, initial_prompt=PROMPT, condition_on_previous_text=False)
63
+ return {"text": " ".join(s.text.strip() for s in segments).strip()}
64
+
65
+ def speak(self, req: dict) -> dict:
66
+ import numpy as np
67
+
68
+ text = req.get("text")
69
+ voice = req.get("voice")
70
+ if not isinstance(text, str) or not text.strip() or len(text) > MAX_TEXT:
71
+ raise ValueError("Nothing to say, or too much.")
72
+ if not isinstance(voice, str) or not VOICE.match(voice) or voice not in self.voices:
73
+ raise ValueError("That voice is not one Talk offers.")
74
+ samples, rate = self.kokoro.create(text, voice=voice, speed=1.0, lang="en-gb" if voice.startswith("b") else "en-us")
75
+ pcm = (np.clip(samples, -1.0, 1.0) * 32767).astype("<i2").tobytes()
76
+ out = io.BytesIO()
77
+ with wave.open(out, "wb") as w:
78
+ w.setnchannels(1)
79
+ w.setsampwidth(2)
80
+ w.setframerate(int(rate))
81
+ w.writeframes(pcm)
82
+ return {"wav": base64.b64encode(out.getvalue()).decode("ascii")}
83
+
84
+
85
+ def main() -> int:
86
+ if len(sys.argv) != 2:
87
+ _say({"ready": False, "error": "usage: worker.py <models folder>"})
88
+ return 2
89
+ try:
90
+ voice = Voice(Path(sys.argv[1]))
91
+ except Exception as e: # noqa: BLE001 - one line for ForgeQE, never a traceback
92
+ _say({"ready": False, "error": f"The speech models do not load: {type(e).__name__}"})
93
+ return 1
94
+ _say({"ready": True, "format": FORMAT})
95
+ for line in sys.stdin:
96
+ try:
97
+ req = json.loads(line)
98
+ except ValueError:
99
+ continue
100
+ if not isinstance(req, dict):
101
+ continue
102
+ rid = req.get("id")
103
+ if not isinstance(rid, int):
104
+ continue
105
+ op = req.get("op")
106
+ try:
107
+ if op == "transcribe":
108
+ _say({"id": rid, "ok": True, **voice.transcribe(req)})
109
+ elif op == "speak":
110
+ _say({"id": rid, "ok": True, **voice.speak(req)})
111
+ else:
112
+ _say({"id": rid, "ok": False, "error": "Unknown request."})
113
+ except ValueError as e:
114
+ _say({"id": rid, "ok": False, "error": str(e)[:200]})
115
+ except Exception as e: # noqa: BLE001
116
+ _say({"id": rid, "ok": False, "error": f"Speech failed: {type(e).__name__}"})
117
+ return 0
118
+
119
+
120
+ if __name__ == "__main__":
121
+ sys.exit(main())
@@ -27,6 +27,7 @@ agents: [scribe]
27
27
  - Assert page state with retrying assertions: `await Expect(locator).ToBeVisibleAsync()`, `ToHaveTextAsync`, `ToHaveValueAsync`, and `await Expect(Page).ToHaveURLAsync(...)`. Use NUnit's `Assert.That` for plain values only, never on `await locator.IsVisibleAsync()`.
28
28
  - Wait for outcomes with `Page.WaitForURLAsync`, `Page.RunAndWaitForResponseAsync`, or an assertion.
29
29
  - One overlay that appears at random (a cookie banner, a survey): register `Page.AddLocatorHandlerAsync(...)` in `[SetUp]` of the base class (Playwright 1.42 and later) rather than clicking it inside a test.
30
+ - Find an overlay's close button inside the overlay's own container (`banner.GetByRole(AriaRole.Button, new() { Name = "Accept all", Exact = true })`): consent tools often render a second "Accept all" elsewhere, and strict mode then throws. After the click, `await Expect(banner).ToBeHiddenAsync()`. A helper that closes it "if present" catches only the `TimeoutException` of it not showing, never a `PlaywrightException`.
30
31
  - Two or more that can show at once: write one helper that closes each visible one, top first, as the test rules describe. A handler's click is blocked while another overlay covers it.
31
32
 
32
33
  ## Data, secrets, attributes
@@ -27,7 +27,7 @@ agents: [scribe]
27
27
  - Wait for outcomes, never time: no `page.waitForTimeout`. Use an assertion, `page.waitForURL`, or a `page.waitForResponse(...)` promise created before the click that triggers the request.
28
28
 
29
29
  ## Overlays that come and go
30
- - One cookie banner, chat prompt, or survey that appears at random: register `page.addLocatorHandler(page.getByRole('button', { name: 'Accept all' }), async (button) => { await button.click() })` in a fixture or `beforeEach` (Playwright 1.42 and later), instead of clicking it inside the test.
30
+ - One cookie banner, chat prompt, or survey that appears at random: register `page.addLocatorHandler(banner, async () => { await banner.getByRole('button', { name: 'Accept all', exact: true }).click(); await expect(banner).toBeHidden() })`, where `banner` is the overlay's own container (`page.locator('#cookie-banner')`) in a fixture or `beforeEach` (Playwright 1.42 and later), instead of clicking it inside the test.
31
31
  - Two or more that can show at once: write one helper that closes each visible one, top first, as the test rules describe. A handler's click is blocked while another overlay covers it.
32
32
 
33
33
  ## Data and secrets