@sun-asterisk/sungen 3.2.12 → 3.2.13
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/generators/test-generator/adapters/playwright/templates/steps/actions/hover-element-with-text.hbs +1 -0
- package/dist/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-filtered-assertion.hbs +1 -0
- package/dist/generators/test-generator/utils/runtime-data-transformer.d.ts.map +1 -1
- package/dist/generators/test-generator/utils/runtime-data-transformer.js +9 -3
- package/dist/generators/test-generator/utils/runtime-data-transformer.js.map +1 -1
- package/dist/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +1 -0
- package/package.json +3 -3
- package/src/generators/test-generator/adapters/playwright/templates/steps/actions/hover-element-with-text.hbs +1 -0
- package/src/generators/test-generator/adapters/playwright/templates/steps/assertions/visible-filtered-assertion.hbs +1 -0
- package/src/generators/test-generator/utils/runtime-data-transformer.ts +10 -4
- package/src/orchestrator/templates/ai-src/skills/sungen-error-mapping/SKILL.md +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
await {{> locator-base}}.filter({ hasText: {{> has-text-value dataValue=dataValue exact=exact legacyTail=(and (eq strategy "text") (eq value ""))}} }){{> locator-nth}}.hover();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
await expect({{> locator-base}}.filter({ hasText: {{> has-text-value dataValue=dataValue exact=exact legacyTail=(and (eq strategy "text") (eq value ""))}} }){{> locator-nth}}).toBeVisible();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-data-transformer.d.ts","sourceRoot":"","sources":["../../../../src/generators/test-generator/utils/runtime-data-transformer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAmB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"runtime-data-transformer.d.ts","sourceRoot":"","sources":["../../../../src/generators/test-generator/utils/runtime-data-transformer.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAmB,GAAG,MAAM,CAkD1F;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
@@ -8,9 +8,15 @@ const MARKER_PATTERN = /__SUNGEN_TD_([A-Za-z0-9_]+)__/;
|
|
|
8
8
|
* Three passes: comments, string literals, then regex literals.
|
|
9
9
|
*/
|
|
10
10
|
function transformToRuntimeData(code, accessor = 'testData') {
|
|
11
|
-
// Pass 0: Comments — replace markers in // comments with decoded key name
|
|
12
|
-
// Prevents Pass 2 from misinterpreting // comment markers as regex delimiters
|
|
13
|
-
|
|
11
|
+
// Pass 0: Comments — replace markers in // comments with decoded key name.
|
|
12
|
+
// Prevents Pass 2 from misinterpreting // comment markers as regex delimiters.
|
|
13
|
+
// ANCHORED to line start (^\s*//) so a `//` INSIDE a string literal on a code line
|
|
14
|
+
// — e.g. a URL `https://careerforum.aki-inc.jp/` in a selector name — is NOT mistaken
|
|
15
|
+
// for a comment. Before this anchor, such a URL preceding a marker on the same line
|
|
16
|
+
// made Pass 0 strip the marker to its bare key, so Pass 1 never wrapped it in
|
|
17
|
+
// testData.get() (silent: `toHaveAttribute('href', 'official_site_url')`). Generated
|
|
18
|
+
// comments are always full-line, so anchoring loses nothing.
|
|
19
|
+
code = code.replace(/^(\s*)\/\/(.*)__SUNGEN_TD_([A-Za-z0-9_]+)__(.*)$/gm, (_, indent, before, enc, after) => `${indent}//${before}${decodeKey(enc)}${after}`);
|
|
14
20
|
// Pass 1: String literal context — handles both whole-string and embedded markers
|
|
15
21
|
// 'marker' → testData.get('key')
|
|
16
22
|
// 'prefix__marker__suffix' → `prefix${testData.get('key')}suffix`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-data-transformer.js","sourceRoot":"","sources":["../../../../src/generators/test-generator/utils/runtime-data-transformer.ts"],"names":[],"mappings":";;AAMA,
|
|
1
|
+
{"version":3,"file":"runtime-data-transformer.js","sourceRoot":"","sources":["../../../../src/generators/test-generator/utils/runtime-data-transformer.ts"],"names":[],"mappings":";;AAMA,wDAkDC;AAED,sDAEC;AA5DD,MAAM,cAAc,GAAG,+BAA+B,CAAC;AAEvD;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,IAAY,EAAE,WAAmB,UAAU;IAChF,2EAA2E;IAC3E,+EAA+E;IAC/E,mFAAmF;IACnF,sFAAsF;IACtF,oFAAoF;IACpF,8EAA8E;IAC9E,qFAAqF;IACrF,6DAA6D;IAC7D,IAAI,GAAG,IAAI,CAAC,OAAO,CACjB,oDAAoD,EACpD,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,CACnF,CAAC;IAEF,kFAAkF;IAClF,oDAAoD;IACpD,qEAAqE;IACrE,IAAI,GAAG,IAAI,CAAC,OAAO,CACjB,sEAAsE,EACtE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;YACvB,OAAO,GAAG,QAAQ,SAAS,GAAG,IAAI,CAAC;QACrC,CAAC;QACD,OAAO,KAAK,MAAM,MAAM,QAAQ,SAAS,GAAG,MAAM,MAAM,IAAI,CAAC;IAC/D,CAAC,CACF,CAAC;IAEF,+EAA+E;IAC/E,mEAAmE;IACnE,IAAI,GAAG,IAAI,CAAC,OAAO,CACjB,uFAAuF,EACvF,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;QAChC,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,GAAG,GAAG,GAAG,QAAQ,SAAS,GAAG,IAAI,CAAC;QACxC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM;YAAE,OAAO,cAAc,GAAG,GAAG,OAAO,GAAG,CAAC;QAC9D,OAAO,gBAAgB,MAAM,MAAM,GAAG,IAAI,MAAM,KAAK,OAAO,GAAG,CAAC;IAClE,CAAC,CACF,CAAC;IAEF,kFAAkF;IAClF,sFAAsF;IACtF,yFAAyF;IACzF,IAAI,GAAG,IAAI,CAAC,OAAO,CACjB,gCAAgC,EAChC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,UAAU,QAAQ,SAAS,SAAS,CAAC,GAAG,CAAC,KAAK,CAC3D,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,qBAAqB,CAAC,IAAY;IAChD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -76,6 +76,7 @@ needs any of these, it is a **finding for QA** — surface it in the run summary
|
|
|
76
76
|
| Error | Diagnosis | Fix |
|
|
77
77
|
|---|---|---|
|
|
78
78
|
| strict mode violation | Multiple elements match | Add `nth: 0`, `exact: true`, or more specific `name` |
|
|
79
|
+
| strict mode violation on `see`/`hover [X] item\|option\|cell with {{v}}` (dynamic list) | Older builds didn't filter the locator by the value | Since 3.2.13 `see`/`hover ... with {{v}}` on list-member roles filters by `hasText` like `click` (existence/hover the matching item) — keep the step data-driven, don't add per-item selectors. Update sungen if still unfiltered |
|
|
79
80
|
| Timeout / not found | Element doesn't exist or name wrong | Re-snapshot → copy exact accessible name. Check iframe/dialog scope |
|
|
80
81
|
| Element is not an input | Wrong element type targeted | Change `type` or `value` to match actual element |
|
|
81
82
|
| not a select | Custom dropdown, not native `<select>` | Set the widget variant: `variant: radix-select`/`antd-select` (built-in recipes), a custom recipe name from `qa/app.yaml`, or project-wide `widgets.select` in `qa/app.yaml` |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sun-asterisk/sungen",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.13",
|
|
4
4
|
"description": "Deterministic E2E Test Compiler - Gherkin + Selectors → Playwright tests",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"@babel/types": "^7.28.5",
|
|
40
40
|
"@cucumber/gherkin": "^37.0.0",
|
|
41
41
|
"@cucumber/messages": "^31.0.0",
|
|
42
|
-
"@sungen/driver-data-factory": "3.2.
|
|
43
|
-
"@sungen/driver-ui": "3.2.
|
|
42
|
+
"@sungen/driver-data-factory": "3.2.13",
|
|
43
|
+
"@sungen/driver-ui": "3.2.13",
|
|
44
44
|
"chalk": "^5.6.2",
|
|
45
45
|
"commander": "^14.0.2",
|
|
46
46
|
"dotenv": "^17.2.3",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
await {{> locator-base}}.filter({ hasText: {{> has-text-value dataValue=dataValue exact=exact legacyTail=(and (eq strategy "text") (eq value ""))}} }){{> locator-nth}}.hover();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
await expect({{> locator-base}}.filter({ hasText: {{> has-text-value dataValue=dataValue exact=exact legacyTail=(and (eq strategy "text") (eq value ""))}} }){{> locator-nth}}).toBeVisible();
|
|
@@ -5,11 +5,17 @@ const MARKER_PATTERN = /__SUNGEN_TD_([A-Za-z0-9_]+)__/;
|
|
|
5
5
|
* Three passes: comments, string literals, then regex literals.
|
|
6
6
|
*/
|
|
7
7
|
export function transformToRuntimeData(code: string, accessor: string = 'testData'): string {
|
|
8
|
-
// Pass 0: Comments — replace markers in // comments with decoded key name
|
|
9
|
-
// Prevents Pass 2 from misinterpreting // comment markers as regex delimiters
|
|
8
|
+
// Pass 0: Comments — replace markers in // comments with decoded key name.
|
|
9
|
+
// Prevents Pass 2 from misinterpreting // comment markers as regex delimiters.
|
|
10
|
+
// ANCHORED to line start (^\s*//) so a `//` INSIDE a string literal on a code line
|
|
11
|
+
// — e.g. a URL `https://careerforum.aki-inc.jp/` in a selector name — is NOT mistaken
|
|
12
|
+
// for a comment. Before this anchor, such a URL preceding a marker on the same line
|
|
13
|
+
// made Pass 0 strip the marker to its bare key, so Pass 1 never wrapped it in
|
|
14
|
+
// testData.get() (silent: `toHaveAttribute('href', 'official_site_url')`). Generated
|
|
15
|
+
// comments are always full-line, so anchoring loses nothing.
|
|
10
16
|
code = code.replace(
|
|
11
|
-
|
|
12
|
-
(_, before, enc, after) =>
|
|
17
|
+
/^(\s*)\/\/(.*)__SUNGEN_TD_([A-Za-z0-9_]+)__(.*)$/gm,
|
|
18
|
+
(_, indent, before, enc, after) => `${indent}//${before}${decodeKey(enc)}${after}`
|
|
13
19
|
);
|
|
14
20
|
|
|
15
21
|
// Pass 1: String literal context — handles both whole-string and embedded markers
|
|
@@ -76,6 +76,7 @@ needs any of these, it is a **finding for QA** — surface it in the run summary
|
|
|
76
76
|
| Error | Diagnosis | Fix |
|
|
77
77
|
|---|---|---|
|
|
78
78
|
| strict mode violation | Multiple elements match | Add `nth: 0`, `exact: true`, or more specific `name` |
|
|
79
|
+
| strict mode violation on `see`/`hover [X] item\|option\|cell with {{v}}` (dynamic list) | Older builds didn't filter the locator by the value | Since 3.2.13 `see`/`hover ... with {{v}}` on list-member roles filters by `hasText` like `click` (existence/hover the matching item) — keep the step data-driven, don't add per-item selectors. Update sungen if still unfiltered |
|
|
79
80
|
| Timeout / not found | Element doesn't exist or name wrong | Re-snapshot → copy exact accessible name. Check iframe/dialog scope |
|
|
80
81
|
| Element is not an input | Wrong element type targeted | Change `type` or `value` to match actual element |
|
|
81
82
|
| not a select | Custom dropdown, not native `<select>` | Set the widget variant: `variant: radix-select`/`antd-select` (built-in recipes), a custom recipe name from `qa/app.yaml`, or project-wide `widgets.select` in `qa/app.yaml` |
|