@capagents/forgeqe 3.2.5 → 3.2.7
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 +12 -5
- package/dist/docs-site/CREDITS.md +3 -3
- package/dist/docs-site/{LICENSE.dm-sans.txt → LICENSE.geist.txt} +1 -1
- package/dist/docs-site/app-look.css +72 -32
- package/dist/docs-site/architecture-map/arch-theme.css +31 -40
- package/dist/docs-site/docs/app-theme.css +109 -108
- package/dist/docs-site/docs/architecture-reference/index.html +1 -0
- package/dist/docs-site/docs/area-api/index.html +17 -4
- package/dist/docs-site/docs/area-browser/index.html +2 -0
- package/dist/docs-site/docs/area-setup/index.html +1 -0
- package/dist/docs-site/docs/get-started/index.html +7 -4
- package/dist/docs-site/docs/overview/index.html +1 -1
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +6 -3
- package/dist/docs-site/security/security-theme.css +66 -69
- package/dist/forgeqe.js +1890 -1860
- package/dist/web/THIRD_PARTY_NOTICES.md +0 -101
- package/dist/web/assets/{3d-force-graph-D62h_vvb.js → 3d-force-graph-CUGt_TSW.js} +1 -1
- package/dist/web/assets/Agent-DiX8ljlC.js +8 -0
- package/dist/web/assets/AgentWork-BpfMY_xu.js +2 -0
- package/dist/web/assets/ApiTests-4jfzlfVd.js +15 -0
- package/dist/web/assets/Browse-ByDemInL.js +1 -0
- package/dist/web/assets/Chat-C3wKV0CI.js +3 -0
- package/dist/web/assets/CommandPalette-CKJHtRjo.js +1 -0
- package/dist/web/assets/Compare-DtW2g-qb.js +1 -0
- package/dist/web/assets/Cost-DW-kVEL8.js +1 -0
- package/dist/web/assets/Data--HGneNun.js +6 -0
- package/dist/web/assets/Desktop-DQf5gv7D.js +1 -0
- package/dist/web/assets/DesktopReview-BaPYt0kl.js +2 -0
- package/dist/web/assets/DeviceScreen-DzVNfMwl.js +1 -0
- package/dist/web/assets/Evidence-CxRMnZch.js +1 -0
- package/dist/web/assets/Explore-ChpAuezG.js +2 -0
- package/dist/web/assets/Features-VsLb8QTH.js +1 -0
- package/dist/web/assets/Flags-Do-pvmCF.js +2 -0
- package/dist/web/assets/Flaky-CyhTszAg.js +1 -0
- package/dist/web/assets/Impact-BWBAXRuw.js +3 -0
- package/dist/web/assets/Jobs-C_MjXv0_.js +5 -0
- package/dist/web/assets/KindPage-Bb3Kp4-q.js +6 -0
- package/dist/web/assets/LiveDevice-OyxEiqBt.js +1 -0
- package/dist/web/assets/Migration-C80mGA3h.js +8 -0
- package/dist/web/assets/Mobile-C4wVBYfr.js +1 -0
- package/dist/web/assets/Observability-DdTOLp2C.js +1 -0
- package/dist/web/assets/PageAgent-Bi53-H99.js +1 -0
- package/dist/web/assets/Product-0LXndvp-.js +12 -0
- package/dist/web/assets/Production-oTXhv40a.js +1 -0
- package/dist/web/assets/Quality-CY0CJF9e.js +1 -0
- package/dist/web/assets/Readiness-Bv9uTTiI.js +1 -0
- package/dist/web/assets/Record-C-kyOkYq.js +1 -0
- package/dist/web/assets/Regression-CwKxvG1h.js +5 -0
- package/dist/web/assets/RelationGraph-BQl3M4zd.js +1 -0
- package/dist/web/assets/Reports-Ck8rc3br.js +2 -0
- package/dist/web/assets/Responsive-COmV2NXo.js +3 -0
- package/dist/web/assets/RunDiff-BBT1sQLh.js +1 -0
- package/dist/web/assets/Settings-7aMk9Sqx.js +21 -0
- package/dist/web/assets/Steps-C_vL6-8p.js +3 -0
- package/dist/web/assets/TestData-KzMy9N9f.js +2 -0
- package/dist/web/assets/TestManagement-BCEhOGB9.js +4 -0
- package/dist/web/assets/WhatsNew-DTcaqdOJ.js +1 -0
- package/dist/web/assets/agentSettingsSheet-DM1aa237.js +1 -0
- package/dist/web/assets/choice-B6z9CWyZ.js +1 -0
- package/dist/web/assets/code-DzYywAs5.js +1 -0
- package/dist/web/assets/{coverage-xSRsKFL6.js → coverage-BhtF065n.js} +4 -4
- package/dist/web/assets/dataParts-BNDVxwFb.js +3 -0
- package/dist/web/assets/desktopAppPath-D4hHP56R.js +1 -0
- package/dist/web/assets/frame-CNYHTG4T.js +13 -0
- package/dist/web/assets/index-B1Q2Dlqw.js +56 -0
- package/dist/web/assets/index-sxUpjgyw.css +2 -0
- package/dist/web/assets/markdown-BhU7ng6c.js +8 -0
- package/dist/web/assets/pageBack-BoSbGSU6.js +3 -0
- package/dist/web/assets/palette-BsY8OLxd.js +1 -0
- package/dist/web/assets/paletteCommands-DflHQ05x.js +1 -0
- package/dist/web/assets/parts-C4QMgN_N.js +1 -0
- package/dist/web/assets/preload-helper-qorOEK5q.js +1 -0
- package/dist/web/assets/productParts-Dxl-TQKY.js +1 -0
- package/dist/web/assets/qualityParts-ClGKtjEv.js +1 -0
- package/dist/web/assets/radio-DDxnnflQ.js +1 -0
- package/dist/web/assets/recordTest-B33rIncn.js +1 -0
- package/dist/web/assets/route-D9uPlFWw.js +1 -0
- package/dist/web/assets/sectionList-e5mFDaS2.js +1 -0
- package/dist/web/assets/stepper-DSDz0uu8.js +1 -0
- package/dist/web/index.html +10 -9
- package/docs/ARCHITECTURE_REFERENCE.md +1 -0
- package/docs/WEB_APP.md +6 -3
- package/docs/user-guide.html +26 -7
- package/forgeqe.example.yaml +3 -2
- package/llms.example.json +22 -0
- package/package.json +1 -1
- package/prompts/api-scenarios.md +1 -0
- package/prompts/brain.md +1 -0
- package/prompts/test-agent.md +0 -2
- package/prompts/test-rules.md +3 -8
- package/py/forgeqe_desktop/replay.py +48 -1
- package/py/forgeqe_desktop/workflow.py +79 -7
- package/py/forgeqe_engine/capture.py +19 -4
- package/py/forgeqe_engine/cli.py +12 -10
- package/py/forgeqe_engine/clientcert.py +28 -0
- package/py/forgeqe_engine/copilot_gateway.py +208 -23
- package/py/forgeqe_engine/d365.py +182 -0
- package/py/forgeqe_engine/logins.py +20 -16
- package/py/forgeqe_engine/memory.py +9 -3
- package/py/forgeqe_engine/recordsession.py +23 -3
- package/py/forgeqe_engine/webrecord.py +16 -0
- package/py/forgeqe_engine/webrecord_page.py +26 -1
- package/py/forgeqe_mobile/appium_driver.py +26 -0
- package/py/forgeqe_mobile/maestro.py +5 -1
- package/dist/web/assets/Agent-BadQe1GY.js +0 -8
- package/dist/web/assets/AgentWork-BGc6uVxB.js +0 -2
- package/dist/web/assets/ApiTests-Bo4ds0wk.js +0 -14
- package/dist/web/assets/Browse-CmVZJZ72.js +0 -1
- package/dist/web/assets/Chat-LTtQQHqr.js +0 -3
- package/dist/web/assets/CommandPalette-Dl_DibqU.js +0 -1
- package/dist/web/assets/Compare-Dlzg7S1a.js +0 -1
- package/dist/web/assets/Cost-DRKVox_i.js +0 -1
- package/dist/web/assets/Data-c2c1QLI9.js +0 -6
- package/dist/web/assets/Desktop-BMLYLWq1.js +0 -1
- package/dist/web/assets/DesktopReview-CO0vz-8o.js +0 -2
- package/dist/web/assets/DeviceScreen-CCDj-wqV.js +0 -1
- package/dist/web/assets/Evidence-BQmhYE2G.js +0 -1
- package/dist/web/assets/Explore-CVurlUoU.js +0 -2
- package/dist/web/assets/Features-DPc3_RSA.js +0 -1
- package/dist/web/assets/Flags-D4d9STIv.js +0 -2
- package/dist/web/assets/Flaky-Dt3iYOZg.js +0 -1
- package/dist/web/assets/Impact-CKy2Ezzt.js +0 -3
- package/dist/web/assets/Jobs-BZ4zn_7P.js +0 -5
- package/dist/web/assets/KindPage-joSX8gyV.js +0 -6
- package/dist/web/assets/LiveDevice-DQNdKoh3.js +0 -1
- package/dist/web/assets/Migration-EO--lNV1.js +0 -8
- package/dist/web/assets/Mobile-DWGNs3HT.js +0 -1
- package/dist/web/assets/Observability-DPjKbwcO.js +0 -1
- package/dist/web/assets/PageAgent-h70DL1L7.js +0 -1
- package/dist/web/assets/Product-ddlw8A_d.js +0 -12
- package/dist/web/assets/Production-svTscJhy.js +0 -1
- package/dist/web/assets/Quality-CgIo3fM8.js +0 -1
- package/dist/web/assets/Readiness-D6s73wXK.js +0 -1
- package/dist/web/assets/Record-Cmzr-0-f.js +0 -1
- package/dist/web/assets/Regression--3mygZAw.js +0 -5
- package/dist/web/assets/RelationGraph-BZYcwCVA.js +0 -1
- package/dist/web/assets/Reports-CDv_x9iB.js +0 -2
- package/dist/web/assets/Responsive-BhRYdJlZ.js +0 -3
- package/dist/web/assets/RunDiff-CO8asgjK.js +0 -1
- package/dist/web/assets/Settings-D3zWorNs.js +0 -21
- package/dist/web/assets/Steps-Dn12ePte.js +0 -3
- package/dist/web/assets/TestCases-CzXHBm5G.js +0 -1
- package/dist/web/assets/TestData-CL9bxSAI.js +0 -2
- package/dist/web/assets/TestDebt-B1_-OBJe.js +0 -1
- package/dist/web/assets/TestManagement-MwMgDuO_.js +0 -4
- package/dist/web/assets/WhatsNew-DLE9LimG.js +0 -1
- package/dist/web/assets/agents-DPabR9dS.js +0 -1
- package/dist/web/assets/dataParts-DAuDeT2W.js +0 -3
- package/dist/web/assets/desktopAppPath-C_bB4dWx.js +0 -1
- package/dist/web/assets/dm-sans-latin-400-normal-BwCSEQnW.woff +0 -0
- package/dist/web/assets/dm-sans-latin-400-normal-CW0RaeGs.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-500-normal-B9HHJjqV.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-500-normal-Dr3UlScf.woff +0 -0
- package/dist/web/assets/dm-sans-latin-600-normal-Aqo67rzb.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-600-normal-BmdmIIQ2.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-400-normal-BjWJ59Pq.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-400-normal-BtiwyxMk.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-500-normal-BJfUCQsA.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-500-normal-DR84L5F-.woff +0 -0
- package/dist/web/assets/dm-sans-latin-ext-600-normal-4vooXBpG.woff2 +0 -0
- package/dist/web/assets/dm-sans-latin-ext-600-normal-DRtaDpgU.woff +0 -0
- package/dist/web/assets/frame-DBWtBguh.js +0 -13
- package/dist/web/assets/index-ByIauY65.css +0 -2
- package/dist/web/assets/index-Tsofflw2.js +0 -57
- package/dist/web/assets/input-DX7REka8.js +0 -1
- package/dist/web/assets/markdown-Cj6qWQq7.js +0 -8
- package/dist/web/assets/pageBack-DmmT2q53.js +0 -3
- package/dist/web/assets/palette-CtM-T-2Q.js +0 -1
- package/dist/web/assets/paletteCommands-BYTeXpSW.js +0 -1
- package/dist/web/assets/parts-BQWLwMBf.js +0 -1
- package/dist/web/assets/productParts-2Ar8qxlW.js +0 -1
- package/dist/web/assets/qualityParts-_Sify8OE.js +0 -1
- package/dist/web/assets/recordTest-CL1Z2YWn.js +0 -1
- package/dist/web/assets/route-D8G-pTdk.js +0 -1
- package/dist/web/assets/stepper-p4Pkqn9_.js +0 -1
package/docs/user-guide.html
CHANGED
|
@@ -409,7 +409,7 @@ forgeqe docs --copy ./docs # copy the guide, the architecture page, the refere
|
|
|
409
409
|
<div class="area"><a class="area-name" href="#area-data"><span class="mono">Data</span></a><ul class="tiles"><li><a class="tile" href="#cap-databases"><b>Ask a database in plain language</b><span>Which customers in India have paid orders? Ask the orders database</span></a></li><li><a class="tile" href="#cap-test-data"><b>Test data on demand</b><span>Generate test data: 20 customers with 1 to 3 orders each in the shop database</span></a></li><li><a class="tile" href="#cap-data-flows"><b>Data flows between systems</b><span>Check that customers from the digital database reach the CRM correctly</span></a></li></ul></div>
|
|
410
410
|
<div class="area"><a class="area-name" href="#area-automated-tests"><span class="mono">Automated tests</span></a><ul class="tiles"><li><a class="tile" href="#cap-write-tests"><b>Turn a passed run into an automated test</b><span>Write a Playwright test for that run in ../app</span></a></li><li><a class="tile" href="#cap-heal-tests"><b>Heal failing tests</b><span>Heal the failing tests in ../app</span></a></li><li><a class="tile" href="#cap-migrate-tests"><b>Migrate a test suite</b><span>Migrate the Selenium tests in tests/ to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-tosca-convert"><b>Convert Tosca test cases</b><span>Convert the Tosca export tosca/checkout.tsu to Playwright TypeScript</span></a></li><li><a class="tile" href="#cap-find-run-tests"><b>Find and run existing tests</b><span>Run the checkout tests</span></a></li><li><a class="tile" href="#cap-regression-packs"><b>Regression packs for a release</b><span>Build a regression pack for sprint 12 and run it on TestMu</span></a></li><li><a class="tile" href="#cap-flaky-tests"><b>Flaky test detection and quarantine</b><span>Which tests are flaky?</span></a></li><li><a class="tile" href="#cap-run-diff"><b>Compare two runs step by step</b><span>It passed yesterday and fails today: why?</span></a></li><li><a class="tile" href="#cap-test-debt"><b>Test debt and coverage gaps</b><span>What has no test?</span></a></li><li><a class="tile" href="#cap-test-management"><b>Test management</b><span>Show the test inventory</span></a></li></ul></div>
|
|
411
411
|
<div class="area"><a class="area-name" href="#area-pull-requests"><span class="mono">Pull requests</span></a><ul class="tiles"><li><a class="tile" href="#cap-pr-review"><b>Review pull requests</b><span>Review PR 42 and focus on error handling</span></a></li><li><a class="tile" href="#cap-pr-impact"><b>Pull request impact and test selection</b><span>What does PR 42 impact?</span></a></li></ul></div>
|
|
412
|
-
<div class="area"><a class="area-name" href="#area-api"><span class="mono">API</span></a><ul class="tiles"><li><a class="tile" href="#cap-api-testing"><b>API and contract testing</b><span>Turn the last run's API calls into tests</span></a></li><li><a class="tile" href="#cap-api-load-security"><b>API load and security checks</b><span>Load test the orders API with 20 users for a minute</span></a></li></ul></div>
|
|
412
|
+
<div class="area"><a class="area-name" href="#area-api"><span class="mono">API</span></a><ul class="tiles"><li><a class="tile" href="#cap-api-testing"><b>API and contract testing</b><span>Turn the last run's API calls into tests</span></a></li><li><a class="tile" href="#cap-api-calls"><b>An API's calls and collections</b><span>Import our Postman collection and send its calls</span></a></li><li><a class="tile" href="#cap-api-load-security"><b>API load and security checks</b><span>Load test the orders API with 20 users for a minute</span></a></li></ul></div>
|
|
413
413
|
<div class="area"><a class="area-name" href="#area-quality"><span class="mono">Quality</span></a><ul class="tiles"><li><a class="tile" href="#cap-accessibility-performance"><b>Accessibility and page performance</b><span>Is the checkout page accessible?</span></a></li><li><a class="tile" href="#cap-accessibility-personas"><b>Accessibility testing with personas</b><span>Act as a blind person and use the website to find accessibility issues</span></a></li><li><a class="tile" href="#cap-visual-comparison"><b>Visual comparison with baselines</b><span>What changed visually since the last run?</span></a></li><li><a class="tile" href="#cap-defect-intelligence"><b>Defect intelligence: trends and prediction</b><span>Which defects keep coming back?</span></a></li><li><a class="tile" href="#cap-security-smoke"><b>Passive security smoke checks</b><span>Any security problems in the last checkout run?</span></a></li><li><a class="tile" href="#cap-localization-checks"><b>Localization checks</b><span>Is the German checkout fully translated?</span></a></li><li><a class="tile" href="#cap-responsive-check"><b>Responsive check</b><span>Does the checkout page work on phones?</span></a></li></ul></div>
|
|
414
414
|
<div class="area"><a class="area-name" href="#area-release"><span class="mono">Release</span></a><ul class="tiles"><li><a class="tile" href="#cap-release-readiness"><b>Requirement coverage and release readiness</b><span>Are we ready to release?</span></a></li><li><a class="tile" href="#cap-release-verdict"><b>One release verdict from everything measured</b><span>Can we ship release-2.3?</span></a></li><li><a class="tile" href="#cap-feature-flags"><b>Regression across feature-flag combinations</b><span>Run the release pack across the new-checkout feature flag on and off</span></a></li><li><a class="tile" href="#cap-reports"><b>Reports you can share</b><span>Create a release report for all projects</span></a></li></ul></div>
|
|
415
415
|
<div class="area"><a class="area-name" href="#area-systems"><span class="mono">Systems</span></a><ul class="tiles"><li><a class="tile" href="#cap-systems"><b>Work with Azure DevOps, Jira, GitHub, and Confluence</b><span>Show the open bugs in this sprint</span></a></li><li><a class="tile" href="#cap-system-data"><b>Read any data in Azure DevOps, Jira, Xray, and Confluence, and open Azure DevOps pull requests</b><span>Are there open pull requests in any repository of QI-Claims?</span></a></li></ul></div>
|
|
@@ -729,7 +729,7 @@ page). To use one model instead, pick it on <strong>Settings › Models</strong>
|
|
|
729
729
|
<li>Pick the model. The row then says who is signed in and with which model.</li>
|
|
730
730
|
</ol>
|
|
731
731
|
<p><strong>Terminal</strong></p>
|
|
732
|
-
<pre><code class="language-bash">forgeqe auth login copilot # sign in; ForgeQE then uses auto
|
|
732
|
+
<pre><code class="language-bash">forgeqe auth login copilot # sign in; ForgeQE then uses auto, and adds a copilot-<model> profile per seat model
|
|
733
733
|
forgeqe auth # the Copilot line shows the sign-in
|
|
734
734
|
</code></pre>
|
|
735
735
|
<p><strong>GitHub Enterprise Cloud</strong> (a <code>ghe.com</code> address, with data residency). In the web app press <strong>Enterprise</strong>; in the
|
|
@@ -786,9 +786,12 @@ request carrying a browser screenshot; ForgeQE then sends the next screenshots s
|
|
|
786
786
|
across), and if those do not get through either, none at all (the browser agent works from the page's text). It says so
|
|
787
787
|
in the run, keeps it for an hour in <code>~/.forgeqe/copilot/model-health.json</code>, and then tries full screenshots again. To get
|
|
788
788
|
full screenshots back, ask IT to allow uploads to that address.</p>
|
|
789
|
-
<p><strong>Behind a company proxy.</strong> ForgeQE reaches Copilot over
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
<p><strong>Behind a company proxy.</strong> ForgeQE reaches Copilot over WebSockets first. Many company proxies break them, which
|
|
790
|
+
leaves requests unanswered rather than failing, so until WebSockets have answered once on this computer, a request that
|
|
791
|
+
hears nothing from Copilot within 45 seconds (or fails on the connection) is sent again over plain HTTPS, and HTTPS is
|
|
792
|
+
kept: for that ForgeQE and, in <code>~/.forgeqe/copilot/transport.json</code>, for a week, before WebSockets are tried again.
|
|
793
|
+
<code>copilot-gateway.log</code> says when it switched. Set <code>FORGEQE_COPILOT_WEBSOCKETS=0</code> to always use HTTPS, or <code>=1</code> to always
|
|
794
|
+
use WebSockets with no fallback.</p>
|
|
792
795
|
<p><strong>Choosing the model.</strong> Your seat's models each show whether they take screenshots, their premium requests per call (0
|
|
793
796
|
is included in your plan) and the profiles that use them.</p>
|
|
794
797
|
<p><strong>Web app</strong></p>
|
|
@@ -2341,6 +2344,8 @@ forgeqe record --case SHOP-12 # record a test case
|
|
|
2341
2344
|
<li><strong>A CAPTCHA</strong> (reCAPTCHA, hCaptcha, Turnstile, Arkose, GeeTest) is one step for a person, never its clicks. A replay in a visible browser waits up to 3 minutes for you to solve it; a headless one fails and says to turn it off in the test environment (the provider's test keys, or a bypass).</li>
|
|
2342
2345
|
<li><strong>The browser's own sign-in box</strong> (basic auth): only the site is kept, with the saved login whose <code>domains</code> cover it. A replay signs in there with that login's variables. With no such login, the recording says to save one.</li>
|
|
2343
2346
|
<li><strong>Browser permissions</strong> you allowed (location, notifications, clipboard, camera, microphone) are granted to that site in a replay.</li>
|
|
2347
|
+
<li><strong>Dynamics 365</strong> (a <code>*.crm*.dynamics.com</code> site, or any page with D365's <code>#ApplicationShell</code>): elements are recorded by D365's own attributes, as the <code>dynamics-365</code> skills name them. An app tile is <code>div[data-type="app-title"][title="<app>"]</code> and a field or command is its <code>data-id</code>. The ids D365 makes from a control's position (<code>AppModuleTileSec_1_Item_1</code>) are never relied on. A replay waits after each step until D365 says it is idle (<code>UCWorkBlockTracker.isAppIdle()</code>).</li>
|
|
2348
|
+
<li><strong>Chrome's "Select a certificate" box</strong>, which Entra ID's device sign-in (<code>device.login.microsoftonline.com</code>) brings up on a computer joined to Entra: pick the certificate in Chrome as usual. The recording keeps one step for it. Nothing in a replay can answer that box, so Chrome must pick the certificate by itself. Run <code>forgeqe doctor certificate</code> and install the policy it writes, once, with administrator rights. On macOS that is a configuration profile, on Linux a policy file, and on Windows a <code>.reg</code> file. ForgeQE never installs it. The policy makes Chrome pick the certificate issued by <code>MS-Organization-Access</code> on that host only. Without it, a replay stops at the sign-in and says so. A device certificate stays on the computer it was issued to, so a CI agent needs a test user that the tenant does not ask for a managed device.</li>
|
|
2344
2349
|
</ul>
|
|
2345
2350
|
<p><strong>Passwords and files.</strong></p>
|
|
2346
2351
|
<ul>
|
|
@@ -3574,6 +3579,7 @@ Signing in stays <code>/auth</code> and <code>forgeqe login</code>; <code>forgeq
|
|
|
3574
3579
|
<tr><td><code>forgeqe doctor</code></td><td>Whether this computer and the network (proxy, inspected HTTPS, firewall) let ForgeQE reach what it needs</td></tr>
|
|
3575
3580
|
<tr><td><code>forgeqe doctor --packages</code></td><td>Every package ForgeQE installs on this computer, and which are missing or out of date</td></tr>
|
|
3576
3581
|
<tr><td><code>forgeqe doctor browser [--headless]</code></td><td>Start the local browser each way ForgeQE can, and write a report of what stops it</td></tr>
|
|
3582
|
+
<tr><td><code>forgeqe doctor certificate</code></td><td>Write Chrome's policy that picks this computer's Entra device certificate, for you to install</td></tr>
|
|
3577
3583
|
<tr><td><code>forgeqe models</code></td><td>List the profiles in <code>llms.json</code> and the active one</td></tr>
|
|
3578
3584
|
<tr><td><code>forgeqe models --routes [--profile-models]</code></td><td>The model each area of work gets (<code>llm.routing</code>) and why; <code>--profile-models</code> checks and rates the models again (see <a href="#doc-docs-model_routing-model-routing-the-right-configured-model-for-each-task">docs/MODEL_ROUTING.md</a>)</td></tr>
|
|
3579
3585
|
<tr><td><code>forgeqe features</code></td><td>What ForgeQE can do, and what each capability still needs in this setup (works without a model)</td></tr>
|
|
@@ -9942,10 +9948,10 @@ projects; for other frameworks add <code>--agent</code>, or run the listed files
|
|
|
9942
9948
|
<div class="hd"><span class="mono">API</span><h3>API and contract testing</h3></div>
|
|
9943
9949
|
<p class="ds">Builds API contracts (status, schema, key fields) from the calls a browser run saw or from an API description (OpenAPI, Swagger, WSDL, GraphQL, .proto, gRPC reflection), and end-to-end API scenarios from runs, descriptions, test cases, or plain English. Runs them straight against the API without a browser, or writes them as tests in the repository. REST, GraphQL (with subscriptions), SOAP, gRPC (with streaming), WebSocket and Server-Sent Events. Comparing runs of one flow learns which values are parameters; contracts that stop passing after the app changed are learned again from a newer run, kept only when a replay passes and a person agrees. A mock server built from the contracts.</p>
|
|
9944
9950
|
<div class="facts">
|
|
9945
|
-
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Turn the last run's API calls into tests</li><li>Test the API in openapi.yaml</li><li>Write API scenario tests for the order lifecycle</li><li>
|
|
9951
|
+
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Turn the last run's API calls into tests</li><li>Test the API in openapi.yaml</li><li>Write API scenario tests for the order lifecycle</li><li>Heal the API contracts from the latest run</li></ul></div>
|
|
9946
9952
|
<div class="fact"><span class="mono">What it needs</span><ul class="needs"><li><span class="need opt">Optional</span><span>The coding agent, Quill: a live model profile (or code.model), and what forgeqe setup installs for it</span></li></ul></div>
|
|
9947
9953
|
<div class="fact"><span class="mono">Limits</span><ul class="plainlist"><li>Calls that change data run only when the user allows them, on a test environment, never production; healing never replays them.</li><li>A contract that fails can be a real defect: healing proposes a new version, and a person decides.</li></ul></div>
|
|
9948
|
-
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>api_contracts</code> <code>run_api_contracts</code> <code>heal_api_contracts</code> <code>api_scenarios</code> <code>run_api_scenarios</code> <code>write_api_tests</code
|
|
9954
|
+
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>api_contracts</code> <code>run_api_contracts</code> <code>heal_api_contracts</code> <code>api_scenarios</code> <code>run_api_scenarios</code> <code>write_api_tests</code></p></div>
|
|
9949
9955
|
</div>
|
|
9950
9956
|
<div class="detail"><span class="mono">In detail</span>
|
|
9951
9957
|
<section class="doc" id="doc-how_to_use-api-and-contract-tests">
|
|
@@ -10286,6 +10292,19 @@ DevOps test case's Associated Automation when write-back is on.</li>
|
|
|
10286
10292
|
</section>
|
|
10287
10293
|
</div>
|
|
10288
10294
|
</article>
|
|
10295
|
+
<article class="spec feat" id="cap-api-calls">
|
|
10296
|
+
<div class="hd"><span class="mono">API</span><h3>An API's calls and collections</h3></div>
|
|
10297
|
+
<p class="ds">Keeps an API's calls as a set on the API tests Workbench: finds an API and its calls, adds calls (from the code, cURL or a description) and changes the ones it has in place, imports a Postman collection, renames, moves and deletes them, and signs in to the API with a saved login, never a credential on a call.</p>
|
|
10298
|
+
<div class="facts">
|
|
10299
|
+
<div class="fact"><span class="mono">Ask it</span><ul class="asks"><li>Import our Postman collection and send its calls</li><li>Add these cURL calls to the shop API</li><li>Add query parameters to the existing API call in the shop API</li><li>Delete the old orders API from the Workbench</li><li>Send the shop API calls signed in with the admin login</li></ul></div>
|
|
10300
|
+
<div class="fact"><span class="mono">What it needs</span><p class="muted">Nothing beyond ForgeQE itself.</p></div>
|
|
10301
|
+
<div class="fact"><span class="mono">Limits</span><ul class="plainlist"><li>Calls that change data run only when the user allows them, on a test environment, never production.</li><li>Deleting an API asks the user first.</li></ul></div>
|
|
10302
|
+
<div class="fact"><span class="mono">Tools</span><p class="tools"><code>api_find_calls</code> <code>api_new_set</code> <code>api_add_calls</code> <code>api_edit_call</code> <code>api_rename_folder</code> <code>api_move_calls</code> <code>api_delete_set</code> <code>api_sign_in</code> <code>api_import_collection</code></p></div>
|
|
10303
|
+
</div>
|
|
10304
|
+
<div class="detail"><span class="mono">In detail</span>
|
|
10305
|
+
<p class="see">See <a href="#doc-how_to_use-api-and-contract-tests">API and contract tests</a>.</p>
|
|
10306
|
+
</div>
|
|
10307
|
+
</article>
|
|
10289
10308
|
<article class="spec feat" id="cap-api-load-security">
|
|
10290
10309
|
<div class="hd"><span class="mono">API</span><h3>API load and security checks</h3></div>
|
|
10291
10310
|
<p class="ds">Load and latency testing of a contract set's read-only calls (virtual users, percentiles, throughput and error rate against limits), and robustness and API-security checks (OWASP API Top 10): malformed input, calls without credentials, leaked errors, mass assignment and missing security headers.</p>
|
package/forgeqe.example.yaml
CHANGED
|
@@ -255,10 +255,11 @@ prompts:
|
|
|
255
255
|
# # measures them and puts them on tiles when the colour hides one (3D icons only)
|
|
256
256
|
# icon_set: phosphor # phosphor | solar | lucide | 3d: the pages' and agents' icons everywhere; phosphor
|
|
257
257
|
# # (Phosphor Duotone, the default), solar (Solar Bold Duotone) and lucide are flat,
|
|
258
|
-
# #
|
|
258
|
+
# # in icon_colour, so they show on any sidebar
|
|
259
259
|
# # colour; 3d is ForgeQE's pixel icons. lucide draws the buttons' and menus'
|
|
260
260
|
# # icons in Lucide too; the others keep Phosphor's
|
|
261
|
-
# icon_colour: accent #
|
|
261
|
+
# icon_colour: accent # unset (the default: the app's icon colour, blue, light blue in dark mode, or
|
|
262
|
+
# # theme.secondary's) | accent (the buttons' colour) | for black icons "#111928" |
|
|
262
263
|
# # a colour such as "#7c3aed": the flat icons' lines, made darker or lighter
|
|
263
264
|
# # where they would not show; phosphor's and solar's second tone (grey in
|
|
264
265
|
# # black) takes the colour's palest shade
|
package/llms.example.json
CHANGED
|
@@ -48,6 +48,28 @@
|
|
|
48
48
|
"temperature": 0.2,
|
|
49
49
|
"description": "Any OpenAI-compatible chat endpoint"
|
|
50
50
|
},
|
|
51
|
+
"claude": {
|
|
52
|
+
"provider": "anthropic",
|
|
53
|
+
"model": "claude-sonnet-4-5",
|
|
54
|
+
"api_key_env": "ANTHROPIC_API_KEY",
|
|
55
|
+
"temperature": 0.2,
|
|
56
|
+
"description": "Anthropic Claude through Anthropic's own API (its OpenAI-compatible endpoint, api.anthropic.com)"
|
|
57
|
+
},
|
|
58
|
+
"gemini": {
|
|
59
|
+
"provider": "gemini",
|
|
60
|
+
"model": "gemini-2.5-pro",
|
|
61
|
+
"api_key_env": "GEMINI_API_KEY",
|
|
62
|
+
"temperature": 0.2,
|
|
63
|
+
"description": "Google Gemini through the Gemini API (its OpenAI-compatible endpoint, generativelanguage.googleapis.com)"
|
|
64
|
+
},
|
|
65
|
+
"bedrock": {
|
|
66
|
+
"provider": "bedrock",
|
|
67
|
+
"model": "openai.gpt-oss-120b",
|
|
68
|
+
"region": "us-east-1",
|
|
69
|
+
"api_key_env": "AWS_BEARER_TOKEN_BEDROCK",
|
|
70
|
+
"temperature": 0.2,
|
|
71
|
+
"description": "AWS Bedrock with a Bedrock API key, through its OpenAI-compatible endpoint (bedrock-mantle.<region>.api.aws)"
|
|
72
|
+
},
|
|
51
73
|
"copilot": {
|
|
52
74
|
"provider": "github_copilot",
|
|
53
75
|
"model": "auto",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.7",
|
|
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/api-scenarios.md
CHANGED
|
@@ -30,6 +30,7 @@ Values:
|
|
|
30
30
|
- Data that the scenario creates MUST be new on each run. Put {{$unique}} in emails, usernames, names, and references.
|
|
31
31
|
- You MAY also use {{$uuid}}, {{$now}}, and {{$randomInt}}.
|
|
32
32
|
- You MUST use the test data of the case, such as a product or a coupon code, as the case gives it.
|
|
33
|
+
- When the case or the text gives a request body, you MUST send each of its fields exactly as given, {{$unique}} and other {{expressions}} included. You MUST NOT keep the example call's value for a field it gives.
|
|
33
34
|
|
|
34
35
|
Checks:
|
|
35
36
|
- Each step MUST expect the status that the operation gives on success.
|
package/prompts/brain.md
CHANGED
|
@@ -460,6 +460,7 @@ For REST, GraphQL, SOAP, and gRPC:
|
|
|
460
460
|
- When the calls are not in a set yet, make the set first: api_contracts from run for browser runs, or api_new_set and api_add_calls for calls in the code. Then use write_api_tests with that set.
|
|
461
461
|
- To run API tests that are already in the repository, you MUST use find_tests, then run_tests. You MUST NOT run them with the shell.
|
|
462
462
|
- Before api_new_set or api_add_calls, and whenever a set id is not in the conversation (a conversation picked up again), you MUST look for the API and the call with api_find_calls and reuse what is there. You MUST NOT make a second API or call with the same method and path; when you cannot tell which API is meant, ask the user.
|
|
463
|
+
- To change a call the API already has (add query parameters, change headers, body, name, folder or the answer it expects), you MUST use api_edit_call with its set id and call id (api_find_calls finds them, and api_add_calls returns already_there for it). It changes the call in place. You MUST NOT add it again, and MUST NOT tell the user to edit it on the Workbench by hand.
|
|
463
464
|
- To send API calls found in the repository's code, read the code, then use api_new_set and api_add_calls. To make tests of them, use write_api_tests.
|
|
464
465
|
- To delete an API (a set, a folder on the API tests Workbench), you MUST use api_delete_set with its set id (api_find_calls finds it); ForgeQE asks the user to confirm. You MUST NOT open the Workbench in a browser to delete, rename or change an API. When api_delete_set cannot delete it, tell the user why and stop.
|
|
465
466
|
|
package/prompts/test-agent.md
CHANGED
|
@@ -54,7 +54,6 @@ Steps and checks:
|
|
|
54
54
|
- When the run did a step from JavaScript, you MUST do that step through the control of the page.
|
|
55
55
|
- You MUST assert the checks of the handoff with their locators. You MUST assert the contents of a section inside its section locator.
|
|
56
56
|
- A check marked live data MUST assert the rule of the expected result, with the value calculated when the test runs. You MUST NOT assert the value of this run.
|
|
57
|
-
- When the handoff has no checks, you MUST assert what the goal tells you to check.
|
|
58
57
|
|
|
59
58
|
Code:
|
|
60
59
|
- You MUST write the test in the language and framework of the repository. A C# NUnit repository gets a C# NUnit test.
|
|
@@ -65,7 +64,6 @@ Code:
|
|
|
65
64
|
- In a Robot Framework repository, or when the goal names Robot Framework, you MUST write the test as a Robot suite: a `*.robot` file with `*** Settings ***`, `*** Variables ***` and `*** Test Cases ***` sections, one test case per test, and two or more spaces between a keyword and each of its arguments. You MUST put shared keywords, locators and the browser setup in a `*.resource` file under `resources/` and import it with `Resource`, not repeat them in the suite. You MUST use the keywords of the library the repository already imports: with the Browser library, its auto-waiting keywords (`New Page`, `Click`, `Fill Text`, `Get Text`) and its `Get`-based assertions (`Get Text sel == value`); with SeleniumLibrary, its own. You MUST NOT use `Sleep`, and you MUST NOT mix the keywords of the two libraries in one suite. A Robot library is a package: you ask for it with request_install and language: "python".
|
|
66
65
|
- You MUST NOT put secrets in the code. You MUST read them from the environment variables that the handoff names.
|
|
67
66
|
- A public demo login is the one exception: a user name and password that the application itself shows to anyone, such as the logins on the sign-in page of a demo site (saucedemo.com). Such a login MAY follow the convention of the repository for test data. The page snapshots of the run show whether the application publishes it.
|
|
68
|
-
- You MAY change the test configuration that the test needs.
|
|
69
67
|
|
|
70
68
|
{{> requests-rule}}
|
|
71
69
|
|
package/prompts/test-rules.md
CHANGED
|
@@ -8,7 +8,6 @@ kind: fragment
|
|
|
8
8
|
- The test MUST operate the application in a browser through the test framework of the repository. It does what the verified run did, and checks what the run checked.
|
|
9
9
|
- Test code MUST NOT read the files of ForgeQE: run folders, handoff.md, run.json, workflow.yaml, or page memory.
|
|
10
10
|
- You MUST NOT replace the scenario with a different test to get a pass, such as a narrower test or a test without a browser.
|
|
11
|
-
- A replacement test is never an acceptable result.
|
|
12
11
|
|
|
13
12
|
## The browser of the test
|
|
14
13
|
- Before the first run, you MUST make the browser of the test get the same page as the browser that ForgeQE used.
|
|
@@ -31,12 +30,8 @@ kind: fragment
|
|
|
31
30
|
- The build MUST NOT get more warnings.
|
|
32
31
|
- Page objects, components, and helpers MUST be generic. Each method takes the items that it acts on as parameters, and gives back what the test checks.
|
|
33
32
|
- You MUST NOT put test data, expected values, or URLs with query strings in page objects. You MUST make locators from the parameters.
|
|
34
|
-
- You MUST put the test data in the test's data-driving mechanism, not only as a const beside the steps
|
|
35
|
-
|
|
36
|
-
- pytest: `@pytest.mark.parametrize` or a data fixture; the test passes values into page objects.
|
|
37
|
-
- MSTest / NUnit / xUnit: `[DataRow]` / `[TestCase]` / `[Theory]`+`[InlineData]` (or the project's data source) on the test method; pass arguments into page objects.
|
|
38
|
-
- Playwright / Cypress without Gherkin: `test.each` / looped cases or the repository's data-file loader; the test body passes fields into page objects.
|
|
39
|
-
- When the handoff marks a fill or select as from test data NAME, you MUST use that name in that mechanism, with this run's value as the first row. You MUST NOT write this run's value as a string literal in a fill, type, or select call. You MUST NOT keep those values only as a const object in the same test file when the repository already has Examples, parametrize/DataRow/TestCase, fixtures, or a data folder.
|
|
33
|
+
- You MUST put the test data in the test's data-driving mechanism (Scenario Outline Examples, parametrize, DataRow/TestCase/InlineData, test.each, or the repository's data files), not only as a const beside the steps.
|
|
34
|
+
- When the handoff marks a step as from test data NAME, you MUST use that name in that mechanism, with this run's value as the first row, as the handoff's "How to place each NAME" says.
|
|
40
35
|
- You MUST calculate relative dates, such as "tomorrow", when the test runs.
|
|
41
36
|
|
|
42
37
|
## Live data
|
|
@@ -55,7 +50,7 @@ kind: fragment
|
|
|
55
50
|
- A helper that closes an overlay "if present" MAY ignore only the timeout of an overlay that did not show. Other errors MUST fail the test. After the click, the test MUST assert that the overlay is hidden.
|
|
56
51
|
- For a step marked ✗ in the handoff, you MUST use the locator that the handoff gives in its place.
|
|
57
52
|
- You MUST call the helper after each navigation, and immediately before each step that opens a thing, such as a date picker or a menu.
|
|
58
|
-
- You MUST NOT use overlay handlers or a combined locator (locator.or) for two or more overlays
|
|
53
|
+
- You MUST NOT use overlay handlers or a combined locator (locator.or) for two or more overlays: shown together, one blocks the other's click, and a combined locator fails strict mode.
|
|
59
54
|
- You MUST do the flow again, not the tries of the agent.
|
|
60
55
|
- A site can give different versions of a page to different visits (A/B tests). When you see a different version, you MUST write steps that work on each version.
|
|
61
56
|
- You SHOULD find elements by what the versions have in common (role and accessible name). You MUST say in notes which versions you saw.
|
|
@@ -18,7 +18,7 @@ from dataclasses import dataclass, field
|
|
|
18
18
|
from typing import Any, Callable, Dict, Iterable, List, Mapping, Optional, Protocol
|
|
19
19
|
|
|
20
20
|
from .apps import AppSpec, resolve_app
|
|
21
|
-
from .workflow import MOBILE_FORMAT, MOBILE_RETRY_OPS, RETRY_OPS, WorkflowError, env_secret, fill, fill_targets, parse_chord, secret_names, validate
|
|
21
|
+
from .workflow import MAX_PICK, MOBILE_FORMAT, new_run_unique, MOBILE_RETRY_OPS, RETRY_OPS, WorkflowError, env_secret, fill, fill_targets, parse_chord, secret_names, validate
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
class ControlNotFound(LookupError):
|
|
@@ -113,6 +113,8 @@ def replay(
|
|
|
113
113
|
open_link: Optional[Callable[[str, float], None]] = None,
|
|
114
114
|
) -> ReplayResult:
|
|
115
115
|
wf = validate(dict(workflow))
|
|
116
|
+
# A {{$unique}} of its own for each replay (each row of a data file too).
|
|
117
|
+
new_run_unique()
|
|
116
118
|
spec = resolve_app(wf["app"], apps, must_exist=must_exist)
|
|
117
119
|
allowed = {str(n) for n in allowed_secrets}
|
|
118
120
|
values: Dict[str, Any] = {**wf["variables"], **dict(variables or {})}
|
|
@@ -328,6 +330,8 @@ class _Runner:
|
|
|
328
330
|
# A point inside the control (what the app draws there has no control of its own).
|
|
329
331
|
control = self.find(step["target"], timeout, ready=True)
|
|
330
332
|
driver.tap_point(control, step["at"], double=op == "double_tap", hold=op == "long_press") # type: ignore[attr-defined]
|
|
333
|
+
elif op in ("tap", "double_tap") and "choice" in step:
|
|
334
|
+
self._choose(step, timeout, double=op == "double_tap")
|
|
331
335
|
elif op in ("tap", "double_tap"):
|
|
332
336
|
driver.click(self.find(step["target"], timeout, ready=True), double=op == "double_tap")
|
|
333
337
|
elif op == "long_press":
|
|
@@ -336,6 +340,8 @@ class _Runner:
|
|
|
336
340
|
self._wait_for(step, timeout)
|
|
337
341
|
elif op == "expect_image":
|
|
338
342
|
self._expect_image(index, step, timeout)
|
|
343
|
+
elif op in ("click", "double_click") and "choice" in step:
|
|
344
|
+
self._choose(step, timeout, double=op == "double_click")
|
|
339
345
|
else:
|
|
340
346
|
control = self.find(step["target"], timeout, ready=op in ("click", "double_click", "type", "select", "set_checked"))
|
|
341
347
|
if op in ("click", "double_click"):
|
|
@@ -356,6 +362,47 @@ class _Runner:
|
|
|
356
362
|
raise AssertionError("the control's text does not contain the expected value (it holds a secret, so it is not shown)")
|
|
357
363
|
raise AssertionError(f"expected {want!r} in the control's text, found {got!r}")
|
|
358
364
|
|
|
365
|
+
def _choose(self, step: Mapping[str, Any], timeout: float, double: bool = False) -> None:
|
|
366
|
+
"""
|
|
367
|
+
A click the review made data: test data or a date clicks the control of that name; "any" the first visible,
|
|
368
|
+
enabled control of its type inside its parent, never one the app greys out. What it clicked is kept as
|
|
369
|
+
{{keep}}, for later steps' text.
|
|
370
|
+
"""
|
|
371
|
+
choice = step["choice"]
|
|
372
|
+
target = step["target"]
|
|
373
|
+
if choice["how"] != "any":
|
|
374
|
+
control = self.find(target, timeout, ready=True)
|
|
375
|
+
self.driver.click(control, double=double)
|
|
376
|
+
self.values[choice["keep"]] = str(target.get("name") or "")
|
|
377
|
+
return
|
|
378
|
+
ready = getattr(self.driver, "wait_ready", None)
|
|
379
|
+
if ready is None:
|
|
380
|
+
raise WorkflowError("this driver cannot tell an enabled control from a greyed-out one, so it cannot choose any free one")
|
|
381
|
+
for i in range(MAX_PICK):
|
|
382
|
+
try:
|
|
383
|
+
# The first waits as a step does (the list may still be loading); the rest are there already or not at all.
|
|
384
|
+
control = self.find({**target, "index": i}, timeout if i == 0 else 1.0)
|
|
385
|
+
except ControlNotFound:
|
|
386
|
+
# None at all is a control not found (healing may find where they went), not "none is free".
|
|
387
|
+
if i == 0:
|
|
388
|
+
raise
|
|
389
|
+
break
|
|
390
|
+
try:
|
|
391
|
+
ready(control, 0)
|
|
392
|
+
except TimeoutError:
|
|
393
|
+
continue
|
|
394
|
+
except Exception:
|
|
395
|
+
continue
|
|
396
|
+
name = ""
|
|
397
|
+
try:
|
|
398
|
+
name = " ".join(str(self.driver.text_of(control) or "").split())[:200]
|
|
399
|
+
except Exception:
|
|
400
|
+
pass
|
|
401
|
+
self.driver.click(control, double=double)
|
|
402
|
+
self.values[choice["keep"]] = name
|
|
403
|
+
return
|
|
404
|
+
raise AssertionError(f"no {target.get('control_type') or 'control'} there is free to choose: every one is greyed out or hidden")
|
|
405
|
+
|
|
359
406
|
def _set_checked(self, control: Any, want: bool, timeout: float) -> None:
|
|
360
407
|
"""A checkbox, switch or radio button left ``want``: tapped only when it is not so already, then confirmed."""
|
|
361
408
|
driver = self.driver
|
|
@@ -44,8 +44,8 @@ _MOBILE_STEP_KEYS = {
|
|
|
44
44
|
# The newest magic link the login's site sent to its mailbox, opened on the device (forgeqe_mobile/magiclink.py).
|
|
45
45
|
"open_link": {"login"},
|
|
46
46
|
# at: [x, y] inside the target in thousandths of its width and height, for what the app draws with no control.
|
|
47
|
-
"tap": {"target", "at"},
|
|
48
|
-
"double_tap": {"target", "at"},
|
|
47
|
+
"tap": {"target", "at", "choice"},
|
|
48
|
+
"double_tap": {"target", "at", "choice"},
|
|
49
49
|
"long_press": {"target", "at"},
|
|
50
50
|
"type": {"target", "text"},
|
|
51
51
|
# Opens the target (a drop-down) and picks the item that shows `value`.
|
|
@@ -75,8 +75,8 @@ MAX_IGNORE = 20
|
|
|
75
75
|
LOCATOR_KEYS = ("automation_id", "name", "control_type", "class_name", "index", "path")
|
|
76
76
|
_STEP_KEYS = {
|
|
77
77
|
"launch": set(),
|
|
78
|
-
"click": {"target"},
|
|
79
|
-
"double_click": {"target"},
|
|
78
|
+
"click": {"target", "choice"},
|
|
79
|
+
"double_click": {"target", "choice"},
|
|
80
80
|
"type": {"target", "text"},
|
|
81
81
|
"select": {"target", "value"},
|
|
82
82
|
"keys": {"keys"},
|
|
@@ -106,6 +106,54 @@ NAMED_KEYS = (
|
|
|
106
106
|
REFUSED_KEYS = ("win", "lwin", "rwin", "windows", "super", "meta", "cmd", "apps", "menu")
|
|
107
107
|
|
|
108
108
|
|
|
109
|
+
# A click (a tap) the review made data (src/web/desktop.ts dataChanges; the web's src/record/choice.ts): its target's
|
|
110
|
+
# name is test data ({{keep}}) or a date from today ({{$date:+N:FORMAT}}), or "any" clicks the first enabled control of
|
|
111
|
+
# its type inside its parent. The replay keeps what it clicked as {{keep}}; `was` is the target as recorded.
|
|
112
|
+
CHOICE_HOWS = ("data", "date", "any")
|
|
113
|
+
# Controls "any" looks through at most.
|
|
114
|
+
MAX_PICK = 50
|
|
115
|
+
# {{$date:+N:FORMAT}}: N days from the day of the run, in a format of the tokens below (never strftime's, which differ
|
|
116
|
+
# between systems and read the locale).
|
|
117
|
+
_DATE_REF = re.compile(r"^\$date:([+-])(\d{1,4}):([^{}\n]{1,80})$")
|
|
118
|
+
_MONTHS = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
|
|
119
|
+
_DAYS = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
# {{$unique}}: a part new on each replay (an email or a name that must not repeat), the same everywhere in one replay.
|
|
123
|
+
_UNIQUE: List[str] = []
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def new_run_unique() -> str:
|
|
127
|
+
"""A fresh {{$unique}} for the replay that starts now: base 36 of the time and a few random letters."""
|
|
128
|
+
import secrets as _secrets
|
|
129
|
+
|
|
130
|
+
digits = "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
131
|
+
n, out = int(time.time() * 1000), ""
|
|
132
|
+
while n:
|
|
133
|
+
n, r = divmod(n, 36)
|
|
134
|
+
out = digits[r] + out
|
|
135
|
+
_UNIQUE[:] = [out + "".join(_secrets.choice(digits) for _ in range(4))]
|
|
136
|
+
return _UNIQUE[0]
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def date_text(days: int, fmt: str, today: Optional["date"] = None) -> str:
|
|
140
|
+
"""The date ``days`` from ``today`` in ``fmt``: %Y %m %d, %e the day without a zero, %o its ending, month and day names."""
|
|
141
|
+
from datetime import date, timedelta
|
|
142
|
+
|
|
143
|
+
d = (today or date.today()) + timedelta(days=days)
|
|
144
|
+
|
|
145
|
+
def one(m: "re.Match[str]") -> str:
|
|
146
|
+
k = m.group(1)
|
|
147
|
+
n = d.day
|
|
148
|
+
return {
|
|
149
|
+
"Y": str(d.year), "m": f"{d.month:02d}", "d": f"{n:02d}", "e": str(n),
|
|
150
|
+
"o": "th" if 11 <= n % 100 <= 13 else {1: "st", 2: "nd", 3: "rd"}.get(n % 10, "th"),
|
|
151
|
+
"B": _MONTHS[d.month - 1], "b": _MONTHS[d.month - 1][:3], "A": _DAYS[d.weekday()], "a": _DAYS[d.weekday()][:3],
|
|
152
|
+
}[k]
|
|
153
|
+
|
|
154
|
+
return re.sub(r"%([YmdeoBbAa])", one, fmt)
|
|
155
|
+
|
|
156
|
+
|
|
109
157
|
class WorkflowError(ValueError):
|
|
110
158
|
"""A workflow that cannot run as written; the message says which step and why."""
|
|
111
159
|
|
|
@@ -171,7 +219,7 @@ MAX_FALLBACKS = 4
|
|
|
171
219
|
_ANCHOR_KEYS = ("automation_id", "name")
|
|
172
220
|
|
|
173
221
|
|
|
174
|
-
def _check_target(where: str, target: Any, mobile: bool = False, fallback: bool = False) -> Dict[str, Any]:
|
|
222
|
+
def _check_target(where: str, target: Any, mobile: bool = False, fallback: bool = False, pick: bool = False) -> Dict[str, Any]:
|
|
175
223
|
if not isinstance(target, dict):
|
|
176
224
|
raise WorkflowError(f"{where}: target must be a mapping of UIA properties")
|
|
177
225
|
allowed = set(LOCATOR_KEYS) | ({"within", "web"} | (set() if fallback else {"fallbacks"}) if mobile else set())
|
|
@@ -203,7 +251,13 @@ def _check_target(where: str, target: Any, mobile: bool = False, fallback: bool
|
|
|
203
251
|
target = {k: v for k, v in target.items() if k not in MOBILE_LOCATOR_KEYS}
|
|
204
252
|
if "web" in out_extra:
|
|
205
253
|
return {**target, **out_extra}
|
|
206
|
-
if
|
|
254
|
+
if pick:
|
|
255
|
+
# Any of a kind: by its control type inside its parent (a path, or the ancestor it is within), never one by name.
|
|
256
|
+
if target.get("automation_id") or target.get("name") or "index" in target:
|
|
257
|
+
raise WorkflowError(f"{where}: a choice of any one names no automation_id, name or index: it takes the first enabled one")
|
|
258
|
+
if not str(target.get("control_type") or "").strip() or not (target.get("path") or out_extra.get("within")):
|
|
259
|
+
raise WorkflowError(f"{where}: a choice of any one needs a control_type, inside a path or within its parent")
|
|
260
|
+
elif not str(target.get("automation_id") or "").strip() and not str(target.get("name") or "").strip():
|
|
207
261
|
raise WorkflowError(f"{where}: target needs an automation_id or a name")
|
|
208
262
|
for k in ("automation_id", "name", "control_type", "class_name"):
|
|
209
263
|
if k in target and not isinstance(target[k], str):
|
|
@@ -287,8 +341,19 @@ def validate(doc: Any) -> Dict[str, Any]:
|
|
|
287
341
|
if missing:
|
|
288
342
|
raise WorkflowError(f"{where} ({op}) needs {', '.join(sorted(missing))}")
|
|
289
343
|
clean: Dict[str, Any] = {"op": op}
|
|
344
|
+
choice = step.get("choice")
|
|
345
|
+
if "choice" in step:
|
|
346
|
+
if not isinstance(choice, dict) or set(choice) - {"how", "keep", "was"} or choice.get("how") not in CHOICE_HOWS:
|
|
347
|
+
raise WorkflowError(f"{where}: choice is {{how: data | date | any, keep: a variable's name, was: the target as recorded}}")
|
|
348
|
+
if not isinstance(choice.get("keep"), str) or not _VAR_NAME.match(choice["keep"]):
|
|
349
|
+
raise WorkflowError(f"{where}: choice.keep is a variable's name (letters, digits and _)")
|
|
350
|
+
if "at" in step:
|
|
351
|
+
raise WorkflowError(f"{where}: a choice clicks a control, not a point in it")
|
|
352
|
+
clean["choice"] = {"how": choice["how"], "keep": choice["keep"], **({"was": _check_target(f"{where} (choice.was)", choice["was"], mobile)} if "was" in choice else {})}
|
|
290
353
|
if "target" in step:
|
|
291
|
-
clean["target"] = _check_target(where, step["target"], mobile)
|
|
354
|
+
clean["target"] = _check_target(where, step["target"], mobile, pick=isinstance(choice, dict) and choice.get("how") == "any")
|
|
355
|
+
if isinstance(choice, dict) and choice.get("how") in ("data", "date") and "{{" not in str(clean["target"].get("name") or ""):
|
|
356
|
+
raise WorkflowError(f"{where}: a choice of test data or a date names its control by {{{{…}}}}")
|
|
292
357
|
if "to" in step:
|
|
293
358
|
clean["to"] = _check_target(f"{where} (to)", step["to"], mobile)
|
|
294
359
|
for k in ("text", "value"):
|
|
@@ -396,6 +461,13 @@ def fill(text: str, variables: Mapping[str, Any], secret: Callable[[str], Option
|
|
|
396
461
|
|
|
397
462
|
def one(m: "re.Match[str]") -> str:
|
|
398
463
|
ref = m.group(1)
|
|
464
|
+
if ref == "$unique":
|
|
465
|
+
return _UNIQUE[0] if _UNIQUE else new_run_unique()
|
|
466
|
+
if ref.startswith("$date:"):
|
|
467
|
+
when = _DATE_REF.match(ref)
|
|
468
|
+
if not when:
|
|
469
|
+
raise WorkflowError(f"{{{{{ref}}}}} is not a date: {{{{$date:+N:FORMAT}}}}")
|
|
470
|
+
return date_text(int(when.group(2)) * (-1 if when.group(1) == "-" else 1), when.group(3))
|
|
399
471
|
if ref.startswith("secret:") or ref.startswith("totp:"):
|
|
400
472
|
kind, name = ref.split(":", 1)
|
|
401
473
|
name = name.strip()
|
|
@@ -19,6 +19,7 @@ from typing import Any, Dict, List, Optional
|
|
|
19
19
|
from browser_use import ActionResult, BrowserSession
|
|
20
20
|
|
|
21
21
|
from . import userlike
|
|
22
|
+
from .d365 import clean_facts as d365_clean_facts, page_config as d365_page_config
|
|
22
23
|
from .memory import BASE, KEPT_ATTRS, candidate_locators, confidence, has_icons, looks_generated, playwright_role_ok, state_class
|
|
23
24
|
|
|
24
25
|
logger = logging.getLogger("forgeqe_engine.capture")
|
|
@@ -253,7 +254,8 @@ _VERIFY_FN = r"""function(locs) {
|
|
|
253
254
|
if (!all) return null;
|
|
254
255
|
// Every match, hidden ones too: Playwright's strict mode counts them, so a locator with a hidden copy (a
|
|
255
256
|
// consent tool's second "Accept all" in a closed menu) throws on click though one match shows.
|
|
256
|
-
|
|
257
|
+
// `up` (d365.py): a locator of the D365 control the element is inside (an app tile, for a click on its name).
|
|
258
|
+
return { count: all.length, target: all.length === 1 && (all[0] === el || within(el, all[0]) || (l.up === true && within(all[0], el))) };
|
|
257
259
|
} catch (e) { return { count: -1, target: false }; }
|
|
258
260
|
});
|
|
259
261
|
// What Playwright's getByRole reads for the element's role: its tag, href and role attribute.
|
|
@@ -384,10 +386,21 @@ async def _contains(cdp: Any, object_id: str, backend_node_id: int) -> bool:
|
|
|
384
386
|
|
|
385
387
|
|
|
386
388
|
# Facts (as memory.element_facts gives them) for an element reached through CDP rather than the agent's element list.
|
|
387
|
-
_FACTS_FN = r"""function(kept) {
|
|
389
|
+
_FACTS_FN = r"""function(kept, d365) {
|
|
388
390
|
const el = this;
|
|
389
391
|
const attrs = {};
|
|
390
392
|
for (const k of kept) { const v = el.getAttribute(k); if (v) attrs[k] = v; }
|
|
393
|
+
// A Dynamics 365 page (d365.py, ADO 3529): its own attributes, and the D365 control the element is inside.
|
|
394
|
+
let site = '', d365Up = null;
|
|
395
|
+
try { if (d365 && (new RegExp(d365.host, 'i').test(location.hostname) || document.getElementById(d365.shell))) site = 'd365'; } catch (e) {}
|
|
396
|
+
const d365Attrs = (x) => { const a = {}; for (const k of d365.attrs) { const v = x.getAttribute(k); if (v) a[k] = v.slice(0, 200); } if (a['data-type'] && a['data-type'] !== 'app-title') delete a['data-type']; return a; };
|
|
397
|
+
if (site) {
|
|
398
|
+
Object.assign(attrs, d365Attrs(el));
|
|
399
|
+
for (let x = el.parentElement, i = 0; x && i < d365.up && x !== document.body; x = x.parentElement, i++) {
|
|
400
|
+
const a = d365Attrs(x);
|
|
401
|
+
if (Object.keys(a).length) { const t = x.getAttribute('title'); if (t) a.title = t.slice(0, 200); d365Up = { tag: x.tagName.toLowerCase(), attributes: a }; break; }
|
|
402
|
+
}
|
|
403
|
+
}
|
|
391
404
|
// None inside a shadow root: an XPath cannot reach into one, so it would find nothing when the test runs.
|
|
392
405
|
const xp = (e) => e.getRootNode() !== document ? '' : xpFrom(e);
|
|
393
406
|
const xpFrom = (e) => { const parts = []; for (; e && e.nodeType === 1; e = e.parentElement) { let i = 1; for (let s = e.previousElementSibling; s; s = s.previousElementSibling) if (s.tagName === e.tagName) i++; parts.unshift(e.tagName.toLowerCase() + '[' + i + ']'); } return parts.join('/'); };
|
|
@@ -408,6 +421,7 @@ _FACTS_FN = r"""function(kept) {
|
|
|
408
421
|
const out = { tag: el.tagName.toLowerCase(), attributes: attrs, classes, xpath: xp(el), text: String(el.innerText || el.textContent || '').replace(/\s+/g, ' ').trim().slice(0, 120) };
|
|
409
422
|
if (scope) out.scope = scope;
|
|
410
423
|
if (frame) out.frame = frame;
|
|
424
|
+
if (site) { out.site = site; if (d365Up) out.d365_up = d365Up; }
|
|
411
425
|
// Icon characters drawn by CSS (an icon font's ::before): Playwright counts them in the name, the browser's own
|
|
412
426
|
// accessibility tree drops them. Only characters of the private use area, a few.
|
|
413
427
|
let icons = '';
|
|
@@ -428,9 +442,10 @@ async def element_facts_cdp(session: Any, backend_node_id: int) -> Optional[Dict
|
|
|
428
442
|
return None
|
|
429
443
|
res = await _send(
|
|
430
444
|
cdp, "Runtime", "callFunctionOn",
|
|
431
|
-
{"objectId": object_id, "functionDeclaration": _FACTS_FN, "arguments": [{"value": list(KEPT_ATTRS)}], "returnByValue": True},
|
|
445
|
+
{"objectId": object_id, "functionDeclaration": _FACTS_FN, "arguments": [{"value": list(KEPT_ATTRS)}, {"value": d365_page_config()}], "returnByValue": True},
|
|
432
446
|
)
|
|
433
|
-
|
|
447
|
+
# Read as untrusted: D365's parts only in their shapes, and only on a D365 page (d365.clean_facts).
|
|
448
|
+
facts = d365_clean_facts((res.get("result") or {}).get("value") or {})
|
|
434
449
|
# Build-generated class names (b87c397a13, css-1x2y3z) change with the site's next deploy.
|
|
435
450
|
facts["classes"] = [c for c in facts.get("classes") or [] if not looks_generated(c) and not state_class(c)]
|
|
436
451
|
ax = await _send(cdp, "Accessibility", "getPartialAXTree", {"backendNodeId": backend_node_id, "fetchRelatives": False})
|
package/py/forgeqe_engine/cli.py
CHANGED
|
@@ -8,7 +8,7 @@ Engine process protocol, used by the Bun CLI:
|
|
|
8
8
|
stderr engine logs
|
|
9
9
|
|
|
10
10
|
python -m forgeqe_engine run
|
|
11
|
-
python -m forgeqe_engine login (stdin: {url, logins}, then "save")
|
|
11
|
+
python -m forgeqe_engine login (stdin: {url, logins}, then "save" until saved, or "stop")
|
|
12
12
|
python -m forgeqe_engine record (stdin: {start_url, out_dir, ...}, then commands; "stop" or EOF ends it)
|
|
13
13
|
python -m forgeqe_engine code (stdin: {login, since}; prints {"type": "done", "result": {success, code | error}})
|
|
14
14
|
python -m forgeqe_engine doctor
|
|
@@ -147,7 +147,10 @@ def _run(out: TextIO) -> int:
|
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
def _login(out: TextIO) -> int:
|
|
150
|
-
"""
|
|
150
|
+
"""
|
|
151
|
+
stdin line 1: {url, logins: [login]}; then each "save" tries to save the session (the browser stays open while
|
|
152
|
+
there is nothing of the login's sites to save yet), and "stop" or EOF cancels.
|
|
153
|
+
"""
|
|
151
154
|
from .logins import interactive_login
|
|
152
155
|
|
|
153
156
|
line = sys.stdin.readline()
|
|
@@ -159,21 +162,20 @@ def _login(out: TextIO) -> int:
|
|
|
159
162
|
|
|
160
163
|
async def main() -> int:
|
|
161
164
|
loop = asyncio.get_running_loop()
|
|
162
|
-
|
|
165
|
+
commands: "asyncio.Queue[str]" = asyncio.Queue()
|
|
163
166
|
|
|
164
167
|
def watch_stdin() -> None:
|
|
165
168
|
for cmd in sys.stdin:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
word = cmd.strip().lower()
|
|
170
|
+
if word == "save":
|
|
171
|
+
loop.call_soon_threadsafe(commands.put_nowait, "save")
|
|
172
|
+
elif word == "stop":
|
|
170
173
|
break
|
|
171
|
-
|
|
172
|
-
loop.call_soon_threadsafe(finished.set)
|
|
174
|
+
loop.call_soon_threadsafe(commands.put_nowait, "stop")
|
|
173
175
|
|
|
174
176
|
threading.Thread(target=watch_stdin, daemon=True).start()
|
|
175
177
|
try:
|
|
176
|
-
result = await interactive_login(payload, emit,
|
|
178
|
+
result = await interactive_login(payload, emit, commands.get)
|
|
177
179
|
except Exception as e:
|
|
178
180
|
result = {"success": False, "error": str(e)}
|
|
179
181
|
emit({"type": "done", "result": result})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
A host that asks the browser for a client certificate while recording (ADO 3529).
|
|
3
|
+
|
|
4
|
+
Entra ID's device sign-in (device.login.microsoftonline.com) asks Chrome for the computer's device certificate, and
|
|
5
|
+
Chrome shows its own "Select a certificate" box: no page script or DevTools event sees it. The request to that host
|
|
6
|
+
is what the recorder sees, so the recording keeps one `client_certificate` step for it, by host and the issuer of the
|
|
7
|
+
certificate that answers, both fixed here (never a value from the page). A replay gets past it only when the
|
|
8
|
+
computer's Chrome policy picks the certificate (src/engine/certpolicy.ts, `forgeqe doctor certificate`).
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import Optional
|
|
13
|
+
from urllib.parse import urlparse
|
|
14
|
+
|
|
15
|
+
# Kept in step with CLIENT_CERT_HOSTS in src/engine/certpolicy.ts.
|
|
16
|
+
CLIENT_CERT_HOSTS = {"device.login.microsoftonline.com": "MS-Organization-Access"}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def client_cert_host(url: str) -> Optional[str]:
|
|
20
|
+
"""The host of CLIENT_CERT_HOSTS a request goes to over https, exactly; else None."""
|
|
21
|
+
try:
|
|
22
|
+
p = urlparse(url or "")
|
|
23
|
+
host = (p.hostname or "").lower()
|
|
24
|
+
except Exception:
|
|
25
|
+
return None
|
|
26
|
+
if p.scheme != "https" or p.username or p.password or p.port not in (None, 443):
|
|
27
|
+
return None
|
|
28
|
+
return host if host in CLIENT_CERT_HOSTS else None
|