@capagents/forgeqe 2.7.8 → 2.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/forgeqe.js +194 -194
  2. package/dist/web/assets/{Agent-VNt6ZWZz.js → Agent-DAmFqxps.js} +1 -1
  3. package/dist/web/assets/{ApiTests-DCzhasKI.js → ApiTests-Dy5e1FRb.js} +1 -1
  4. package/dist/web/assets/{Chat-Df_9hcrK.js → Chat-B9YRYCxS.js} +1 -1
  5. package/dist/web/assets/{CommandPalette-MCY8wvHA.js → CommandPalette-DwMar_Iu.js} +1 -1
  6. package/dist/web/assets/{Cost-BNfKL_03.js → Cost-BrcGorrw.js} +1 -1
  7. package/dist/web/assets/{Data-BhRzzs7P.js → Data-UfYSw0hz.js} +1 -1
  8. package/dist/web/assets/{Evidence-BFnrkuWM.js → Evidence-C4Fgnexh.js} +1 -1
  9. package/dist/web/assets/{Explore-DwWbiruJ.js → Explore-DdOb7zHM.js} +1 -1
  10. package/dist/web/assets/{Features-Bdag6Wmx.js → Features-CjFDX2tY.js} +1 -1
  11. package/dist/web/assets/{Flags-CX9bAVKi.js → Flags-DD9xAV5Q.js} +1 -1
  12. package/dist/web/assets/{Flaky-DEN1VdiT.js → Flaky-tUhmLORb.js} +1 -1
  13. package/dist/web/assets/{ForceGraph-mvdwnbOv.js → ForceGraph-BkCKxs6n.js} +1 -1
  14. package/dist/web/assets/{Impact-muNB0nUs.js → Impact-BXj3OMrd.js} +1 -1
  15. package/dist/web/assets/{Jobs-CpTKT5DR.js → Jobs-C8dfw1J1.js} +1 -1
  16. package/dist/web/assets/{KindPage-BU2JVAVF.js → KindPage-BcQ2nfZv.js} +1 -1
  17. package/dist/web/assets/{Migration-B54v2U19.js → Migration-B6E26p2C.js} +1 -1
  18. package/dist/web/assets/{Product-CSlODoYV.js → Product-C83kJY6B.js} +1 -1
  19. package/dist/web/assets/{Production-BirkX3Te.js → Production-DfL5Yj1U.js} +1 -1
  20. package/dist/web/assets/{Quality-COxpzP7Z.js → Quality-BaZyObTf.js} +1 -1
  21. package/dist/web/assets/{Readiness-BSgFm-Xp.js → Readiness-BxHhuk9Q.js} +1 -1
  22. package/dist/web/assets/{Record-CmQ5Zr3i.js → Record-Bw8MC6Dz.js} +1 -1
  23. package/dist/web/assets/{Regression-CyupwUMM.js → Regression-Aic1N8Gr.js} +1 -1
  24. package/dist/web/assets/{Reports-CejGNO45.js → Reports-DeQGZfWB.js} +1 -1
  25. package/dist/web/assets/{Response-DG1lcsGu.js → Response-C19yhnDb.js} +1 -1
  26. package/dist/web/assets/{RunDiff-CJ6k_1ZU.js → RunDiff-CyMF1t9P.js} +1 -1
  27. package/dist/web/assets/{Runs-CJ9lRkNk.js → Runs-B_g-sDgC.js} +1 -1
  28. package/dist/web/assets/{TestCases-CCcZDwHs.js → TestCases-CrTHYBXw.js} +1 -1
  29. package/dist/web/assets/{TestData-DS41AlXL.js → TestData-DQrAv-DE.js} +1 -1
  30. package/dist/web/assets/{TestDebt-CKjkoABS.js → TestDebt-BchIrLE2.js} +1 -1
  31. package/dist/web/assets/{Tosca-CXh15pdo.js → Tosca-CaWZrjr4.js} +2 -2
  32. package/dist/web/assets/{WhatsNew-jmU1_Vof.js → WhatsNew-BWBXb0zY.js} +1 -1
  33. package/dist/web/assets/{dataParts-CaJiuNL1.js → dataParts-CJhaJ4YM.js} +1 -1
  34. package/dist/web/assets/{families-BGu6Jt7k.js → families-RmlYg4bl.js} +1 -1
  35. package/dist/web/assets/{frame-CMf4LDd4.js → frame-BlZmJqKb.js} +2 -2
  36. package/dist/web/assets/{index-BD3iUT-3.js → index-kBLPh-15.js} +4 -4
  37. package/dist/web/assets/{logos-c2wZeVQK.js → logos-ih0wOR3C.js} +1 -1
  38. package/dist/web/assets/{parts-CLy4FMjj.js → parts-Bopek2vd.js} +1 -1
  39. package/dist/web/assets/{productParts-DyWke4HN.js → productParts-DGJotZr6.js} +1 -1
  40. package/dist/web/assets/{qualityParts-CFjfNmrS.js → qualityParts-BBFohD9x.js} +1 -1
  41. package/dist/web/assets/{segmented-E7E9vDxH.js → segmented--5Wlq3Yo.js} +1 -1
  42. package/dist/web/assets/{thread-VaEnkSAe.js → thread-VZReeAAU.js} +1 -1
  43. package/dist/web/assets/{usePageChat-CBph4Mpc.js → usePageChat-DDqwOiDj.js} +1 -1
  44. package/dist/web/index.html +2 -2
  45. package/package.json +1 -1
  46. package/prompts/tosca.md +1 -1
  47. package/py/forgeqe_tosca/ntir.py +34 -2
  48. package/py/forgeqe_tosca/render.py +2 -1
  49. package/py/forgeqe_tosca/tsu.py +73 -2
  50. package/py/forgeqe_tosca/vendored.py +16 -5
  51. package/skills/tosca-knowledge/references/mapping-playwright.md +1 -0
  52. package/skills/tosca-knowledge/references/ntir.md +1 -1
