@capagents/forgeqe 2.10.4 → 3.0.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 +119 -16
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.md +1 -0
- package/dist/docs-site/docs/architecture/index.html +1 -0
- package/dist/docs-site/docs/cost-architecture/index.html +1 -1
- package/dist/docs-site/docs/index.html +158 -19
- package/dist/docs-site/docs/mobile/index.html +38 -2
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/forgeqe.js +2121 -1947
- package/dist/web/assets/Agent-DISh0THc.js +8 -0
- package/dist/web/assets/ApiTests-CK0HqEH4.js +10 -0
- package/dist/web/assets/Browse-WylAQZvD.js +2 -0
- package/dist/web/assets/Chat-B7IOg3I3.js +5 -0
- package/dist/web/assets/CommandPalette-CkreEJ8R.js +1 -0
- package/dist/web/assets/Compare-CgOfZofk.js +1 -0
- package/dist/web/assets/Cost-Dl5-viu4.js +1 -0
- package/dist/web/assets/Data-Bv2S5wkW.js +6 -0
- package/dist/web/assets/Desktop-CifPwy5u.js +1 -0
- package/dist/web/assets/DesktopReview-fpGdtU4r.js +1 -0
- package/dist/web/assets/Evidence-hOZDzfKt.js +1 -0
- package/dist/web/assets/Explore-c85VGE9Q.js +2 -0
- package/dist/web/assets/Features-DXL_vSjn.js +1 -0
- package/dist/web/assets/Flags-B7x2pDud.js +2 -0
- package/dist/web/assets/Flaky-BM3syqCt.js +1 -0
- package/dist/web/assets/Impact-BUCh8OAI.js +3 -0
- package/dist/web/assets/Jobs-B8sBDYRI.js +5 -0
- package/dist/web/assets/KindPage-yVmpQm7L.js +6 -0
- package/dist/web/assets/Migration-BOLN1duU.js +2 -0
- package/dist/web/assets/Product-C0FeEaJg.js +7 -0
- package/dist/web/assets/Production-BSMQyWKd.js +1 -0
- package/dist/web/assets/Quality-DsM9gWZb.js +1 -0
- package/dist/web/assets/Readiness-BhqkAJYN.js +1 -0
- package/dist/web/assets/Record-CPx-lK53.js +2 -0
- package/dist/web/assets/Regression-BXbX46nO.js +5 -0
- package/dist/web/assets/{RelationGraph-D_ZVeOBh.js → RelationGraph-eoGXXz5t.js} +1 -1
- package/dist/web/assets/Reports-36YQzVhA.js +2 -0
- package/dist/web/assets/Response-DplUOsue.js +4 -0
- package/dist/web/assets/RunDiff-D0fDhRmK.js +1 -0
- package/dist/web/assets/Runs-Bv1Ef8zq.js +2 -0
- package/dist/web/assets/Steps-Cm-atRtk.js +2 -0
- package/dist/web/assets/TestCases-B9x9W3zJ.js +1 -0
- package/dist/web/assets/TestData-DsJ6Z2YI.js +2 -0
- package/dist/web/assets/TestDebt-B_FUbMOb.js +1 -0
- package/dist/web/assets/Tosca-nxVCubA5.js +3 -0
- package/dist/web/assets/WhatsNew-CdnbMvrr.js +1 -0
- package/dist/web/assets/agentLink-BGKAF6xd.js +1 -0
- package/dist/web/assets/capture.worklet-C2TjBQ56.js +11 -0
- package/dist/web/assets/capture.worklet-UcNywATd.js +1 -0
- package/dist/web/assets/dataParts-Bn-tzbKg.js +3 -0
- package/dist/web/assets/{families-zlLgApNV.js → families-DPlFfKf2.js} +1 -1
- package/dist/web/assets/filters-Bj5K1WaL.js +1 -0
- package/dist/web/assets/fold-BhRpA0sy.js +1 -0
- package/dist/web/assets/frame-D_TPoUTD.js +16 -0
- package/dist/web/assets/index-BRB-oAMd.js +67 -0
- package/dist/web/assets/index-CIw5WfL8.css +2 -0
- package/dist/web/assets/{line-icons-CQ-3V8ax.js → line-icons-DBwNPSmu.js} +1 -1
- package/dist/web/assets/{logos-DfCytw3-.js → logos-839CfoKx.js} +1 -1
- package/dist/web/assets/{markdown-nTIj9lyp.js → markdown-6z0km3hN.js} +7 -7
- package/dist/web/assets/paletteCommands-CZFdKGhh.js +1 -0
- package/dist/web/assets/parts-VPcxh6Jc.js +1 -0
- package/dist/web/assets/{productParts-DK3ULNpv.js → productParts-BjfWgMtq.js} +1 -1
- package/dist/web/assets/qualityParts-PGN65yfI.js +1 -0
- package/dist/web/assets/{recordTest-CqxnF953.js → recordTest-EkxSMWbe.js} +1 -1
- package/dist/web/assets/rows-uLoguIo5.js +1 -0
- package/dist/web/assets/segmented-DphDskQz.js +1 -0
- package/dist/web/assets/{usePageChat-Dl2aUtHP.js → usePageChat-DqEwGcyO.js} +1 -1
- package/dist/web/index.html +6 -6
- package/docs/ARCHITECTURE.md +1 -0
- package/docs/COST_ARCHITECTURE.md +1 -1
- package/docs/MOBILE.md +40 -0
- package/docs/user-guide.html +158 -19
- package/evals/prompts/brain/browser-narrow-with-filters.yaml +20 -0
- package/forgeqe.example.yaml +11 -1
- package/package.json +4 -1
- package/prompts/brain.md +4 -0
- package/prompts/browser-goal-verification.md +2 -0
- package/prompts/refine.md +2 -0
- package/prompts/requests-rule.md +1 -1
- package/prompts/talk-summary.md +43 -0
- package/prompts/talk.md +49 -0
- package/prompts/test-agent.md +1 -0
- package/prompts/test-reviewer.md +2 -1
- package/prompts/test-rules.md +3 -0
- package/py/forgeqe_data/__init__.py +1 -0
- package/py/forgeqe_data/__main__.py +12 -0
- package/py/forgeqe_data/connect.py +290 -0
- package/py/forgeqe_data/connstr.py +169 -0
- package/py/forgeqe_data/flows.py +603 -0
- package/py/forgeqe_data/guard.py +214 -0
- package/py/forgeqe_data/mongo.py +219 -0
- package/py/forgeqe_data/schema.py +431 -0
- package/py/forgeqe_data/service.py +651 -0
- package/py/forgeqe_data/streams.py +400 -0
- package/py/forgeqe_data/subset.py +299 -0
- package/py/forgeqe_data/testdata.py +861 -0
- package/py/forgeqe_data/vector.py +113 -0
- package/py/forgeqe_desktop/workflow.py +6 -4
- package/py/forgeqe_engine/capture.py +5 -4
- package/py/forgeqe_engine/diagnostics.py +2 -2
- package/py/forgeqe_engine/lenient_json.py +96 -0
- package/py/forgeqe_engine/llm.py +4 -0
- package/py/forgeqe_engine/network.py +93 -15
- package/py/forgeqe_engine/neutral_log.py +16 -1
- package/py/forgeqe_engine/recordsession.py +54 -1
- package/py/forgeqe_engine/service.py +22 -3
- package/py/forgeqe_mobile/appium_driver.py +9 -0
- package/py/forgeqe_mobile/apps.py +4 -0
- package/py/forgeqe_mobile/maestro.py +3 -0
- package/py/forgeqe_mobile/record.py +610 -0
- package/py/forgeqe_mobile/service.py +37 -7
- package/py/forgeqe_talk/__init__.py +1 -0
- package/py/forgeqe_talk/__main__.py +65 -0
- package/py/forgeqe_voice/worker.py +141 -0
- package/skills/dotnet-nunit-playwright/SKILL.md +1 -0
- package/skills/playwright-typescript/SKILL.md +1 -1
- package/dist/web/assets/Agent-DaA5WhAY.js +0 -8
- package/dist/web/assets/ApiTests-B7xsTGyo.js +0 -10
- package/dist/web/assets/Browse-ByYCyAwd.js +0 -2
- package/dist/web/assets/Chat-D1-cYNBr.js +0 -3
- package/dist/web/assets/CommandPalette-DbxKJJJB.js +0 -1
- package/dist/web/assets/Compare-CYLFEtJl.js +0 -1
- package/dist/web/assets/Cost-Csz0jMHo.js +0 -1
- package/dist/web/assets/Data-BWTme_Yw.js +0 -6
- package/dist/web/assets/Desktop-rZ0vB6Ie.js +0 -1
- package/dist/web/assets/DesktopReview-_Xha22_d.js +0 -1
- package/dist/web/assets/Evidence-DmUyZy9F.js +0 -1
- package/dist/web/assets/Explore-2wzgwz3J.js +0 -2
- package/dist/web/assets/Features-DazEWqYu.js +0 -1
- package/dist/web/assets/Flags-BTt0-pqd.js +0 -2
- package/dist/web/assets/Flaky-CjkQp73T.js +0 -1
- package/dist/web/assets/Impact-De87sv5J.js +0 -3
- package/dist/web/assets/Jobs-aiNGBVHL.js +0 -5
- package/dist/web/assets/KindPage-CrGoFeSa.js +0 -6
- package/dist/web/assets/Migration-BAhQ1DZO.js +0 -2
- package/dist/web/assets/Product-DpK-PIxV.js +0 -7
- package/dist/web/assets/Production-D6A89rZZ.js +0 -1
- package/dist/web/assets/Quality-Bc5wCsog.js +0 -1
- package/dist/web/assets/Readiness-CoVgZw2X.js +0 -1
- package/dist/web/assets/Record-DcgBatJJ.js +0 -2
- package/dist/web/assets/Regression-BJLYrqST.js +0 -5
- package/dist/web/assets/Reports-DYfyfEDy.js +0 -2
- package/dist/web/assets/Response-CNLi9Dqu.js +0 -4
- package/dist/web/assets/RunDiff-BMTdRhii.js +0 -1
- package/dist/web/assets/Runs-lb78rvPV.js +0 -2
- package/dist/web/assets/Steps-BDSeIznj.js +0 -2
- package/dist/web/assets/TestCases-CfUwd67O.js +0 -1
- package/dist/web/assets/TestData-DP7cvW48.js +0 -2
- package/dist/web/assets/TestDebt-CqARxL7k.js +0 -1
- package/dist/web/assets/Tosca-CLAz9tWT.js +0 -3
- package/dist/web/assets/WhatsNew-1lhTRE5Z.js +0 -1
- package/dist/web/assets/dataParts-DI_OJhy5.js +0 -3
- package/dist/web/assets/filters-CflRmNDz.js +0 -1
- package/dist/web/assets/fold-pOBiaSlF.js +0 -1
- package/dist/web/assets/frame-CYYiRu5P.js +0 -4
- package/dist/web/assets/index-CNDoTeRV.css +0 -2
- package/dist/web/assets/index-D4a0w3Vl.js +0 -67
- package/dist/web/assets/palette-Cj4CUs0K.js +0 -1
- package/dist/web/assets/parts-C53RxMcR.js +0 -1
- package/dist/web/assets/qualityParts-C9FItsTg.js +0 -1
- package/dist/web/assets/rows-D6rPRkHl.js +0 -1
- package/dist/web/assets/segmented-CAf_qz5Z.js +0 -1
- package/dist/web/assets/thread-DQdyL3Sv.js +0 -5
|
@@ -31,6 +31,7 @@ from types import SimpleNamespace
|
|
|
31
31
|
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple
|
|
32
32
|
|
|
33
33
|
from .capture import capture_element, locate_check
|
|
34
|
+
from .network import NetworkCapture
|
|
34
35
|
from .memory import BASE, KEPT_ATTRS, candidate_locators, confidence, looks_generated, state_class, within_locator
|
|
35
36
|
from . import dynamic
|
|
36
37
|
from .varying import SeenElements, mark as mark_varying
|
|
@@ -181,6 +182,9 @@ class RecordSession:
|
|
|
181
182
|
self.shot_at: Dict[int, str] = {}
|
|
182
183
|
# The page's own API calls after each step (method, path, status), for checks of them in the review.
|
|
183
184
|
self.calls: Dict[int, List[Dict[str, Any]]] = {}
|
|
185
|
+
# The application's API calls in full (network.json, as an agent's run keeps them: bodies redacted by field
|
|
186
|
+
# name, and every saved login's values replaced before it is written), for API tests. Off with api.capture: false.
|
|
187
|
+
self.network: Optional[NetworkCapture] = NetworkCapture(payload.get("keep_headers")) if payload.get("network") is not False else None
|
|
184
188
|
self._requests: Dict[str, str] = {}
|
|
185
189
|
# Sites that asked for the browser's own sign-in (basic auth), by origin: the saved login that signs in there.
|
|
186
190
|
self.logins: List[Any] = []
|
|
@@ -291,6 +295,8 @@ class RecordSession:
|
|
|
291
295
|
reg.Browser.downloadProgress(self._queue("download_progress"))
|
|
292
296
|
reg.Network.requestWillBeSent(self._queue("request"))
|
|
293
297
|
reg.Network.responseReceived(self._queue("response"))
|
|
298
|
+
reg.Network.loadingFinished(self._queue("finished"))
|
|
299
|
+
reg.Network.loadingFailed(self._queue("failed"))
|
|
294
300
|
await self.send("Target.setAutoAttach", {"autoAttach": True, "waitForDebuggerOnStart": True, "flatten": True})
|
|
295
301
|
# A window a page opens (a link with target=_blank, window.open) is not attached by the browser on its own:
|
|
296
302
|
# told of each new tab, the recorder attaches to it, and the steps go on there.
|
|
@@ -371,6 +377,10 @@ class RecordSession:
|
|
|
371
377
|
if self.released:
|
|
372
378
|
return
|
|
373
379
|
self.released = True
|
|
380
|
+
# The bodies of the last calls are read from the browser: before it closes.
|
|
381
|
+
if self.network is not None:
|
|
382
|
+
with contextlib.suppress(Exception):
|
|
383
|
+
await self.network.settle(3.0)
|
|
374
384
|
sid, self._video_sid = self._video_sid, None
|
|
375
385
|
if self.video is not None and sid and sid in self.pages:
|
|
376
386
|
with contextlib.suppress(Exception):
|
|
@@ -487,12 +497,21 @@ class RecordSession:
|
|
|
487
497
|
elif kind in ("navigated", "navigated_same"):
|
|
488
498
|
await self._navigated(event, sid, same=kind == "navigated_same")
|
|
489
499
|
elif kind == "request":
|
|
500
|
+
self._capture_request(event, sid)
|
|
490
501
|
if event.get("type") in ("XHR", "Fetch") and event.get("requestId"):
|
|
491
502
|
if len(self._requests) > 2000:
|
|
492
503
|
self._requests.clear()
|
|
493
504
|
self._requests[str(event["requestId"])] = str((event.get("request") or {}).get("method") or "GET")
|
|
494
505
|
elif kind == "response":
|
|
506
|
+
if self.network is not None:
|
|
507
|
+
self.network.on_response(event, sid)
|
|
495
508
|
self._response(event, sid)
|
|
509
|
+
elif kind == "finished":
|
|
510
|
+
if self.network is not None:
|
|
511
|
+
self.network.on_finished(event, sid, send=self._send_quiet)
|
|
512
|
+
elif kind == "failed":
|
|
513
|
+
if self.network is not None:
|
|
514
|
+
self.network.on_failed(event, sid)
|
|
496
515
|
elif kind == "download_begin":
|
|
497
516
|
if len(self._downloading) > 50:
|
|
498
517
|
self._downloading.clear()
|
|
@@ -586,6 +605,39 @@ class RecordSession:
|
|
|
586
605
|
self.active = tab
|
|
587
606
|
self._changed(msg)
|
|
588
607
|
|
|
608
|
+
def _capture_request(self, event: Dict[str, Any], sid: Optional[str]) -> None:
|
|
609
|
+
"""A request of a recorded page, for network.json: never while paused, each call with the step it came after."""
|
|
610
|
+
net, rec = self.network, self.rec
|
|
611
|
+
if net is None or rec is None:
|
|
612
|
+
return
|
|
613
|
+
if self.paused and event.get("type") != "Document":
|
|
614
|
+
return
|
|
615
|
+
net.on_request(event, sid)
|
|
616
|
+
call = net._pending.get(str(event.get("requestId") or ""))
|
|
617
|
+
if call is not None:
|
|
618
|
+
call["step"] = max(1, len(rec.steps))
|
|
619
|
+
|
|
620
|
+
async def _send_quiet(self, method: str, params: Dict[str, Any], sid: Optional[str]) -> Any:
|
|
621
|
+
"""A body read for network.json: given up on when the browser is closed or the page gone."""
|
|
622
|
+
if self.client is None:
|
|
623
|
+
return {}
|
|
624
|
+
return await self.send(method, params, sid)
|
|
625
|
+
|
|
626
|
+
def _write_network(self) -> Optional[str]:
|
|
627
|
+
"""network.json in the recording's folder, every saved login's values replaced first."""
|
|
628
|
+
net = self.network
|
|
629
|
+
if net is None:
|
|
630
|
+
return None
|
|
631
|
+
values = [os.environ.get(env, "") for l in self.logins for env in (getattr(l, "username_env", None), getattr(l, "password_env", None)) if env]
|
|
632
|
+
if self.rec is not None:
|
|
633
|
+
values += [str(v) for v in getattr(self.rec, "login_values", {}).values()]
|
|
634
|
+
net.scrub(values)
|
|
635
|
+
try:
|
|
636
|
+
return net.write(self.out_dir, documents=False)
|
|
637
|
+
except Exception as ex:
|
|
638
|
+
logger.warning("record: network.json not written: %s", ex)
|
|
639
|
+
return None
|
|
640
|
+
|
|
589
641
|
def _response(self, event: Dict[str, Any], sid: Optional[str]) -> None:
|
|
590
642
|
if event.get("type") == "Document":
|
|
591
643
|
self._http_auth(event)
|
|
@@ -1746,7 +1798,8 @@ class RecordSession:
|
|
|
1746
1798
|
}
|
|
1747
1799
|
if not ok:
|
|
1748
1800
|
run["error"] = summary
|
|
1749
|
-
|
|
1801
|
+
network = self._write_network() if ok else None
|
|
1802
|
+
files = [str((self.out_dir / "run.json").resolve()), *([yaml_path] if yaml_path else []), str((self.out_dir / "trace.md").resolve()), *([video] if video else []), *([network] if network else [])]
|
|
1750
1803
|
if video:
|
|
1751
1804
|
run["video"] = Path(video).name
|
|
1752
1805
|
run["files"] = files
|
|
@@ -142,6 +142,8 @@ class RunRequest:
|
|
|
142
142
|
prompts: Dict[str, str] = field(default_factory=dict)
|
|
143
143
|
# The application's API calls (network.json), for API and contract tests.
|
|
144
144
|
network: bool = True
|
|
145
|
+
# More headers to keep on those calls (api.keep_headers): checked again by network.extra_headers.
|
|
146
|
+
keep_headers: List[str] = field(default_factory=list)
|
|
145
147
|
# axe-core for the accessibility checks: {"script": path to axe.min.js, "tags": [...]}; empty: the built-in checks.
|
|
146
148
|
axe: Dict[str, Any] = field(default_factory=dict)
|
|
147
149
|
# Core Web Vitals and load timings of each page (performance.json).
|
|
@@ -178,6 +180,7 @@ class RunRequest:
|
|
|
178
180
|
accessibility=d.get("accessibility") is not False,
|
|
179
181
|
overlay=d.get("overlay") is not False,
|
|
180
182
|
network=d.get("network") is not False,
|
|
183
|
+
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 [],
|
|
181
184
|
prompts={str(k): str(v) for k, v in (d.get("prompts") or {}).items()} if isinstance(d.get("prompts"), dict) else {},
|
|
182
185
|
axe=dict(d["axe"]) if isinstance(d.get("axe"), dict) else {},
|
|
183
186
|
vitals=d.get("vitals") is not False,
|
|
@@ -202,6 +205,17 @@ class RunRequest:
|
|
|
202
205
|
)
|
|
203
206
|
|
|
204
207
|
|
|
208
|
+
def task_goal(req: Any) -> str:
|
|
209
|
+
"""The whole task a run is part of: a resumed run's is the goal of the run it carried on from (and of that run's)."""
|
|
210
|
+
resume = getattr(req, "resume", None) or {}
|
|
211
|
+
if resume.get("steps"):
|
|
212
|
+
for key in ("task_goal", "goal"):
|
|
213
|
+
value = resume.get(key)
|
|
214
|
+
if isinstance(value, str) and value.strip():
|
|
215
|
+
return value.strip()[:4000]
|
|
216
|
+
return req.goal
|
|
217
|
+
|
|
218
|
+
|
|
205
219
|
def _build_initial_navigate_actions(url: str) -> List[Dict[str, Any]]:
|
|
206
220
|
"""The library's registry action for deterministic first navigation."""
|
|
207
221
|
return [{"navigate": {"url": url, "new_tab": False}}]
|
|
@@ -255,7 +269,9 @@ You MUST call done with success=true only when all parts of the goal are true on
|
|
|
255
269
|
- Each field MUST show exactly what the goal tells you. Sites fill in some fields before you start, and keep earlier selections. You MUST remove each value that the goal does not ask for.
|
|
256
270
|
- You MUST apply each setting that the goal names (sort order, filters, dates, options) through the controls of the page. The page MUST show the setting. To look through results that are not sorted is not the same as to apply the sort.
|
|
257
271
|
- You MUST read from the page all that the goal tells you to find or check. Your final answer MUST say what you saw.
|
|
272
|
+
- For items that meet a condition (a price limit, a rating), you SHOULD first apply the page's filter for it, or else sort by it. You SHOULD NOT look through many pages of results.
|
|
258
273
|
- You SHOULD read the items that the page lists (result cards, rows, prices, scores) from that list in one step. Open an item only when the goal needs data that the list does not show.
|
|
274
|
+
- When a script (evaluate) does not read a list in two tries, you MUST use extract.
|
|
259
275
|
- A tab can look empty immediately after it opens because it is loading. You MUST wait for it one time before you think that it is empty.
|
|
260
276
|
|
|
261
277
|
When a part is not true and you cannot make it true, you MUST call done with success=false, and name that part.
|
|
@@ -975,7 +991,7 @@ def _write_artifacts(
|
|
|
975
991
|
resume_path = out_dir / "resume.json"
|
|
976
992
|
if (out["memory"] or {}).get("resume") and mem.resume:
|
|
977
993
|
resume_path.write_text(
|
|
978
|
-
json.dumps({"goal": req.goal, "start_url": start_url or "", **mem.resume}, indent=2), encoding="utf-8"
|
|
994
|
+
json.dumps({"goal": req.goal, "task_goal": task_goal(req), "start_url": start_url or "", **mem.resume}, indent=2), encoding="utf-8"
|
|
979
995
|
)
|
|
980
996
|
files.append(str(resume_path.resolve()))
|
|
981
997
|
out["memory"]["resume"]["file"] = str(resume_path.resolve())
|
|
@@ -1017,6 +1033,9 @@ def _write_artifacts(
|
|
|
1017
1033
|
run_path = out_dir / "run.json"
|
|
1018
1034
|
slim = {k: v for k, v in out.items() if k != "result_markdown"}
|
|
1019
1035
|
slim["goal"] = req.goal
|
|
1036
|
+
# A run that carried on from a failed one (resume_from): its goal says "continue"; the task is the first run's.
|
|
1037
|
+
if task_goal(req) != req.goal:
|
|
1038
|
+
slim["task_goal"] = task_goal(req)
|
|
1020
1039
|
slim["start_url"] = start_url or ""
|
|
1021
1040
|
slim["driver"] = "engine"
|
|
1022
1041
|
slim["run_id"] = out_dir.name
|
|
@@ -1084,7 +1103,7 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1084
1103
|
llm_calls: List[Tuple[float, float]] = []
|
|
1085
1104
|
_time_llm_calls(llm, llm_calls, lambda c: emit({"type": "call", **c}))
|
|
1086
1105
|
use_prompts(req.prompts)
|
|
1087
|
-
diag = Diagnostics(accessibility=req.accessibility, network=req.network, axe=req.axe or None, vitals=req.vitals, visual=req.visual)
|
|
1106
|
+
diag = Diagnostics(accessibility=req.accessibility, network=req.network, axe=req.axe or None, vitals=req.vitals, visual=req.visual, keep_headers=req.keep_headers)
|
|
1088
1107
|
|
|
1089
1108
|
browser_cfg = req.browser if isinstance(req.browser, dict) else {}
|
|
1090
1109
|
browser_provider = str(browser_cfg.get("provider") or "local")
|
|
@@ -1609,7 +1628,7 @@ async def run_browser_task(req: RunRequest, emit: Emit, cancel_event: asyncio.Ev
|
|
|
1609
1628
|
point = mem.checkpoint()
|
|
1610
1629
|
if point:
|
|
1611
1630
|
(out_dir / "resume.json").write_text(
|
|
1612
|
-
json.dumps({"goal": req.goal, "start_url": normalized_initial or "", **point}, indent=2), encoding="utf-8"
|
|
1631
|
+
json.dumps({"goal": req.goal, "task_goal": task_goal(req), "start_url": normalized_initial or "", **point}, indent=2), encoding="utf-8"
|
|
1613
1632
|
)
|
|
1614
1633
|
except Exception as ex:
|
|
1615
1634
|
logger.warning("memory: could not save the checkpoint: %s", ex)
|
|
@@ -549,6 +549,15 @@ class AppiumDriver:
|
|
|
549
549
|
break
|
|
550
550
|
return out
|
|
551
551
|
|
|
552
|
+
def source(self) -> str:
|
|
553
|
+
"""The screen's page source (XML), as Appium gives it: the app's own text, so data."""
|
|
554
|
+
source = self._call("GET", self._s("/source")) or ""
|
|
555
|
+
return source if isinstance(source, str) else ""
|
|
556
|
+
|
|
557
|
+
def window_size(self) -> Dict[str, int]:
|
|
558
|
+
r = self._call("GET", self._s("/window/rect")) or {}
|
|
559
|
+
return {"width": int(r.get("width", 0)), "height": int(r.get("height", 0))} if isinstance(r, dict) else {"width": 0, "height": 0}
|
|
560
|
+
|
|
552
561
|
def screenshot_png(self) -> Optional[bytes]:
|
|
553
562
|
if not self.session:
|
|
554
563
|
return None
|
|
@@ -37,6 +37,10 @@ class MobileAppSpec:
|
|
|
37
37
|
caps: Dict[str, Any] = {"platformName": "Android", "appium:automationName": "UiAutomator2", "appium:appPackage": self.app_id}
|
|
38
38
|
if self.activity:
|
|
39
39
|
caps["appium:appActivity"] = self.activity
|
|
40
|
+
# Any screen the app opens counts as started: many apps hand their launcher over at once (a splash, then a
|
|
41
|
+
# sign-in: WooCommerce's MainActivity opens LoginActivity), and Appium would wait for the launcher forever.
|
|
42
|
+
# mobile.appium.capabilities can set it back.
|
|
43
|
+
caps["appium:appWaitActivity"] = "*"
|
|
40
44
|
else:
|
|
41
45
|
caps = {"platformName": "iOS", "appium:automationName": "XCUITest", "appium:bundleId": self.app_id}
|
|
42
46
|
if self.app:
|
|
@@ -113,6 +113,9 @@ def to_flow(workflow: Mapping[str, Any], app_id: str, variables: Optional[Mappin
|
|
|
113
113
|
cmds.append({{"tap": "tapOn", "double_tap": "doubleTapOn", "long_press": "longPressOn"}[op]: _selector(step["target"])})
|
|
114
114
|
elif op == "type":
|
|
115
115
|
cmds += [{"tapOn": _selector(step["target"])}, "eraseText", {"inputText": text(step["text"])}]
|
|
116
|
+
elif op == "select":
|
|
117
|
+
# Open the drop-down, then tap the item by the text it shows.
|
|
118
|
+
cmds += [{"tapOn": _selector(step["target"])}, {"tapOn": {"text": text(step["value"])}}]
|
|
116
119
|
elif op == "expect":
|
|
117
120
|
cmds.append({"assertVisible": _selector(step["target"], text(step["text"]) if "text" in step else None)})
|
|
118
121
|
elif op == "wait_for":
|