@sun-asterisk/sungen 2.0.0 → 2.0.1

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 (31) hide show
  1. package/dist/generators/test-generator/code-generator.d.ts.map +1 -1
  2. package/dist/generators/test-generator/code-generator.js +10 -0
  3. package/dist/generators/test-generator/code-generator.js.map +1 -1
  4. package/dist/generators/test-generator/step-mapper.d.ts +4 -0
  5. package/dist/generators/test-generator/step-mapper.d.ts.map +1 -1
  6. package/dist/generators/test-generator/step-mapper.js +8 -0
  7. package/dist/generators/test-generator/step-mapper.js.map +1 -1
  8. package/dist/orchestrator/project-initializer.d.ts +4 -0
  9. package/dist/orchestrator/project-initializer.d.ts.map +1 -1
  10. package/dist/orchestrator/project-initializer.js +11 -410
  11. package/dist/orchestrator/project-initializer.js.map +1 -1
  12. package/dist/orchestrator/templates/ai-rules.md +189 -0
  13. package/dist/orchestrator/templates/gitignore +16 -0
  14. package/dist/orchestrator/templates/playwright.config.d.ts +10 -0
  15. package/dist/orchestrator/templates/playwright.config.d.ts.map +1 -0
  16. package/dist/orchestrator/templates/playwright.config.js +77 -0
  17. package/dist/orchestrator/templates/playwright.config.js.map +1 -0
  18. package/dist/orchestrator/templates/playwright.config.ts +80 -0
  19. package/dist/orchestrator/templates/readme.md +197 -0
  20. package/docs/gherkin standards/gherkin-core-standard.md +377 -0
  21. package/docs/gherkin standards/gherkin-core-standard.vi.md +303 -0
  22. package/docs/gherkin-dictionary.md +1071 -0
  23. package/docs/makeauth.md +225 -0
  24. package/package.json +3 -2
  25. package/src/generators/test-generator/code-generator.ts +11 -0
  26. package/src/generators/test-generator/step-mapper.ts +9 -0
  27. package/src/orchestrator/project-initializer.ts +12 -410
  28. package/src/orchestrator/templates/ai-rules.md +189 -0
  29. package/src/orchestrator/templates/gitignore +16 -0
  30. package/src/orchestrator/templates/playwright.config.ts +80 -0
  31. package/src/orchestrator/templates/readme.md +197 -0