@@ -55,6 +55,61 @@ def load(path: Path) -> Dict[str, Any]:
55
55
  return data
56
56
 
57
57
 
58
+ def link_step_values(data: Dict[str, Any]) -> int:
59
+ """Add the reverse TestStep → XTestStepValue link ToscaTSU's indexer expects.
60
+
61
+ Tosca Commander exports put `Assocs.TestStep` on each value. Some Tosca Cloud / newer exports only put
62
+ `Assocs.TestStepValues` on the step. Without the reverse link, every step looks empty and the UI shows Web with
63
+ nothing to convert. Returns how many values gained a link. Never invents entities; only fills a missing assoc.
64
+ """
65
+ ents = data.get("Entities")
66
+ if not isinstance(ents, list):
67
+ return 0
68
+ by = {e["Surrogate"]: e for e in ents if isinstance(e, dict) and isinstance(e.get("Surrogate"), str)}
69
+ added = 0
70
+ for step in ents:
71
+ if not isinstance(step, dict) or step.get("ObjectClass") != "XTestStep":
72
+ continue
73
+ sid = step.get("Surrogate")
74
+ if not isinstance(sid, str):
75
+ continue
76
+ assocs = step.get("Assocs") if isinstance(step.get("Assocs"), dict) else {}
77
+ for vid in assocs.get("TestStepValues") or []:
78
+ if not isinstance(vid, str):
79
+ continue
80
+ val = by.get(vid)
81
+ if not val or val.get("ObjectClass") != "XTestStepValue":
82
+ continue
83
+ va = val.get("Assocs")
84
+ if not isinstance(va, dict):
85
+ va = {}
86
+ val["Assocs"] = va
87
+ # Nested values (ParentValue set) are reached via SubValues; do not attach them to the step.
88
+ parents = va.get("ParentValue") or []
89
+ if parents:
90
+ continue
91
+ cur = va.get("TestStep")
92
+ if isinstance(cur, list) and sid in cur:
93
+ continue
94
+ if not isinstance(cur, list) or not cur:
95
+ va["TestStep"] = [sid]
96
+ added += 1
97
+ elif sid not in cur:
98
+ va["TestStep"] = [sid, *cur]
99
+ added += 1
100
+ return added
101
+
102
+
103
+ def write_linked(path: Path, dest: Path) -> int:
104
+ """Load path, add missing TestStep reverse links, write gzip JSON to dest. Returns links added."""
105
+ data = load(path)
106
+ n = link_step_values(data)
107
+ dest.parent.mkdir(parents=True, exist_ok=True)
108
+ with gzip.open(dest, "wb") as fh:
109
+ fh.write(json.dumps(data, ensure_ascii=False, separators=(",", ":")).encode("utf-8"))
110
+ return n
111
+
112
+
58
113
  def _attrs(e: Optional[Dict[str, Any]]) -> Dict[str, Any]:
59
114
  a = (e or {}).get("Attributes")
60
115
  return a if isinstance(a, dict) else {}
