@capagents/forgeqe 3.4.2 → 3.4.4
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/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/web-app/index.html +11 -2
- package/dist/forgeqe.js +1979 -1970
- package/dist/template.html +43 -43
- package/dist/web/assets/{3d-force-graph-B-g_aIro.js → 3d-force-graph-DwblDu4y.js} +1 -1
- package/dist/web/assets/{Agent-C5oBtGk7.js → Agent-C8WdS1HB.js} +10 -10
- package/dist/web/assets/{AgentWork-DJ8Vs06n.js → AgentWork-C1Qa_Ftb.js} +1 -1
- package/dist/web/assets/ApiTests-u4tzlJaD.js +17 -0
- package/dist/web/assets/{Browse-DLECqaFU.js → Browse-B0ZTvpo2.js} +1 -1
- package/dist/web/assets/Chat-B73XMxdf.js +3 -0
- package/dist/web/assets/CommandPalette-D7ld-tbJ.js +1 -0
- package/dist/web/assets/{Compare-DaIqZceW.js → Compare-CxGjAZW0.js} +1 -1
- package/dist/web/assets/Cost-BeVu3Z6g.js +1 -0
- package/dist/web/assets/{Data-DSoaKTFT.js → Data-BPyCT0eP.js} +4 -4
- package/dist/web/assets/Desktop-qPGc2OWb.js +1 -0
- package/dist/web/assets/DesktopReview-CVoC6bQY.js +2 -0
- package/dist/web/assets/DeviceScreen-DDERg3YQ.js +1 -0
- package/dist/web/assets/Evidence-CtUiUCa6.js +1 -0
- package/dist/web/assets/{Explore-CnsxID-z.js → Explore-BvjAhqyo.js} +2 -2
- package/dist/web/assets/Features-CmQCxEJX.js +1 -0
- package/dist/web/assets/{Flags-KtTYNU6g.js → Flags-asj8tiKy.js} +2 -2
- package/dist/web/assets/Flaky-ChYK151U.js +1 -0
- package/dist/web/assets/Impact-B1-B2oHr.js +3 -0
- package/dist/web/assets/{Jobs-Fj0wBOAO.js → Jobs-CZ2k5hGk.js} +3 -3
- package/dist/web/assets/{KindPage--MHC32ho.js → KindPage-CDfvpDXP.js} +3 -3
- package/dist/web/assets/LiveDevice-B33XU61P.js +1 -0
- package/dist/web/assets/Migration-BBM_Sce0.js +8 -0
- package/dist/web/assets/Mobile-BzufjlBb.js +1 -0
- package/dist/web/assets/Observability-qcx5vrNO.js +1 -0
- package/dist/web/assets/{OwnItems-BWX70VhE.js → OwnItems-BkoHG_xw.js} +3 -3
- package/dist/web/assets/PageAgent-Do62EBze.js +1 -0
- package/dist/web/assets/Product-9ImZUA2B.js +6 -0
- package/dist/web/assets/Production-B6uigaYJ.js +1 -0
- package/dist/web/assets/Quality-Cw6qhXyl.js +1 -0
- package/dist/web/assets/Readiness-D8WMgQmd.js +1 -0
- package/dist/web/assets/Record-DCcHfH7u.js +1 -0
- package/dist/web/assets/Regression-BLlXnCW2.js +5 -0
- package/dist/web/assets/RelationGraph-BxJgWpp6.js +1 -0
- package/dist/web/assets/Reports-ZNS4Vjz8.js +2 -0
- package/dist/web/assets/{Requirements-BRXFZQuu.js → Requirements-CtQLSXK2.js} +2 -2
- package/dist/web/assets/Responsive-KaTTxiwX.js +3 -0
- package/dist/web/assets/RunDiff-CpvrxBX1.js +1 -0
- package/dist/web/assets/Settings-C5CTbhlT.js +21 -0
- package/dist/web/assets/SiteScan-CUMCTEY9.js +5 -0
- package/dist/web/assets/Steps-C440M1Y_.js +2 -0
- package/dist/web/assets/{TestData-4P28hX0Q.js → TestData-7rivojlz.js} +2 -2
- package/dist/web/assets/TestManagement-Dj5JHPIU.js +4 -0
- package/dist/web/assets/WhatsNew-xAi2Rzo3.js +1 -0
- package/dist/web/assets/{agentSettingsSheet-ElGgFEeo.js → agentSettingsSheet-D12LwTAe.js} +1 -1
- package/dist/web/assets/answer-BCM85AEe.js +99 -0
- package/dist/web/assets/api-CorvgyDj.js +1 -0
- package/dist/web/assets/{dataParts-_MZY-U_N.js → dataParts-CVXmPBpU.js} +3 -3
- package/dist/web/assets/desktopAppPath-D_PfQisd.js +1 -0
- package/dist/web/assets/{flowTheme-BcMJKyow.js → flowTheme-bdKXfQiL.js} +1 -1
- package/dist/web/assets/frame-BC1vOowF.js +139 -0
- package/dist/web/assets/index-BoFziUZw.js +47 -0
- package/dist/web/assets/index-iQkL5bWO.css +2 -0
- package/dist/web/assets/{nav-DRpijFeN.js → nav--1SY7-OO.js} +1 -1
- package/dist/web/assets/{pageBack-CINGjBHZ.js → pageBack-DDAAmq4R.js} +7 -7
- package/dist/web/assets/palette-C8W4Fd5n.js +1 -0
- package/dist/web/assets/{paletteCommands-Bx61jZay.js → paletteCommands-DdFd3e0-.js} +1 -1
- package/dist/web/assets/parts-uc6us_OU.js +1 -0
- package/dist/web/assets/{productParts-Pp0gh7QX.js → productParts-CAgJEF8_.js} +1 -1
- package/dist/web/assets/qualityParts-BF3Yb7Zl.js +3 -0
- package/dist/web/assets/{recordTest-S5MOLSrL.js → recordTest-KjXCSP7c.js} +1 -1
- package/dist/web/assets/sectionList-B6NF3ZMb.js +1 -0
- package/dist/web/assets/{stepper-B7sbuU1Q.js → stepper-CZL9ueYn.js} +1 -1
- package/dist/web/assets/{preload-helper-BupTYkQW.js → surface-c1kG1KPS.js} +1 -1
- package/dist/web/assets/wizardParts-Pzx0nTZ0.js +1 -0
- package/dist/web/index.html +9 -9
- package/docs/WEB_APP.md +12 -2
- package/forgeqe.example.yaml +4 -2
- package/package.json +1 -1
- package/py/forgeqe_engine/capture.py +36 -8
- package/py/forgeqe_engine/d365.py +263 -3
- package/py/forgeqe_engine/recordsession.py +2 -1
- package/py/forgeqe_engine/webrecord.py +3 -0
- package/py/forgeqe_engine/webrecord_page.py +34 -5
- package/skills/dynamics-365-automation/SKILL.md +12 -0
- package/dist/web/assets/ApiTests-BLCfYh51.js +0 -17
- package/dist/web/assets/Chat-Cv8DeS-_.js +0 -3
- package/dist/web/assets/CommandPalette-x_RA-vYW.js +0 -1
- package/dist/web/assets/Cost-CITIwCiU.js +0 -1
- package/dist/web/assets/Desktop-CSaj8gd9.js +0 -1
- package/dist/web/assets/DesktopReview-Dz5XOBgo.js +0 -2
- package/dist/web/assets/DeviceScreen-BHmTd9Q-.js +0 -1
- package/dist/web/assets/Evidence-WRJ5Ocx1.js +0 -1
- package/dist/web/assets/Features-Do6F_oaP.js +0 -1
- package/dist/web/assets/Flaky-BBPNCZOq.js +0 -1
- package/dist/web/assets/Impact-DXpXmLyE.js +0 -3
- package/dist/web/assets/LiveDevice-CuJzvCUi.js +0 -1
- package/dist/web/assets/Migration-6aYe_2EG.js +0 -8
- package/dist/web/assets/Mobile-Dv6f7u3D.js +0 -1
- package/dist/web/assets/Observability-Dqb01Eyo.js +0 -1
- package/dist/web/assets/PageAgent-CPVv-rb3.js +0 -1
- package/dist/web/assets/Product-Bg8GLZO1.js +0 -6
- package/dist/web/assets/Production-D_-UKwAW.js +0 -1
- package/dist/web/assets/Quality-AK4ooDrk.js +0 -1
- package/dist/web/assets/Readiness-oW5ApJNH.js +0 -1
- package/dist/web/assets/Record-DB3vbV-C.js +0 -1
- package/dist/web/assets/Regression-DuYa0h-o.js +0 -5
- package/dist/web/assets/RelationGraph-CrEnF6ZB.js +0 -1
- package/dist/web/assets/Reports-1mP0MxVQ.js +0 -2
- package/dist/web/assets/Responsive-CnoYMfsl.js +0 -3
- package/dist/web/assets/RunDiff-Wro2Olyz.js +0 -1
- package/dist/web/assets/Settings-DBCDjRxF.js +0 -21
- package/dist/web/assets/SiteScan-BkdOUe_S.js +0 -5
- package/dist/web/assets/Steps-ndafqk8T.js +0 -2
- package/dist/web/assets/TestManagement-Dohg2yyF.js +0 -4
- package/dist/web/assets/WhatsNew-Bcv9S0Tj.js +0 -1
- package/dist/web/assets/api-B8AQ8-Gb.js +0 -1
- package/dist/web/assets/desktopAppPath-Mg0cuo3X.js +0 -1
- package/dist/web/assets/frame-wloj3-xC.js +0 -139
- package/dist/web/assets/index-BCu9qAny.js +0 -47
- package/dist/web/assets/index-BEY6ZWQm.css +0 -2
- package/dist/web/assets/palette-DOQemIAv.js +0 -1
- package/dist/web/assets/parts-BNAiSyF0.js +0 -1
- package/dist/web/assets/qualityParts-diTrGtUR.js +0 -3
- package/dist/web/assets/sectionList-BPBmSZXk.js +0 -1
- package/dist/web/assets/wizardParts-OhFd_xL2.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{z as n}from"./surface-c1kG1KPS.js";import{t as r}from"./utils-DJRAScIl.js";import{t as i}from"./jsx-runtime-LKYXHABd.js";import{F as a,P as o}from"./pageBack-DDAAmq4R.js";import{Et as s,a as c,et as l,gr as u,lt as d}from"./line-icons-Cwj9OmCz.js";import"./choice-W0qOx_1k.js";import{t as f}from"./step-mark-Bu6fNKW8.js";import"./stepper-CZL9ueYn.js";var p=e(t(),1),m=i(),h=[s,l,u,d],g={playwright:`Microsoft`,cypress:`JavaScript only`,webdriverio:`WebDriver and BiDi`,selenium:`WebDriver`};function _({steps:e,at:t,reached:n,onGo:i}){return(0,m.jsx)(`nav`,{"aria-label":`Steps`,className:`min-w-0`,children:(0,m.jsx)(`ol`,{className:`m-0 flex list-none flex-wrap gap-4 p-0 @3xl:flex-col @3xl:flex-nowrap @3xl:gap-0`,children:e.map((o,s)=>{let c=s===t,l=s<n&&!c,u=s<=n&&!c,d=s===e.length-1,p=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:r(`text-body-sm leading-8 font-medium @3xl:hidden`,c||l?`text-ink`:`text-muted`),children:o.short}),(0,m.jsx)(`span`,{className:r(`hidden text-body-lg leading-8 font-medium @3xl:inline`,c||l?`text-ink`:u?`text-ink-2`:`text-muted`),children:o.name})]});return(0,m.jsxs)(`li`,{"aria-current":c?`step`:void 0,className:r(`relative flex min-w-0 gap-2 @3xl:gap-4 @3xl:pb-8`,d&&`@3xl:pb-0`),children:[!d&&(0,m.jsx)(`span`,{"aria-hidden":`true`,className:r(`absolute top-10 bottom-2 left-4 hidden w-px @3xl:block`,l?`bg-ink/30`:`bg-line`)}),(0,m.jsx)(f,{size:`lg`,state:l?`done`:c?`current`:`pending`,n:s+1}),(0,m.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[u?(0,m.jsx)(a,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":o.name,className:`w-fit justify-start text-left whitespace-normal`,children:p}):(0,m.jsx)(`span`,{children:p}),(0,m.jsx)(`span`,{className:r(`hidden text-body-sm leading-relaxed @3xl:block`,c?`text-ink-2`:`text-muted`),children:o.about}),o.answer&&(0,m.jsx)(`span`,{className:`sr-only flex min-w-0 flex-col gap-1 text-body-sm text-ink @3xl:not-sr-only @3xl:mt-2 @3xl:border-l-2 @3xl:border-line @3xl:pl-2`,children:o.answer}),l&&s<t&&(0,m.jsx)(a,{variant:`link`,size:`inline`,onClick:()=>i(s),"aria-label":`Change: ${o.name}`,className:`hidden min-h-8 w-fit @3xl:inline-flex`,children:`Change`})]})]},o.name)})})})}function v({id:e,label:t,help:n,children:r}){return(0,m.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,m.jsx)(`label`,{htmlFor:e,className:`text-body-sm font-medium`,children:t}),r,n&&(0,m.jsx)(`span`,{className:`text-body-sm text-muted`,children:n})]})}function y({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:o}){return(0,m.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-canvas py-4`,children:[(0,m.jsx)(`span`,{className:`min-w-0 flex-1 text-body-sm`,children:o}),t&&(0,m.jsxs)(a,{variant:`ghost`,disabled:e,onClick:t,children:[(0,m.jsx)(c,{"aria-hidden":`true`}),`Back`]}),(0,m.jsx)(a,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}function b({id:e,at:t,moved:r,children:i}){let a=h[t],s=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let e=s.current;r&&e&&(e.getBoundingClientRect().top<0&&e.scrollIntoView({block:`start`,behavior:n()}),e.focus({preventScroll:!0}))},[t,r]),(0,m.jsxs)(`h2`,{ref:s,id:e,tabIndex:-1,className:`m-0 flex scroll-mt-4 items-center gap-2 text-headline-sm outline-none`,children:[a&&(0,m.jsx)(o,{icon:a,size:18,className:`flex-none text-icon`}),(0,m.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:i})]})}export{b as a,_ as i,v as n,y as r,g as t};
|
package/dist/web/index.html
CHANGED
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
<!-- Light and dark both: before the app has set its mode, the page is the computer's (src/index.css, :root). -->
|
|
8
8
|
<meta name="color-scheme" content="light dark" />
|
|
9
9
|
<title>ForgeQE</title>
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-BoFziUZw.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/react-BDur5s0O.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="/assets/route-9BkoTWUE.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/utils-DJRAScIl.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-LKYXHABd.js">
|
|
16
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
16
|
+
<link rel="modulepreload" crossorigin href="/assets/surface-c1kG1KPS.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/line-icons-Cwj9OmCz.js">
|
|
18
|
-
<link rel="modulepreload" crossorigin href="/assets/sectionList-
|
|
19
|
-
<link rel="modulepreload" crossorigin href="/assets/api-
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/palette-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/nav-
|
|
18
|
+
<link rel="modulepreload" crossorigin href="/assets/sectionList-B6NF3ZMb.js">
|
|
19
|
+
<link rel="modulepreload" crossorigin href="/assets/api-CorvgyDj.js">
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/palette-C8W4Fd5n.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/nav--1SY7-OO.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/default-DB4ZMZxa.js">
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/pageBack-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/assets/frame-
|
|
25
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/pageBack-DDAAmq4R.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/assets/frame-BC1vOowF.js">
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-iQkL5bWO.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
package/docs/WEB_APP.md
CHANGED
|
@@ -160,7 +160,10 @@ files: each person's are in their own credential store.
|
|
|
160
160
|
narrow rail shows the Capgemini mark and its sections' icons: one opens the panel at that section.
|
|
161
161
|
|
|
162
162
|
**Atlas's mascot** sits at the bottom-right corner of every page except Home, a chat and Settings. It is the theme's
|
|
163
|
-
robot or character,
|
|
163
|
+
robot or character, the dotted orb when Settings › Appearance › Agents draws them as icons, or a large 3D orb that
|
|
164
|
+
moves with the work and with Talk's voice when it is set to **Icons, Atlas as the 3D orb**. Either orb is the same size
|
|
165
|
+
and moves with sound: Talk's voices while Talk is on, else the sound around you, which Settings › Voice › **The orb
|
|
166
|
+
reacts to sound around you** turns off (the browser asks once for the microphone; only how loud it is is read). Click it for a short chat with Atlas:
|
|
164
167
|
the last few turns, a box to write in, **Open the chat** for the whole conversation, and **Talk**. One conversation
|
|
165
168
|
follows you from page to page. Each message tells Atlas which page it was written on, so it hands the work to that
|
|
166
169
|
area's agent; while one has the work, the mascot is that agent's.
|
|
@@ -336,7 +339,7 @@ See [Reports from the agent](../HOW_TO_USE.md#reports-from-the-agent).
|
|
|
336
339
|
|
|
337
340
|
Settings takes over the window: one menu on the left, with **Back** and **Search settings** (by name or
|
|
338
341
|
`forgeqe.yaml` key), and the sections under Start, General, AI, Testing, Activity and Advanced. The ones most projects
|
|
339
|
-
change (Set up, Environments, Sign-ins, Secrets, Integrations, Notifications, Appearance, Voice, Models, Databases,
|
|
342
|
+
change (Set up, Environments, Sign-ins, Secrets, Integrations, Notifications, Appearance, Sample data, Voice, Models, Databases,
|
|
340
343
|
What's ready, What's new, Report a problem, About ForgeQE) are always listed; the others fold under **More settings**,
|
|
341
344
|
which opens by itself while one of them is open and stays as you leave it. Skills, Prompts and Guardrails are pages of
|
|
342
345
|
the sidebar (Knowledge), not sections here. On a
|
|
@@ -371,6 +374,13 @@ A moment, Longer) sets how long Talk waits when you pause before it answers; it
|
|
|
371
374
|
never leaves this computer: only the words reach your model. The browser asks once for the microphone; if it was
|
|
372
375
|
refused, allow it in the address bar and try again.
|
|
373
376
|
|
|
377
|
+
**Sample data** shows made-up example data on every page (runs, reports, recordings, quality results, product
|
|
378
|
+
knowledge, test management, custom agents and teams), so you can see what each feature looks like before anything has
|
|
379
|
+
run in the project. While it is on, a banner above every page says so, and anything that would change the work the
|
|
380
|
+
examples stand in for is refused with a note pointing back here; Settings, sign-ins, secrets and chats always stay the
|
|
381
|
+
project's own. The switch is kept by forgeqe web in ForgeQE's home (`web.json`), so it holds when forgeqe web starts
|
|
382
|
+
on another port.
|
|
383
|
+
|
|
374
384
|
**Appearance** gives the web app the project's look, for everyone who opens it: a logo (PNG, JPEG, WebP or SVG) and
|
|
375
385
|
a name for the sidebar, the sidebar's colour (primary, with an optional second colour it fades into), the colour of
|
|
376
386
|
buttons, links and selection (secondary), with lighter and darker shades made from it, and, in light mode, the page's
|
package/forgeqe.example.yaml
CHANGED
|
@@ -264,8 +264,10 @@ prompts:
|
|
|
264
264
|
# # where they would not show; phosphor's and solar's second tone (grey in
|
|
265
265
|
# # black) takes the colour's palest shade
|
|
266
266
|
# mascot: visor # visor (the default: a pastel robot with an LED face showing the agent's symbol) |
|
|
267
|
-
# # classic (a character in its job's outfit) | icons (the icons above)
|
|
268
|
-
# #
|
|
267
|
+
# # classic (a character in its job's outfit) | icons (the icons above) | orb (the
|
|
268
|
+
# # icons, and Atlas at the corner and on Home as a 3D orb that moves with the work
|
|
269
|
+
# # and with Talk's voice): how each agent is drawn from 22px up, in chat, on the
|
|
270
|
+
# # Agents pages and on Home
|
|
269
271
|
# mascot_colours: soft # soft (the default: pastels) | original (each agent's own colour)
|
|
270
272
|
# logo_size: auto # auto (the default: fitted to the logo's shape) | standard | large (a wide logo
|
|
271
273
|
# # across the sidebar's top, for one with small words)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capagents/forgeqe",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.4",
|
|
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": {
|
|
@@ -348,11 +348,15 @@ async def verify_locators(session: Any, backend_node_id: Optional[int], locators
|
|
|
348
348
|
loc["matches"], loc["verified"] = 0, False
|
|
349
349
|
continue
|
|
350
350
|
try:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
hits = []
|
|
352
|
+
# Asked by each name Chrome gives the role (an option of a <select> is its MenuListOption).
|
|
353
|
+
for chrome in chrome_roles(str(loc.get("role") or "")):
|
|
354
|
+
if loc.get("pattern"):
|
|
355
|
+
# By the pattern (a name with the state the page adds): every element of the role whose name it matches.
|
|
356
|
+
hits += await _ax_pattern_matches(cdp, chrome, str(loc["pattern"]), object_id)
|
|
357
|
+
else:
|
|
358
|
+
hits += await _ax_matches(cdp, chrome, str(loc.get("name") or ""), object_id)
|
|
359
|
+
hits = list(dict.fromkeys(hits))
|
|
356
360
|
except Exception:
|
|
357
361
|
continue
|
|
358
362
|
inside = len(hits) == 1 and (hits[0] == backend_node_id or await _contains(cdp, object_id, hits[0]))
|
|
@@ -426,7 +430,16 @@ _FACTS_FN = r"""function(kept, d365) {
|
|
|
426
430
|
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) };
|
|
427
431
|
if (scope) out.scope = scope;
|
|
428
432
|
if (frame) out.frame = frame;
|
|
429
|
-
if (site) {
|
|
433
|
+
if (site) {
|
|
434
|
+
out.site = site;
|
|
435
|
+
if (d365Up) out.d365_up = d365Up;
|
|
436
|
+
// The D365 names around it, itself first (d365.py control), as the page script reads them.
|
|
437
|
+
const path = [];
|
|
438
|
+
for (let x = el, i = 0; x && x.nodeType === 1 && i <= d365.path_up && x !== document.body && path.length < d365.path_max; x = x.parentElement, i++) {
|
|
439
|
+
for (const k of d365.path_attrs) { const v = x.getAttribute(k); if (v && path.length < d365.path_max) path.push([k, v.slice(0, 200)]); }
|
|
440
|
+
}
|
|
441
|
+
if (path.length) out.d365_path = path;
|
|
442
|
+
}
|
|
430
443
|
// Icon characters drawn by CSS (an icon font's ::before): Playwright counts them in the name, the browser's own
|
|
431
444
|
// accessibility tree drops them. Only characters of the private use area, a few.
|
|
432
445
|
let icons = '';
|
|
@@ -439,6 +452,21 @@ _FACTS_FN = r"""function(kept, d365) {
|
|
|
439
452
|
}"""
|
|
440
453
|
|
|
441
454
|
|
|
455
|
+
# Chrome's accessibility tree names some roles its own way; Playwright's getByRole uses the ARIA name. Read as Chrome
|
|
456
|
+
# names them, an image, a <select>'s option or its list had no locator by role at all.
|
|
457
|
+
CHROME_ROLES = {"image": "img", "MenuListOption": "option", "MenuListPopup": "listbox", "ListBoxOption": "option"}
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def playwright_role(role: str) -> str:
|
|
461
|
+
"""The role Playwright's getByRole knows an element by, from the role Chrome's accessibility tree gives it."""
|
|
462
|
+
return CHROME_ROLES.get(role, role)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def chrome_roles(role: str) -> List[str]:
|
|
466
|
+
"""The roles Chrome's accessibility tree may give an element Playwright knows by `role`: the ARIA one first."""
|
|
467
|
+
return [role, *(k for k, v in CHROME_ROLES.items() if v == role)]
|
|
468
|
+
|
|
469
|
+
|
|
442
470
|
async def element_facts_cdp(session: Any, backend_node_id: int) -> Optional[Dict[str, Any]]:
|
|
443
471
|
try:
|
|
444
472
|
cdp = await _cdp(session)
|
|
@@ -455,7 +483,7 @@ async def element_facts_cdp(session: Any, backend_node_id: int) -> Optional[Dict
|
|
|
455
483
|
facts["classes"] = [c for c in facts.get("classes") or [] if not looks_generated(c) and not state_class(c)]
|
|
456
484
|
ax = await _send(cdp, "Accessibility", "getPartialAXTree", {"backendNodeId": backend_node_id, "fetchRelatives": False})
|
|
457
485
|
node = next(iter((ax or {}).get("nodes") or []), {})
|
|
458
|
-
role = str(((node.get("role") or {}).get("value")) or "")
|
|
486
|
+
role = playwright_role(str(((node.get("role") or {}).get("value")) or ""))
|
|
459
487
|
name = " ".join(str(((node.get("name") or {}).get("value")) or "").split())[:120]
|
|
460
488
|
# An icon CSS draws in it, which the browser's name leaves out and Playwright's does not: in the name, so its
|
|
461
489
|
# locator matches the words with any icon around them (memory.candidate_locators role_pattern).
|
|
@@ -463,7 +491,7 @@ async def element_facts_cdp(session: Any, backend_node_id: int) -> Optional[Dict
|
|
|
463
491
|
if name and icons and not has_icons(name):
|
|
464
492
|
name = f"{icons} {name}"
|
|
465
493
|
# As memory.element_facts: the accessible name when there is one, the element's text only without it.
|
|
466
|
-
facts.update(role=facts["attributes"].get("role") or role, name=name, stable_hash=None, text="" if name else facts.get("text", ""))
|
|
494
|
+
facts.update(role=(str(facts["attributes"].get("role") or "").split() or [role])[0], name=name, stable_hash=None, text="" if name else facts.get("text", ""))
|
|
467
495
|
return facts
|
|
468
496
|
except Exception as ex:
|
|
469
497
|
logger.debug("capture: element facts failed: %s", ex)
|
|
@@ -42,6 +42,9 @@ GENERATED_JS = r"(?:^|[_\-.:])\d+(?:$|[_\-.:])|[0-9a-f]{8}-[0-9a-f]{4}-|^id(?:__
|
|
|
42
42
|
# Above an id (memory.BASE["id"] 0.90) and a test id: the catalogue's attributes are what D365 keeps across sessions
|
|
43
43
|
# and releases, where its ids are not.
|
|
44
44
|
BASE = 0.95
|
|
45
|
+
# By the steady start of a value with a generated part: steadier than a role by a name (memory.BASE["role"] 0.88),
|
|
46
|
+
# which D365 repeats on every row, but under a whole value.
|
|
47
|
+
PREFIX_BASE = 0.89
|
|
45
48
|
MAX_VALUE = 120
|
|
46
49
|
# How far up from the element the recorder looks for the D365 control it belongs to (a tile, a command, a row).
|
|
47
50
|
MAX_UP = 4
|
|
@@ -69,6 +72,24 @@ def generated(value: str) -> bool:
|
|
|
69
72
|
return bool(GENERATED.search(value or ""))
|
|
70
73
|
|
|
71
74
|
|
|
75
|
+
# A generated value's steady start, as the catalogue matches one (`div[data-lp-id*="MscrmControls.Grid.PCFGridControl"]`,
|
|
76
|
+
# `li[data-id*="LookupResultsDropdown"]`): the value up to its first generated part, its trailing separators off. At
|
|
77
|
+
# least this long, so a bare word ("tab", "item") never stands for a control. The page scripts cut alike (`prefix`).
|
|
78
|
+
MIN_PREFIX = 8
|
|
79
|
+
_TRIM = "_-.:| "
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def stable_prefix(value: str) -> str:
|
|
83
|
+
"""The steady start of a generated D365 value (`account.fieldControl-LookupResultsDropdown_account_` of `…_0`), or ""."""
|
|
84
|
+
if not plain(value):
|
|
85
|
+
return ""
|
|
86
|
+
m = GENERATED.search(value)
|
|
87
|
+
if not m:
|
|
88
|
+
return ""
|
|
89
|
+
head = value[: m.start()].rstrip(_TRIM)
|
|
90
|
+
return head if len(head) >= MIN_PREFIX and not generated(head) else ""
|
|
91
|
+
|
|
92
|
+
|
|
72
93
|
def generated_path(xpath: str) -> bool:
|
|
73
94
|
"""A relative XPath the page script built on an id or name D365 renders from position (`//div[@id='AppModuleTileSec_1_Item_1']`)."""
|
|
74
95
|
return any(generated(v) for v in re.findall(r"@(?:id|name)\s*=\s*['\"]([^'\"]*)['\"]", xpath or ""))
|
|
@@ -76,7 +97,8 @@ def generated_path(xpath: str) -> bool:
|
|
|
76
97
|
|
|
77
98
|
def page_config() -> Dict[str, Any]:
|
|
78
99
|
"""What the page scripts need to tell a D365 page and read its attributes (webrecord_page.py, capture.py)."""
|
|
79
|
-
return {"host": HOST_JS, "shell": SHELL_ID, "attrs": list(ATTRS), "gen": GENERATED_JS, "up": MAX_UP
|
|
100
|
+
return {"host": HOST_JS, "shell": SHELL_ID, "attrs": list(ATTRS), "gen": GENERATED_JS, "up": MAX_UP, "min_prefix": MIN_PREFIX, "trim": _TRIM,
|
|
101
|
+
"path_attrs": list(PATH_ATTRS), "path_up": MAX_PATH_UP, "path_max": MAX_PATH}
|
|
80
102
|
|
|
81
103
|
|
|
82
104
|
def _attrs(raw: Any) -> Dict[str, str]:
|
|
@@ -99,6 +121,7 @@ def clean_facts(facts: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
99
121
|
up = out.pop("d365_up", None)
|
|
100
122
|
if out.get("site") != SITE:
|
|
101
123
|
out.pop("site", None)
|
|
124
|
+
out.pop("d365_path", None)
|
|
102
125
|
for k in ATTRS:
|
|
103
126
|
attrs.pop(k, None)
|
|
104
127
|
out["attributes"] = attrs
|
|
@@ -107,6 +130,9 @@ def clean_facts(facts: Dict[str, Any]) -> Dict[str, Any]:
|
|
|
107
130
|
if k in attrs and not plain(attrs[k]):
|
|
108
131
|
attrs.pop(k)
|
|
109
132
|
out["attributes"] = attrs
|
|
133
|
+
trail = clean_path(out.pop("d365_path", None))
|
|
134
|
+
if trail:
|
|
135
|
+
out["d365_path"] = trail
|
|
110
136
|
if isinstance(up, dict) and isinstance(up.get("tag"), str) and _TAG.match(up["tag"]):
|
|
111
137
|
a = _attrs(up.get("attributes"))
|
|
112
138
|
if any(k in a for k in ATTRS):
|
|
@@ -118,7 +144,7 @@ def _q(v: str) -> str:
|
|
|
118
144
|
return '"' + v + '"'
|
|
119
145
|
|
|
120
146
|
|
|
121
|
-
def _selectors(tag: str, a: Dict[str, str]) -> List[Dict[str, str]]:
|
|
147
|
+
def _selectors(tag: str, a: Dict[str, str], prefixes: bool = True) -> List[Dict[str, str]]:
|
|
122
148
|
"""The catalogue's selector shapes for one element's attributes, steadiest first, each with the attribute it counts by."""
|
|
123
149
|
out: List[Dict[str, str]] = []
|
|
124
150
|
title = a.get("title") or ""
|
|
@@ -130,6 +156,13 @@ def _selectors(tag: str, a: Dict[str, str]) -> List[Dict[str, str]]:
|
|
|
130
156
|
v = a.get(k) or ""
|
|
131
157
|
if plain(v) and not generated(v):
|
|
132
158
|
out.append({"css": f"{tag}[{k}={_q(v)}]", "attr": k, "value": v})
|
|
159
|
+
# A value with a row, a position or a record in it (`…resultsContainer_0`, `…PCFGridControl|…|<guid>|…`): by its
|
|
160
|
+
# steady start, as the catalogue's `*=` selectors do, counted at the event by that same start (`attr` + `^`).
|
|
161
|
+
for k in ("data-id", "data-lp-id", "data-control-name") if prefixes else ():
|
|
162
|
+
v = a.get(k) or ""
|
|
163
|
+
head = stable_prefix(v) if plain(v) and generated(v) else ""
|
|
164
|
+
if head:
|
|
165
|
+
out.append({"css": f"{tag}[{k}^={_q(head)}]", "attr": f"{k}^", "value": head, "prefix": "1"})
|
|
133
166
|
return out
|
|
134
167
|
|
|
135
168
|
|
|
@@ -162,13 +195,22 @@ def locators(f: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
|
162
195
|
}
|
|
163
196
|
if up:
|
|
164
197
|
loc["up"] = True
|
|
198
|
+
if sel.get("prefix"):
|
|
199
|
+
# By part of a value D365 made: below the whole value's, never above an id that is the element's own.
|
|
200
|
+
loc["base"] = PREFIX_BASE
|
|
165
201
|
out.append(loc)
|
|
166
202
|
|
|
167
203
|
for sel in _selectors(tag, f.get("attributes") or {}):
|
|
168
204
|
add(sel, False)
|
|
205
|
+
# The catalogue's selector for the control the element is (a command by the end of its id), when it is another.
|
|
206
|
+
for loc in control_locators(f):
|
|
207
|
+
if loc["css"] not in seen:
|
|
208
|
+
seen.add(loc["css"])
|
|
209
|
+
out.append(loc)
|
|
169
210
|
up = f.get("d365_up")
|
|
170
211
|
if tag not in FORM_TAGS and isinstance(up, dict) and _TAG.match(str(up.get("tag") or "")):
|
|
171
|
-
|
|
212
|
+
# Never by part of the control's value: a grid's generated id would stand for every cell inside it.
|
|
213
|
+
for sel in _selectors(str(up["tag"]), up.get("attributes") or {}, prefixes=False):
|
|
172
214
|
add(sel, True)
|
|
173
215
|
return out
|
|
174
216
|
|
|
@@ -182,3 +224,221 @@ def _js(s: str) -> str:
|
|
|
182
224
|
def note() -> str:
|
|
183
225
|
"""One line for the recording's log, said once when the recorder first sees a D365 page."""
|
|
184
226
|
return "Dynamics 365 page: elements are found by D365's own attributes (data-id, app tiles by name), as the dynamics-365 skill says, never by the ids D365 renders from position."
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
# ---- What a D365 control is (EasyRepro's model, the dynamics-365-automation skill) --------------------------------
|
|
230
|
+
# EasyRepro drives D365 by what a control is and its logical name (`Entity.SetValue(new LookupItem { Name =
|
|
231
|
+
# "parentcustomerid" })`, `CommandBar.ClickCommand("Save")`, `Grid.OpenRecord`), not by where it sits. The catalogue
|
|
232
|
+
# (elements.md) says how each is named in the page: `<field>.fieldControl-<kind>`, `…|Mscrm.Form.<table>.<Command>`,
|
|
233
|
+
# `tablist-<TAB>`, `sitemap-entity-<table>`, a grid cell's `col-id`. The recorder reads the same names here, from the
|
|
234
|
+
# element and the D365 names around it (`d365_path`), and keeps them on the step as `d365` (`control`), so the review
|
|
235
|
+
# says "Lookup parentcustomerid", the replay acts as the skill's recipe for that control (src/code/d365.ts) and the
|
|
236
|
+
# written test uses the skill's page objects. Every part is matched by a fixed pattern and kept only in its shape.
|
|
237
|
+
|
|
238
|
+
# What the page script reads around an element (itself first, then up to MAX_PATH_UP ancestors), and how many it keeps.
|
|
239
|
+
PATH_ATTRS = ("data-id", "data-lp-id", "id", "col-id")
|
|
240
|
+
MAX_PATH_UP = 14
|
|
241
|
+
MAX_PATH = 16
|
|
242
|
+
|
|
243
|
+
# The controls the recorder names, as the catalogue's sections and the skill's recipes do.
|
|
244
|
+
CONTROLS = frozenset({
|
|
245
|
+
"text", "date", "time", "lookup", "lookup_search", "lookup_result", "lookup_value", "lookup_clear", "choice", "status",
|
|
246
|
+
"boolean", "multi_select", "field", "command", "overflow", "tab", "sitemap", "grid_cell", "open_record", "quick_find",
|
|
247
|
+
"bpf_stage", "bpf_next", "quick_create_save", "dialog_button",
|
|
248
|
+
})
|
|
249
|
+
SCOPES = frozenset({"header", "bpf", "quick_create"})
|
|
250
|
+
# A logical name (field, table, column, subgrid, tab, command): letters, digits, underscore, a command's dots.
|
|
251
|
+
LOGICAL = re.compile(r"^[A-Za-z][A-Za-z0-9_]{0,99}$")
|
|
252
|
+
COMMAND_ID = re.compile(r"^[A-Za-z][A-Za-z0-9_]*(?:\.[A-Za-z][A-Za-z0-9_]*){0,5}$")
|
|
253
|
+
BARS = frozenset({"Form", "HomepageGrid", "SubGrid", "SubGridAssociated", "SubGridStandard", "Dashboard", "Grid", "QuickCreate"})
|
|
254
|
+
MAX_TEXT = 120
|
|
255
|
+
|
|
256
|
+
_FIELD = re.compile(r"^(header_process_|header_)?([a-z][a-z0-9_]{0,99})\.fieldControl(?:[-_.](.*))?$")
|
|
257
|
+
_CONTAINER = re.compile(r"^(header_process_|header_)?([a-z][a-z0-9_]{0,99})-FieldSectionItemContainer$")
|
|
258
|
+
_COMMAND = re.compile(r"(?:^|\|)Mscrm\.([A-Za-z]+)\.([a-z][a-z0-9_]{0,63})\.([A-Za-z][A-Za-z0-9_.]{0,79})$")
|
|
259
|
+
_TAB = re.compile(r"^tablist-([A-Za-z][A-Za-z0-9_]{0,99})$")
|
|
260
|
+
_SITEMAP = re.compile(r"^sitemap-entity-([A-Za-z][A-Za-z0-9_]{0,99})$")
|
|
261
|
+
_SUBGRID_ROOT = re.compile(r"^dataSetRoot_([A-Za-z][A-Za-z0-9_]{0,99})$")
|
|
262
|
+
_SUBGRID_GRID = re.compile(r"^([A-Za-z][A-Za-z0-9_]{0,99})-pcf_grid_control_container$")
|
|
263
|
+
_COLUMN = re.compile(r"^[A-Za-z][A-Za-z0-9_.]{0,99}$")
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def clean_path(raw: Any) -> List[List[str]]:
|
|
267
|
+
"""The D365 names around an element as the page sent them: [attribute, value] pairs of `PATH_ATTRS`, plain, capped."""
|
|
268
|
+
if not isinstance(raw, list):
|
|
269
|
+
return []
|
|
270
|
+
out: List[List[str]] = []
|
|
271
|
+
for item in raw[:MAX_PATH]:
|
|
272
|
+
if isinstance(item, (list, tuple)) and len(item) == 2 and item[0] in PATH_ATTRS and plain(item[1]):
|
|
273
|
+
out.append([str(item[0]), str(item[1])])
|
|
274
|
+
return out
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def _one_line(v: Any) -> str:
|
|
278
|
+
t = " ".join(str(v or "").split())[:MAX_TEXT]
|
|
279
|
+
return t if t and plain(t) else ""
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def _field_kind(field: str, rest: str, tag: str) -> str:
|
|
283
|
+
rest = rest or ""
|
|
284
|
+
look = f"LookupResultsDropdown_{field}_"
|
|
285
|
+
if rest.startswith(look) or rest.startswith("LookupResultsDropdown"):
|
|
286
|
+
sub = rest[len(look):] if rest.startswith(look) else rest
|
|
287
|
+
if "resultsContainer" in sub:
|
|
288
|
+
return "lookup_result"
|
|
289
|
+
if "selected_tag_delete" in sub:
|
|
290
|
+
return "lookup_clear"
|
|
291
|
+
if "selected_tag" in sub:
|
|
292
|
+
return "lookup_value"
|
|
293
|
+
if sub == "search" or sub.endswith("_search") or tag == "button" and "search" in sub:
|
|
294
|
+
return "lookup_search"
|
|
295
|
+
return "lookup"
|
|
296
|
+
if rest.startswith("Lookup_"):
|
|
297
|
+
return "lookup"
|
|
298
|
+
if "pickliststatus" in rest:
|
|
299
|
+
return "status"
|
|
300
|
+
if "option-set" in rest:
|
|
301
|
+
return "choice"
|
|
302
|
+
if "checkbox" in rest or "toggle" in rest:
|
|
303
|
+
return "boolean"
|
|
304
|
+
if "date-time-input" in rest:
|
|
305
|
+
return "date"
|
|
306
|
+
if "timecontrol" in rest:
|
|
307
|
+
return "time"
|
|
308
|
+
return "text"
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
def control(f: Dict[str, Any]) -> Dict[str, str]:
|
|
312
|
+
"""
|
|
313
|
+
What D365 control an element is, from its D365 names and those around it (`d365_path`, nearest first), as the
|
|
314
|
+
catalogue names them: {control, field|command|tab|entity|column, table, bar, subgrid, scope, text}. Empty when it is
|
|
315
|
+
none the catalogue names, or the page is not D365. Every value is of its shape (`LOGICAL`, `COMMAND_ID`, `plain`).
|
|
316
|
+
"""
|
|
317
|
+
if f.get("site") != SITE:
|
|
318
|
+
return {}
|
|
319
|
+
tag = str(f.get("tag") or "")
|
|
320
|
+
role = str(f.get("role") or "")
|
|
321
|
+
attrs = f.get("attributes") or {}
|
|
322
|
+
own = [[k, str(attrs[k])] for k in PATH_ATTRS if plain(attrs.get(k))]
|
|
323
|
+
trail = own + [p for p in clean_path(f.get("d365_path")) if p not in own]
|
|
324
|
+
text = _one_line(f.get("name") or f.get("text"))
|
|
325
|
+
out: Dict[str, str] = {}
|
|
326
|
+
|
|
327
|
+
def scope_of(prefix: str) -> None:
|
|
328
|
+
if prefix == "header_":
|
|
329
|
+
out["scope"] = "header"
|
|
330
|
+
elif prefix == "header_process_":
|
|
331
|
+
out["scope"] = "bpf"
|
|
332
|
+
|
|
333
|
+
values = [v for _, v in trail]
|
|
334
|
+
if any("quickCreateRoot" in v for v in values):
|
|
335
|
+
out["scope"] = "quick_create"
|
|
336
|
+
for _, v in trail:
|
|
337
|
+
m = _SUBGRID_ROOT.match(v) or _SUBGRID_GRID.match(v)
|
|
338
|
+
if m:
|
|
339
|
+
out["subgrid"] = m.group(1)
|
|
340
|
+
break
|
|
341
|
+
|
|
342
|
+
def done(kind: str, **parts: str) -> Dict[str, str]:
|
|
343
|
+
res = {"control": kind, **{k: v for k, v in parts.items() if v}, **{k: v for k, v in out.items() if k not in parts}}
|
|
344
|
+
if text and kind in ("lookup_result", "lookup_value", "grid_cell", "open_record", "tab", "bpf_stage", "command", "choice", "status", "dialog_button"):
|
|
345
|
+
res.setdefault("text", text)
|
|
346
|
+
return _shaped(res)
|
|
347
|
+
|
|
348
|
+
# The element's own D365 name first, then the nearest around it.
|
|
349
|
+
for k, v in trail:
|
|
350
|
+
if k not in ("data-id", "id"):
|
|
351
|
+
continue
|
|
352
|
+
m = _FIELD.match(v)
|
|
353
|
+
if m:
|
|
354
|
+
scope_of(m.group(1) or "")
|
|
355
|
+
return done(_field_kind(m.group(2), m.group(3) or "", tag), field=m.group(2))
|
|
356
|
+
m = _COMMAND.search(v)
|
|
357
|
+
if m and k == "data-id":
|
|
358
|
+
return done("command", bar=m.group(1), table=m.group(2), command=m.group(3))
|
|
359
|
+
if k == "data-id" and "OverflowButton" in v and tag == "button":
|
|
360
|
+
return done("overflow")
|
|
361
|
+
m = _TAB.match(v)
|
|
362
|
+
if m and k == "data-id":
|
|
363
|
+
return done("tab", tab=m.group(1))
|
|
364
|
+
m = _SITEMAP.match(v)
|
|
365
|
+
if m and k == "data-id":
|
|
366
|
+
return done("sitemap", entity=m.group(1))
|
|
367
|
+
if k == "id" and v.startswith("quickFind_text") or k == "data-id" and v.startswith("data-set-quickFind"):
|
|
368
|
+
return done("quick_find")
|
|
369
|
+
if k == "id" and "processHeaderStage" in v and "Flyout" not in v:
|
|
370
|
+
return done("bpf_stage")
|
|
371
|
+
if k == "data-id" and "nextButtonContainer" in v:
|
|
372
|
+
return done("bpf_next")
|
|
373
|
+
if k == "id" and v.startswith("quickCreateSave"):
|
|
374
|
+
return done("quick_create_save")
|
|
375
|
+
if k == "data-id" and (v.startswith("ok_id") or v.startswith("cancel_id") or v in ("confirmButton", "cancelButton", "okButton")) or k == "id" and v in ("confirmButton", "cancelButton", "okButton"):
|
|
376
|
+
return done("dialog_button")
|
|
377
|
+
m = _CONTAINER.match(v)
|
|
378
|
+
if m:
|
|
379
|
+
scope_of(m.group(1) or "")
|
|
380
|
+
classes = [c for c in f.get("classes") or [] if isinstance(c, str)]
|
|
381
|
+
return done("multi_select" if any(c.startswith("msos-") for c in classes) else "field", field=m.group(2))
|
|
382
|
+
# A grid cell, by its column (`col-id`): a link in it opens the record.
|
|
383
|
+
column = next((v for k, v in trail if k == "col-id" and _COLUMN.match(v)), "")
|
|
384
|
+
if column or role in ("gridcell", "row") and any("PCFGridControl" in v or "data-set-body-container" in v for v in values):
|
|
385
|
+
return done("open_record" if tag == "a" or role == "link" else "grid_cell", column=column)
|
|
386
|
+
return {}
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def _shaped(c: Dict[str, str]) -> Dict[str, str]:
|
|
390
|
+
"""A control's parts, each kept only in its shape: a control of `CONTROLS`, logical names, a command id, one line."""
|
|
391
|
+
if c.get("control") not in CONTROLS:
|
|
392
|
+
return {}
|
|
393
|
+
out: Dict[str, str] = {"control": c["control"]}
|
|
394
|
+
for k in ("field", "table", "subgrid", "tab", "entity"):
|
|
395
|
+
if LOGICAL.match(str(c.get(k) or "")):
|
|
396
|
+
out[k] = c[k]
|
|
397
|
+
if COMMAND_ID.match(str(c.get("command") or "")) and len(c["command"]) <= 80:
|
|
398
|
+
out["command"] = c["command"]
|
|
399
|
+
if c.get("bar") in BARS:
|
|
400
|
+
out["bar"] = c["bar"]
|
|
401
|
+
if _COLUMN.match(str(c.get("column") or "")):
|
|
402
|
+
out["column"] = c["column"]
|
|
403
|
+
if c.get("scope") in SCOPES:
|
|
404
|
+
out["scope"] = c["scope"]
|
|
405
|
+
t = _one_line(c.get("text"))
|
|
406
|
+
if t:
|
|
407
|
+
out["text"] = t
|
|
408
|
+
# A field's control without its field, a command without its id: not named after all.
|
|
409
|
+
if out["control"] in ("text", "date", "time", "lookup", "lookup_search", "lookup_result", "lookup_value", "lookup_clear", "choice", "status", "boolean", "multi_select", "field") and "field" not in out:
|
|
410
|
+
return {}
|
|
411
|
+
if out["control"] == "command" and "command" not in out:
|
|
412
|
+
return {}
|
|
413
|
+
return out
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def control_locators(f: Dict[str, Any]) -> List[Dict[str, Any]]:
|
|
417
|
+
"""
|
|
418
|
+
The catalogue's own selector for a control the element is, where it is steadier than the element's attributes: a
|
|
419
|
+
command by the end of its id (`button[data-id$="Mscrm.Form.account.Save"]`: the part before it names the bar's
|
|
420
|
+
relationship and changes by where the form opens), a multi-select field's search box inside its container.
|
|
421
|
+
"""
|
|
422
|
+
c = control(f)
|
|
423
|
+
tag = str(f.get("tag") or "")
|
|
424
|
+
if not c or not _TAG.match(tag):
|
|
425
|
+
return []
|
|
426
|
+
out: List[Dict[str, Any]] = []
|
|
427
|
+
if c["control"] == "command" and c.get("bar") and c.get("table"):
|
|
428
|
+
css = f'{tag}[data-id$={_q("Mscrm." + c["bar"] + "." + c["table"] + "." + c["command"])}]'
|
|
429
|
+
out.append(css)
|
|
430
|
+
elif c["control"] == "multi_select":
|
|
431
|
+
css = f'div[data-id={_q(c["field"] + "-FieldSectionItemContainer")}] input.msos-input'
|
|
432
|
+
out.append(css)
|
|
433
|
+
return [{"type": "css", "value": css, "css": css, "playwright": f"page.locator({_js(css)})", "base": BASE, "site": SITE, "catalogue": True} for css in out]
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
def control_words(c: Dict[str, Any]) -> str:
|
|
437
|
+
"""What the review calls a step's control (`Lookup parentcustomerid`, `Command Save`), from its checked parts."""
|
|
438
|
+
c = _shaped(dict(c)) if isinstance(c, dict) else {}
|
|
439
|
+
if not c:
|
|
440
|
+
return ""
|
|
441
|
+
kind = c["control"].replace("_", " ")
|
|
442
|
+
name = c.get("field") or c.get("command") or c.get("tab") or c.get("entity") or c.get("column") or ""
|
|
443
|
+
where = {"header": " in the header", "bpf": " in the process stage", "quick_create": " in Quick Create"}.get(c.get("scope", ""), "")
|
|
444
|
+
return f"{kind[:1].upper()}{kind[1:]} {name}".strip() + where
|
|
@@ -2230,10 +2230,11 @@ def fallback_target(url: str, facts: Dict[str, Any], counted: Optional[Dict[str,
|
|
|
2230
2230
|
A locator the page script counted as matching exactly one element then is verified, as one checked over the
|
|
2231
2231
|
DevTools protocol is.
|
|
2232
2232
|
"""
|
|
2233
|
-
d365 = d365_clean_facts({"site": facts.get("site"), "attributes": facts.get("attributes") or {}, "d365_up": facts.get("d365_up")})
|
|
2233
|
+
d365 = d365_clean_facts({"site": facts.get("site"), "attributes": facts.get("attributes") or {}, "d365_up": facts.get("d365_up"), "d365_path": facts.get("d365_path")})
|
|
2234
2234
|
f = {
|
|
2235
2235
|
**({"site": d365["site"]} if d365.get("site") else {}),
|
|
2236
2236
|
**({"d365_up": d365["d365_up"]} if d365.get("d365_up") else {}),
|
|
2237
|
+
**({"d365_path": d365["d365_path"]} if d365.get("d365_path") else {}),
|
|
2237
2238
|
"tag": str(facts.get("tag") or ""),
|
|
2238
2239
|
"role": str(facts.get("role") or ""),
|
|
2239
2240
|
"name": " ".join(str(facts.get("name") or "").split())[:120],
|
|
@@ -30,6 +30,7 @@ from urllib.parse import urlparse
|
|
|
30
30
|
|
|
31
31
|
from . import dynamic
|
|
32
32
|
from .clientcert import CLIENT_CERT_HOSTS
|
|
33
|
+
from .d365 import control as d365_control
|
|
33
34
|
from .memory import FLOW_STEP_LOCATORS, TEST_ID_ATTRS, element_label, looks_generated, page_id
|
|
34
35
|
|
|
35
36
|
FORMAT_SOURCE = "recorded"
|
|
@@ -248,6 +249,8 @@ def element_step(op: str, t: Target) -> Dict[str, Any]:
|
|
|
248
249
|
# In a frame: `frame` is the outermost (as the browser agent's steps name one), `frames` every one when nested.
|
|
249
250
|
**({"frame": t.frames[0]} if t.frames else {}),
|
|
250
251
|
**({"frames": t.frames} if len(t.frames) > 1 else {}),
|
|
252
|
+
# A Dynamics 365 control, as EasyRepro names it (d365.control): the replay acts by the skill's recipe for it.
|
|
253
|
+
**({"d365": c} if (c := d365_control(f)) else {}),
|
|
251
254
|
}
|
|
252
255
|
|
|
253
256
|
|