@sun-asterisk/sungen 2.6.10 → 2.6.12

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 (35) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/dashboard/templates/index.html +112 -101
  3. package/dist/exporters/xlsx-exporter.d.ts +6 -0
  4. package/dist/exporters/xlsx-exporter.d.ts.map +1 -1
  5. package/dist/exporters/xlsx-exporter.js +53 -19
  6. package/dist/exporters/xlsx-exporter.js.map +1 -1
  7. package/dist/generators/test-generator/utils/selector-resolver.d.ts +9 -0
  8. package/dist/generators/test-generator/utils/selector-resolver.d.ts.map +1 -1
  9. package/dist/generators/test-generator/utils/selector-resolver.js +18 -2
  10. package/dist/generators/test-generator/utils/selector-resolver.js.map +1 -1
  11. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  12. package/dist/orchestrator/project-initializer.js +5 -5
  13. package/dist/orchestrator/project-initializer.js.map +1 -1
  14. package/dist/orchestrator/templates/ai-instructions/claude-config.md +2 -0
  15. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +1 -0
  16. package/dist/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +38 -0
  17. package/dist/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +2 -0
  18. package/dist/orchestrator/templates/ai-instructions/copilot-config.md +2 -0
  19. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -0
  20. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +38 -0
  21. package/dist/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +2 -0
  22. package/package.json +1 -1
  23. package/src/cli/index.ts +1 -1
  24. package/src/dashboard/templates/index.html +112 -101
  25. package/src/exporters/xlsx-exporter.ts +58 -19
  26. package/src/generators/test-generator/utils/selector-resolver.ts +19 -2
  27. package/src/orchestrator/project-initializer.ts +5 -5
  28. package/src/orchestrator/templates/ai-instructions/claude-config.md +2 -0
  29. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-fix.md +1 -0
  30. package/src/orchestrator/templates/ai-instructions/claude-skill-selector-keys.md +38 -0
  31. package/src/orchestrator/templates/ai-instructions/claude-skill-tc-generation.md +2 -0
  32. package/src/orchestrator/templates/ai-instructions/copilot-config.md +2 -0
  33. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-fix.md +1 -0
  34. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-selector-keys.md +38 -0
  35. package/src/orchestrator/templates/ai-instructions/github-skill-sungen-tc-generation.md +2 -0
@@ -115,6 +115,44 @@ gửi lời cảm ơn--3:
115
115
  name: 'Gửi lời cảm ơn'
116
116
  ```
117
117
 
118
+ ## i18n: Template Variables in Selectors
119
+
120
+ For multilingual sites without `data-testid`, use `{{variable}}` in `name` or `value` fields to reference locale-dependent text from `test-data.yaml`.
121
+
122
+ ```yaml
123
+ # selectors — one file for all locales
124
+ submit:
125
+ type: role
126
+ value: button
127
+ name: "{{lbl_submit}}"
128
+
129
+ search:
130
+ type: placeholder
131
+ value: "{{lbl_search}}"
132
+
133
+ logo:
134
+ type: testid
135
+ value: app-logo # testid is locale-independent — no variable needed
136
+ ```
137
+
138
+ ```yaml
139
+ # test-data/login.yaml (base — English)
140
+ lbl_submit: "Sign in"
141
+ lbl_search: "Search..."
142
+
143
+ # test-data/login.vi.yaml (Vietnamese)
144
+ lbl_submit: "Đăng nhập"
145
+ lbl_search: "Tìm kiếm..."
146
+ ```
147
+
148
+ Run: `SUNGEN_ENV=vi npx playwright test`
149
+
150
+ **Rules:**
151
+ 1. Prefix i18n keys with `lbl_`, `msg_`, `txt_` to separate from test data
152
+ 2. Prefer `data-testid` — only use `{{variable}}` when no stable selector exists
153
+ 3. Feature file stays identical across locales
154
+ 4. Requires runtime data mode (default, not `--inline-data`)
155
+
118
156
  ## Lookup Priority
119
157
 
120
158
  Resolver searches in this order:
@@ -352,6 +352,8 @@ Feature: <Screen> Screen
352
352
 
353
353
  **Environment-specific data**: create `<screen>.<env>.yaml` alongside the base file with only the keys that change. Users run `SUNGEN_ENV=staging npx playwright test` to merge overrides.
354
354
 
355
+ **i18n / multilingual**: use the same `SUNGEN_ENV` overlay for locale variants — e.g., `login.vi.yaml`, `login.staging-ja.yaml`. Include `lbl_*` / `msg_*` keys for selector `{{variable}}` references (see `sungen-selector-keys` § i18n). One feature file + one selector file works across all locales.
356
+
355
357
  ## Flow Test Generation
356
358
 
357
359
  When generating tests for a **flow** (`qa/flows/<name>/`), adapt the strategy:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sun-asterisk/sungen",
3
- "version": "2.6.10",
3
+ "version": "2.6.12",
4
4
  "description": "Deterministic E2E Test Compiler - Gherkin + Selectors → Playwright tests",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/cli/index.ts CHANGED
@@ -21,7 +21,7 @@ async function main() {
21
21
  program
22
22
  .name('sungen')
23
23
  .description('Deterministic E2E Test Compiler — Gherkin + Selectors → Playwright')
24
- .version('2.6.10');
24
+ .version('2.6.12');
25
25
 
26
26
  // Global options
27
27
  program