@@ -74,16 +129,32 @@ def name_of(e: Optional[Dict[str, Any]]) -> str:
74
129
  # Tosca engines → the ForgeQE agent that can do their steps.
75
130
  ROUTES = {
76
131
  "web": re.compile(r"^(html|web|xbrowser|chrome|edge|firefox)", re.I),
77
- "api": re.compile(r"(api|webservice|http|rest|soap)", re.I),
132
+ # Json / Xml engines are Tosca's API / message modules (not the browser).
133
+ "api": re.compile(r"(api|webservice|http|rest|soap|json|xml)", re.I),
78
134
  "mobile": re.compile(r"(mobile|android|ios)", re.I),
79
135
  "desktop": re.compile(r"(uia|swing|java|sap|dotnet|\.net|win|delphi|powerbuilder|desktop|tbox)", re.I),
80
136
  "data": re.compile(r"(database|db|sql|excel|tdm|testdata)", re.I),
81
137
  }
82
138
  # TBox modules the reader turns into plain steps, so they never decide a route.
83
139
  NEUTRAL_MODULES = {"TBox Set Buffer", "TBox Evaluation Tool", "TBox Wait", "TBox Buffer"}
140
+ # Framework-engine modules that steer a browser (OpenUrl / CloseBrowser are handled in ntir; these only affect
141
+ # page.route when a case lists them). Other Framework modules (TBox files, mail helpers) stay unsupported.
142
+ WEB_FRAMEWORK_MODULES = {
143
+ "OpenUrl",
144
+ "CloseBrowser",
145
+ "Connect to Chrome/Chromium application",
146
+ "Open embedded Chrome/Chromium application",
147
+ }
84
148
 
85
149
 
86
- def route_of(engine: str) -> str:
150
+ def route_of(engine: str, module: str = "") -> str:
151
+ """Map a Tosca engine (and optional module name) to a ForgeQE route.
152
+
153
+ OpenUrl / CloseBrowser use engine Framework; without the module name they would look unsupported and mark
154
+ every Html test that opens a browser as mixed.
155
+ """
156
+ if module in WEB_FRAMEWORK_MODULES:
157
+ return "web"
87
158
  for route, rx in ROUTES.items():
88
159
  if engine and rx.search(engine):
89
160
  return route
@@ -3,6 +3,10 @@
3
3
  parse_tsu.py is a script that does its work at import time, so it runs as a child process: the same Python, isolated
4
4
  (-I), an argument list (never a shell), a fresh output folder, and a time limit. Its manifest per test case is the
5
5
  input of ntir.py.
6
+
7
+ Some Tosca Cloud exports omit the reverse TestStep link on each XTestStepValue that Commander puts there. ToscaTSU's
8
+ indexer only finds values through that link, so those exports would look empty. We rewrite a temporary .tsu with the
9
+ missing links filled from each step's TestStepValues (tsu.link_step_values) and point the vendor parser at that file.
6
10
  """
7
11
  from __future__ import annotations
8
12
 
@@ -13,18 +17,22 @@ import tempfile
13
17
  from pathlib import Path
14
18
  from typing import Any, Dict, List, Optional
15
19
 
20
+ from . import tsu
16
21
  from .tsu import TsuError
17
22
 
18
23
  PARSER = Path(__file__).resolve().parent / "vendor" / "toscatsu" / "parse_tsu.py"
19
24
  TIMEOUT_S = 600
20
25
 
21
26
 
22
- def manifests(tsu: Path, test_attributes: Optional[List[str]] = None, skip_modules: Optional[List[str]] = None,
27
+ def manifests(path: Path, test_attributes: Optional[List[str]] = None, skip_modules: Optional[List[str]] = None,
23
28
  timeout: int = TIMEOUT_S) -> List[Dict[str, Any]]:
24
29
  """One manifest per test case, in the .tsu's order, as ToscaTSU writes them."""
25
30
  with tempfile.TemporaryDirectory(prefix="fq-tosca-") as tmp:
26
- out = Path(tmp) / "out"
31
+ tmp_path = Path(tmp)
32
+ out = tmp_path / "out"
27
33
  out.mkdir()
34
+ linked = tmp_path / "linked.tsu"
35
+ tsu.write_linked(Path(path), linked)
28
36
  cfg: Dict[str, Any] = {}
29
37
  if test_attributes:
30
38
  cfg["test_attributes"] = list(test_attributes)