@@ -0,0 +1,189 @@
1
+ # Sungen AI Rules
2
+
3
+ You generate 3 files for sungen — a Gherkin compiler that produces Playwright tests.
4
+ **You do NOT write Playwright code.** You only write `.feature`, `selectors.yaml`, and `test-data.yaml`.
5
+
6
+ ## Complete Example
7
+
8
+ Given a login page, here are the 3 files you generate:
9
+
10
+ **qa/screens/login/features/login.feature**
11
+ ```gherkin
12
+ @auth:admin
13
+ Feature: Login Screen
14
+
15
+ Scenario: Successful login
16
+ Given User is on [login] page
17
+ When User fill [Email] field with {{email}}
18
+ And User fill [Password] field with {{password}}
19
+ And User click [Submit] button
20
+ Then User see [Welcome] heading with {{welcome_text}}
21
+ And User see [Dashboard] link is visible
22
+ ```
23
+
24
+ **qa/screens/login/selectors/login.yaml**
25
+ ```yaml
26
+ login:
27
+ type: 'page'
28
+ value: '/login'
29
+
30
+ email:
31
+ type: 'placeholder'
32
+ value: 'Enter your email'
33
+
34
+ password:
35
+ type: 'placeholder'
36
+ value: 'Enter your password'
37
+
38
+ submit:
39
+ type: 'role'
40
+ value: 'button'
41
+ name: 'Submit'
42
+
43
+ welcome:
44
+ type: 'role'
45
+ value: 'heading'
46
+ name: 'Welcome'
47
+
48
+ dashboard:
49
+ type: 'role'
50
+ value: 'link'
51
+ name: 'Dashboard'
52
+ ```
53
+
54
+ **qa/screens/login/test-data/login.yaml**
55
+ ```yaml
56
+ email: 'admin@example.com'
57
+ password: 'password123'
58
+ welcome_text: 'Welcome back'
59
+ ```
60
+
61
+ ## Key Rules
62
+
63
+ ### YAML key format (CRITICAL)
64
+
65
+ YAML keys = Gherkin `[Reference]` converted to: **lowercase, spaces→dots, no special chars**.
66
+
67
+ | Gherkin | YAML Key |
68
+ |---|---|
69
+ | `[Submit]` | `submit:` |
70
+ | `[Search Content]` | `search.content:` |
71
+ | `[Kudos Detail Modal]` | `kudos.detail.modal:` |
72
+ | `[Page 2]` | `page.2:` |
73
+
74
+ **NEVER use spaces in YAML keys.**
75
+
76
+ ### Gherkin patterns (all 17)
77
+
78
+ ```
79
+ User click [Target] button # click
80
+ User fill [Target] field with {{value}} # fill
81
+ User check [Target] checkbox # check/uncheck
82
+ User select [Target] dropdown with {{value}} # select
83
+ User upload [Target] file with {{filename}} # upload
84
+ User double click [Target] element # double click
85
+ User hover [Target] icon # hover
86
+ User clear [Target] field # clear
87
+ User press Escape key # global key
88
+ User press Enter on [Target] field # key on element
89
+ User is on [target] page # navigate (Given)
90
+ User see [target] page # URL assertion (Then)
91
+ User wait for 3 seconds # wait timeout
92
+ User wait for [Target] dialog is hidden # wait state
93
+ User scroll to [Target] section # scroll
94
+ User switch to [Target] frame # iframe
95
+ User see [Target] heading with {{value}} # visible assertion
96
+ User see [Target] button is disabled # state assertion
97
+ User see [Target] text contains {{partial}} # text contains
98
+ User see [Table] table has row with {{filter}} # table row
99
+ User see [Table] table row with {{f}} has [Col] with {{v}} # table cell
100
+ User click [Edit] in [Table] table row with {{name}} # action in row
101
+ ```
102
+
103
+ States: `hidden`, `visible`, `disabled`, `enabled`, `checked`, `unchecked`, `focused`, `empty`
104
+
105
+ ### Selector types
106
+
107
+ | type | value | name | when to use |
108
+ |---|---|---|---|
109
+ | `role` | `button`, `heading`, `link`, etc. | accessible name | **preferred** for interactive elements |
110
+ | `testid` | `data-testid` value | — | when `data-testid` exists |
111
+ | `placeholder` | placeholder text | — | input fields |
112
+ | `label` | label text | — | labeled inputs |
113
+ | `text` | — | — | static text content |
114
+ | `locator` | CSS selector | — | **last resort** |
115
+ | `page` | relative URL path | — | navigation targets |
116
+ | `upload` | — | — | file upload inputs |
117
+ | `frame` | iframe selector | — | iframe targets |
118
+
119
+ Priority: `testid` > `role+name` > `placeholder` > `label` > `text` > `locator`
120
+
121
+ ### Tags
122
+
123
+ | Tag | Effect |
124
+ |---|---|
125
+ | `@auth:role` | Adds `test.use({ storageState: 'specs/.auth/role.json' })` |
126
+ | `@steps:name` | Define reusable step group |
127
+ | `@extend:name` | Inherit steps from another scenario |
128
+ | `@manual` | Skip in generation |
129
+
130
+ ### Selector options
131
+
132
+ ```yaml
133
+ element.key:
134
+ type: 'role'
135
+ value: 'button'
136
+ name: 'Submit' # accessible name
137
+ nth: 0 # element index (0=first)
138
+ exact: true # exact name match (avoid substring collisions)
139
+ scope: 'navigation' # parent landmark scope
140
+ match: 'exact' # exact text match for getByText
141
+ variant: 'native' # dropdown: 'native' (<select>) or 'custom' (div-based)
142
+ frame: '#iframe-id' # iframe scope
143
+ contenteditable: true # rich text editor
144
+ columns: # table columns
145
+ name: { index: 0, header: 'Name' }
146
+ ```
147
+
148
+ ### Navigation and baseURL
149
+
150
+ Page selectors use **relative paths only**. Playwright prepends `baseURL` from `playwright.config.ts`.
151
+
152
+ ```yaml
153
+ login:
154
+ type: 'page'
155
+ value: '/login' # NOT https://example.com/login
156
+ ```
157
+
158
+ ### Auth
159
+
160
+ - `@auth:admin` on Feature or Scenario → compiler adds `test.use({ storageState: 'specs/.auth/admin.json' })`
161
+ - Auth JSON created by: `sungen makeauth admin` (opens browser for manual login)
162
+ - **Login pages**: no `@auth` tag needed
163
+ - **Authenticated pages**: always add `@auth:role`
164
+
165
+ ## Using Playwright MCP to explore pages
166
+
167
+ When exploring a page to generate test files:
168
+ 1. Read `playwright.config.ts` for `baseURL`
169
+ 2. Use `browser_navigate` to open `baseURL + /path`
170
+ 3. Use `browser_snapshot` to see all elements
171
+ 4. Generate the 3 files from the snapshot
172
+
173
+ **NEVER use `browser_run_code`.** It fails with `require is not defined`.
174
+ Only use: `browser_navigate`, `browser_snapshot`, `browser_click`, `browser_fill_form`, `browser_evaluate`.
175
+
176
+ To browse authenticated pages via MCP:
177
+ 1. Read `specs/.auth/role.json` with your file read tool
178
+ 2. `browser_navigate` to the page
179
+ 3. `browser_evaluate` to inject localStorage and cookies from the JSON
180
+ 4. `browser_navigate` again to reload with auth
181
+
182
+ ## Commands
183
+
184
+ ```bash
185
+ sungen add --screen <name> --path <url-path> # Create screen
186
+ sungen generate --screen <name> # Compile to .spec.ts
187
+ sungen generate --all # Compile all
188
+ sungen makeauth <role> # Capture auth state
189
+ ```
@@ -0,0 +1,16 @@
1
+ # Dependencies
2
+ node_modules/
3
+
4
+ # Build output
5
+ dist/
6
+ build/
7
+
8
+ # Environment variables
9
+ .env
10
+ .env.local
11
+
12
+ # IDE
13
+ .vscode/
14
+ .idea/
15
+ *.swp
16
+ *.swo
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Read environment variables from file.
3
+ * https://github.com/motdotla/dotenv
4
+ */
5
+ /**
6
+ * See https://playwright.dev/docs/test-configuration.
7
+ */
8
+ declare const _default: import("@playwright/test").PlaywrightTestConfig<{}, {}>;
9
+ export default _default;
10
+ //# sourceMappingURL=playwright.config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.config.d.ts","sourceRoot":"","sources":["../../../src/orchestrator/templates/playwright.config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAKH;;GAEG;;AACH,wBAkEG"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const test_1 = require("@playwright/test");
4
+ /**
5
+ * Read environment variables from file.
6
+ * https://github.com/motdotla/dotenv
7
+ */
8
+ // import dotenv from 'dotenv';
9
+ // import path from 'path';
10
+ // dotenv.config({ path: path.resolve(__dirname, '.env') });
11
+ /**
12
+ * See https://playwright.dev/docs/test-configuration.
13
+ */
14
+ exports.default = (0, test_1.defineConfig)({
15
+ testDir: './specs/generated',
16
+ /* Run tests in files in parallel */
17
+ fullyParallel: true,
18
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
19
+ forbidOnly: !!process.env.CI,
20
+ /* Retry on CI only */
21
+ retries: process.env.CI ? 2 : 0,
22
+ /* Opt out of parallel tests on CI. */
23
+ workers: process.env.CI ? 1 : undefined,
24
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
25
+ reporter: 'html',
26
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27
+ use: {
28
+ /* Base URL to use in actions like `await page.goto('')`. */
29
+ baseURL: 'https://example.com',
30
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
31
+ trace: 'on-first-retry',
32
+ },
33
+ /* Configure projects for major browsers */
34
+ projects: [
35
+ {
36
+ name: 'chromium',
37
+ use: { ...test_1.devices['Desktop Chrome'] },
38
+ },
39
+ /*
40
+ // {
41
+ // name: 'firefox',
42
+ // use: { ...devices['Desktop Firefox'] },
43
+ // },
44
+
45
+ // {
46
+ // name: 'webkit',
47
+ // use: { ...devices['Desktop Safari'] },
48
+ // },
49
+
50
+ /* Test against mobile viewports.
51
+ // {
52
+ // name: 'Mobile Chrome',
53
+ // use: { ...devices['Pixel 5'] },
54
+ // },
55
+ // {
56
+ // name: 'Mobile Safari',
57
+ // use: { ...devices['iPhone 12'] },
58
+ // },
59
+
60
+ /* Test against branded browsers. */
61
+ // {
62
+ // name: 'Microsoft Edge',
63
+ // use: { ...devices['Desktop Edge'], channel: 'msedge' },
64
+ // },
65
+ // {
66
+ // name: 'Google Chrome',
67
+ // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68
+ // },
69
+ ],
70
+ /* Run your local dev server before starting the tests */
71
+ // webServer: {
72
+ // command: 'npm run start',
73
+ // url: 'http://localhost:3000',
74
+ // reuseExistingServer: !process.env.CI,
75
+ // },
76
+ });
77
+ //# sourceMappingURL=playwright.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright.config.js","sourceRoot":"","sources":["../../../src/orchestrator/templates/playwright.config.ts"],"names":[],"mappings":";;AAAA,2CAAyD;AAEzD;;;GAGG;AACH,+BAA+B;AAC/B,2BAA2B;AAC3B,4DAA4D;AAE5D;;GAEG;AACH,kBAAe,IAAA,mBAAY,EAAC;IAC1B,OAAO,EAAE,mBAAmB;IAC5B,oCAAoC;IACpC,aAAa,EAAE,IAAI;IACnB,iFAAiF;IACjF,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;IAC5B,sBAAsB;IACtB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;IACvC,qEAAqE;IACrE,QAAQ,EAAE,MAAM;IAChB,wGAAwG;IACxG,GAAG,EAAE;QACH,4DAA4D;QAC5D,OAAO,EAAE,qBAAqB;QAE9B,+FAA+F;QAC/F,KAAK,EAAE,gBAAgB;KACxB;IAED,2CAA2C;IAC3C,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,EAAE,GAAG,cAAO,CAAC,gBAAgB,CAAC,EAAE;SACtC;QAED;;;;;;;;;;;;;;;;;;;;;4CAqBoC;QACpC,IAAI;QACJ,4BAA4B;QAC5B,4DAA4D;QAC5D,KAAK;QACL,IAAI;QACJ,2BAA2B;QAC3B,8DAA8D;QAC9D,KAAK;KACN;IAED,yDAAyD;IACzD,eAAe;IACf,8BAA8B;IAC9B,kCAAkC;IAClC,0CAA0C;IAC1C,KAAK;CACN,CAAC,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { defineConfig, devices } from '@playwright/test';
2
+
3
+ /**
4
+ * Read environment variables from file.
5
+ * https://github.com/motdotla/dotenv
6
+ */
7
+ // import dotenv from 'dotenv';
8
+ // import path from 'path';
9
+ // dotenv.config({ path: path.resolve(__dirname, '.env') });
10
+
11
+ /**
12
+ * See https://playwright.dev/docs/test-configuration.
13
+ */
14
+ export default defineConfig({
15
+ testDir: './specs/generated',
16
+ /* Run tests in files in parallel */
17
+ fullyParallel: true,
18
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
19
+ forbidOnly: !!process.env.CI,
20
+ /* Retry on CI only */
21
+ retries: process.env.CI ? 2 : 0,
22
+ /* Opt out of parallel tests on CI. */
23
+ workers: process.env.CI ? 1 : undefined,
24
+ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
25
+ reporter: 'html',
26
+ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
27
+ use: {
28
+ /* Base URL to use in actions like `await page.goto('')`. */
29
+ baseURL: 'https://example.com',
30
+
31
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
32
+ trace: 'on-first-retry',
33
+ },
34
+
35
+ /* Configure projects for major browsers */
36
+ projects: [
37
+ {
38
+ name: 'chromium',
39
+ use: { ...devices['Desktop Chrome'] },
40
+ },
41
+
42
+ /*
43
+ // {
44
+ // name: 'firefox',
45
+ // use: { ...devices['Desktop Firefox'] },
46
+ // },
47
+
48
+ // {
49
+ // name: 'webkit',
50
+ // use: { ...devices['Desktop Safari'] },
51
+ // },
52
+
53
+ /* Test against mobile viewports.
54
+ // {
55
+ // name: 'Mobile Chrome',
56
+ // use: { ...devices['Pixel 5'] },
57
+ // },
58
+ // {
59
+ // name: 'Mobile Safari',
60
+ // use: { ...devices['iPhone 12'] },
61
+ // },
62
+
63
+ /* Test against branded browsers. */
64
+ // {
65
+ // name: 'Microsoft Edge',
66
+ // use: { ...devices['Desktop Edge'], channel: 'msedge' },
67
+ // },
68
+ // {
69
+ // name: 'Google Chrome',
70
+ // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
71
+ // },
72
+ ],
73
+
74
+ /* Run your local dev server before starting the tests */
75
+ // webServer: {
76
+ // command: 'npm run start',
77
+ // url: 'http://localhost:3000',
78
+ // reuseExistingServer: !process.env.CI,
79
+ // },
80
+ });
@@ -0,0 +1,197 @@
1
+ # Sungen Test Automation
2
+
3
+ This project uses [Sungen v2](https://github.com/sun-asterisk/sungen) — a deterministic E2E test compiler.
4
+
5
+ ## How it works
6
+
7
+ ```
8
+ AI (Copilot/Claude + MCP Playwright) → visits URL → generates files
9
+ sungen generate → compiles Gherkin + selectors + data → Playwright .spec.ts
10
+ ```
11
+
12
+ ## Directory Structure
13
+
14
+ ```
15
+ ├── qa/screens/<name>/
16
+ │ ├── features/ # .feature files (Gherkin)
17
+ │ ├── selectors/ # Element locator YAML mappings
18
+ │ └── test-data/ # Test data YAML values
19
+ ├── specs/
20
+ │ ├── generated/ # Auto-generated Playwright tests
21
+ │ └── .auth/ # Auth storage states
22
+ ├── docs/
23
+ │ └── gherkin-dictionary.md # Full grammar & compiler rules
24
+ ├── .github/
25
+ │ └── copilot-instructions.md # AI rules for GitHub Copilot
26
+ └── CLAUDE.md # AI rules for Claude Code
27
+ ```
28
+
29
+ ## Workflow
30
+
31
+ ### 1. Add a screen
32
+
33
+ ```bash
34
+ sungen add --screen login --path /login
35
+ # Add more features to an existing screen:
36
+ sungen add --screen login --feature forgot-password
37
+ ```
38
+
39
+ ### 2. Set up auth (if needed)
40
+
41
+ ```bash
42
+ sungen makeauth admin
43
+ # Opens browser → login manually → saves specs/.auth/admin.json
44
+ ```
45
+
46
+ ### 3. Generate Gherkin + selectors with AI
47
+
48
+ Use your AI assistant (GitHub Copilot or Claude Code) to:
49
+ 1. Navigate to the page URL via MCP Playwright
50
+ 2. Take an accessibility snapshot
51
+ 3. Generate `.feature` + `selectors.yaml` + `test-data.yaml`
52
+
53
+ The AI rules in `.github/copilot-instructions.md` and `CLAUDE.md` teach the AI
54
+ how to write correct Gherkin syntax and selector YAML for sungen.
55
+
56
+ ### 4. Compile to Playwright tests
57
+
58
+ ```bash
59
+ sungen generate --screen login
60
+ # or for all screens:
61
+ sungen generate --all
62
+ ```
63
+
64
+ ### 5. Run tests
65
+
66
+ ```bash
67
+ npx playwright test
68
+ npx playwright test --ui # interactive mode
69
+ ```
70
+
71
+ ### 6. Fix failures (AI Verify loop)
72
+
73
+ When tests fail, use AI to read the error → fix `selectors.yaml` → recompile → re-run.
74
+
75
+ | Error | Fix in selectors.yaml |
76
+ |---|---|
77
+ | strict mode: resolved to N elements | Add `exact: true` or `scope` or `nth` |
78
+ | element(s) not found | Fix `name`, `type`, or `value` |
79
+ | getByText matched too many | Add `match: 'exact'` or `nth` |
80
+
81
+ ---
82
+
83
+ ## Gherkin Guide
84
+
85
+ ### Syntax
86
+
87
+ ```
88
+ User <action> [<Target>] <type> with {{<Value>}}
89
+ ```
90
+
91
+ - `[Target]` → selector reference → lookup in `selectors/*.yaml`
92
+ - `{{Value}}` → test data reference → lookup in `test-data/*.yaml`
93
+ - `<type>` → element type: button, link, field, heading, text, etc.
94
+
95
+ ### Pattern Shapes (17 total)
96
+
97
+ #### Actions
98
+
99
+ | Pattern | Example |
100
+ |---|---|
101
+ | Simple click | `User click [Submit] button` |
102
+ | Click with data | `User click [Teammate] button with {{name}}` |
103
+ | Fill field | `User fill [Email] field with {{email}}` |
104
+ | Check/Uncheck | `User check [Remember me] checkbox` |
105
+ | Select dropdown | `User select [Country] dropdown with {{country}}` |
106
+ | Upload file | `User upload [Avatar] file with {{path}}` |
107
+ | Double click | `User double click [Cell] element` |
108
+ | Hover | `User hover [Info] icon` |
109
+ | Clear | `User clear [Search] field` |
110
+
111
+ #### Keyboard
112
+
113
+ | Pattern | Example |
114
+ |---|---|
115
+ | Global key | `User press Escape key` |
116
+ | Key on element | `User press Enter on [Search] field` |
117
+
118
+ #### Navigation
119
+
120
+ | Pattern | Example |
121
+ |---|---|
122
+ | Open page | `User is on [login] page` |
123
+ | See page (URL) | `User see [dashboard] page` |
124
+
125
+ #### Wait
126
+
127
+ | Pattern | Example |
128
+ |---|---|
129
+ | Wait timeout | `User wait for 3 seconds` |
130
+ | Wait element | `User wait for [Modal] dialog` |
131
+ | Wait hidden | `User wait for [Loading] spinner is hidden` |
132
+ | Wait with data | `User wait for [Dialog] dialog with {{title}}` |
133
+
134
+ #### Assertions
135
+
136
+ | Pattern | Example |
137
+ |---|---|
138
+ | See element | `User see [Welcome] heading` |
139
+ | See with value | `User see [Title] heading with {{title}}` |
140
+ | State check | `User see [Submit] button is disabled` |
141
+ | State + data | `User see [Panel] dialog with {{title}} is hidden` |
142
+ | Text contains | `User see [Message] text contains {{partial}}` |
143
+
144
+ States: `hidden`, `visible`, `disabled`, `enabled`, `checked`, `unchecked`, `focused`, `empty`
145
+
146
+ #### Table
147
+
148
+ | Pattern | Example |
149
+ |---|---|
150
+ | Row exists | `User see [Users] table has row with {{name}}` |
151
+ | No row | `User see [Users] table has no row with {{name}}` |
152
+ | Row count | `User see [Users] table has {{count}} rows` |
153
+ | Column exists | `User see [Users] table has [Email] column` |
154
+ | Cell by filter | `User see [Users] table row with {{name}} has [Status] with {{status}}` |
155
+ | Cell by index | `User see [Users] table row 1 [Name] cell with {{name}}` |
156
+ | Action in row | `User click [Edit] in [Users] table row with {{name}}` |
157
+ | Empty table | `User see [Users] table is empty` |
158
+
159
+ #### Scope
160
+
161
+ | Pattern | Example |
162
+ |---|---|
163
+ | Scroll | `User scroll to [Footer] section` |
164
+ | Frame enter | `User switch to [Payment] frame` |
165
+ | Frame exit | `User switch to [main] frame` |
166
+
167
+ ### Tags
168
+
169
+ | Tag | Purpose |
170
+ |---|---|
171
+ | `@auth:role` | Use Playwright storage state for auth |
172
+ | `@steps:name` | Define reusable step group |
173
+ | `@extend:name` | Inherit steps from another scenario |
174
+ | `@manual` | Skip scenario in generation |
175
+
176
+ ### Selector YAML
177
+
178
+ ```yaml
179
+ submit.button:
180
+ type: 'role' # testid, role, text, label, placeholder, locator, page
181
+ value: 'button' # role name, testid value, CSS selector, etc.
182
+ name: 'Submit' # accessible name
183
+ nth: 0 # element index (0=first, 1=.nth(0), 2=.nth(1))
184
+ exact: true # exact name match (avoid "Submit" matching "Submit Form")
185
+ scope: 'desktop navigation' # scope to parent landmark
186
+ match: 'exact' # exact text match for getByText
187
+ ```
188
+
189
+ Locator priority: `data-testid` > `role+name` > `label` > `text` > `CSS`
190
+
191
+ ---
192
+
193
+ ## Documentation
194
+
195
+ - [Gherkin Dictionary](docs/gherkin-dictionary.md) — full grammar, all 17 patterns, compiler rules
196
+ - [Sungen GitHub](https://github.com/sun-asterisk/sungen)
197
+ - [Playwright Documentation](https://playwright.dev)