@@ -33,18 +41,21 @@ def manifests(tsu: Path, test_attributes: Optional[List[str]] = None, skip_modul
33
41
  if cfg: # parse_tsu reads parse_tsu.config.json from its output folder (it wins over one next to the .tsu)
34
42
  (out / "parse_tsu.config.json").write_text(json.dumps(cfg), encoding="utf-8")
35
43
  r = subprocess.run(
36
- [sys.executable, "-I", str(PARSER), str(Path(tsu).resolve()), "--steps-json", "--out-dir", str(out)],
44
+ [sys.executable, "-I", str(PARSER), str(linked.resolve()), "--steps-json", "--out-dir", str(out)],
37
45
  capture_output=True, text=True, timeout=timeout, cwd=tmp, shell=False,
38
46
  )
39
47
  if r.returncode != 0:
40
48
  last = (r.stderr or r.stdout or "").strip().splitlines()
41
- raise TsuError(f"ToscaTSU could not read {Path(tsu).name}: {last[-1] if last else 'exit ' + str(r.returncode)}")
49
+ raise TsuError(f"ToscaTSU could not read {Path(path).name}: {last[-1] if last else 'exit ' + str(r.returncode)}")
42
50
  found = sorted((out / "cases").glob("*/steps.json")) if (out / "cases").is_dir() else sorted(out.glob("*_steps.json"))
43
51
  result = []
44
52
  for f in found:
45
53
  m = json.loads(f.read_text(encoding="utf-8"))
46
54
  m.setdefault("meta", {})["case_folder"] = f.parent.name if f.name == "steps.json" else ""
55
+ # Keep the caller's file name in meta, not the temporary linked copy.
56
+ if isinstance(m.get("meta"), dict):
57
+ m["meta"]["source_file"] = Path(path).name
47
58
  result.append(m)
48
59
  if not result:
49
- raise TsuError(f"ToscaTSU wrote no manifest for {Path(tsu).name}.")
60
+ raise TsuError(f"ToscaTSU wrote no manifest for {Path(path).name}.")
50
61
  return result
@@ -7,6 +7,7 @@
7
7
  | role / label / text | `page.getByRole('button', { name: 'Add' })`, `page.getByLabel('…')`, `page.getByText('…', { exact: true })` |
8
8
  | scope, nth | `page.locator('app-cart-summary').getByTestId('cart.add')`, `.nth(n)` |
9
9
  | fill / click / press | `await el.fill(v)`, `await el.click()` (`dblclick()`, `click({ button: 'right' })`), `await el.press('Tab')` |
10
+ | navigate / close | `await page.goto(url)` (absolute URL as recorded, or path under `baseURL`); close is usually omitted — the test runner closes the page — or `await page.close()` when the Tosca step must run mid-test |
10
11
  | select / check / hover | `await el.selectOption({ index: 2 })` / `selectOption({ label: 'x' })`, `check()`, `uncheck()`, `hover()` |
11
12
  | optional | `await el.click({ timeout: 3000 }).catch(() => {})` |
12
13
  | assert visible … | `await expect(el).toBeVisible()`, `toBeHidden()`, `toBeEnabled()`, `toBeDisabled()`, `toBeChecked()`, `not.toBeChecked()`, `toBeFocused()`, `toBeEditable()`, `not.toBeEditable()`, `toBeAttached()`, `not.toBeAttached()` |
@@ -34,7 +34,7 @@ shows `<secret>`).
34
34
  | kind | fields |
35
35
  |---|---|
36
36
  | `group` | name, role (`before`, `after`, `folder`, `block`), block, args (block only), body |
37
- | `action` | op (`fill`, `click`, `press`, `select`, `check`, `uncheck`, `hover`, `scroll`, `focus`, `blur`), target (`page.element`), value, key, option (`index` or `label`), modifiers (`double`, `button`, `phase`), optional |
37
+ | `action` | op (`fill`, `click`, `press`, `select`, `check`, `uncheck`, `hover`, `scroll`, `focus`, `blur`, `navigate`, `close`), target (`page.element`; omit for navigate/close), value (navigate URL), key, option (`index` or `label`), modifiers (`double`, `button`, `phase`), optional |
38
38
  | `assert` | op (`visible`, `hidden`, `enabled`, `disabled`, `checked`, `unchecked`, `focused`, `unfocused`, `editable`, `readonly`, `attached`, `detached`, `text`, `value`, `count`, `property`), target, expected, match (`exact` or `contains`), wait |
39
39
  | `store` | var, target, property |
40
40
  | `set_var` | var, value |