symfonia-ai-tools 1.0.0

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 (74) hide show
  1. package/README.md +489 -0
  2. package/bin/cli.mjs +35 -0
  3. package/lib/installer.mjs +495 -0
  4. package/lib/questions.mjs +332 -0
  5. package/lib/ui.mjs +76 -0
  6. package/lib/utils.mjs +231 -0
  7. package/package.json +26 -0
  8. package/templates/base/CLAUDE.md +34 -0
  9. package/templates/base/_ai/_guidelines_header.md +70 -0
  10. package/templates/base/_ai/context/README.md +20 -0
  11. package/templates/base/_ai/prompts/codereview.prompt.md +324 -0
  12. package/templates/base/_ai/prompts/duplicate-code-analysis.prompt.md +128 -0
  13. package/templates/base/_ai/prompts/figma-analysis.prompt.md +155 -0
  14. package/templates/base/_ai/prompts/security-review.prompt.md +46 -0
  15. package/templates/base/_ai/skills/README.md +80 -0
  16. package/templates/base/_ai/skills/TEMPLATE.md +106 -0
  17. package/templates/base/_ai/skills/babysit-prs/SKILL.md +105 -0
  18. package/templates/base/_ai/skills/debug/SKILL.md +93 -0
  19. package/templates/base/_ai/skills/fill-worklogs/SKILL.md +158 -0
  20. package/templates/base/_ai/skills/hotfix/SKILL.md +52 -0
  21. package/templates/base/_ai/skills/jira-task/SKILL.md +170 -0
  22. package/templates/base/_ai/skills/my-prs/SKILL.md +78 -0
  23. package/templates/base/_ai/skills/pr-dashboard/SKILL.md +43 -0
  24. package/templates/base/_ai/skills/pr-prepare/SKILL.md +106 -0
  25. package/templates/base/_ai/skills/refactor/SKILL.md +87 -0
  26. package/templates/base/_ai/skills/write-tests/SKILL.md +109 -0
  27. package/templates/base/_claude/settings.local.json +37 -0
  28. package/templates/base/_cursor/rules/global.mdc +7 -0
  29. package/templates/base/_editorconfig +18 -0
  30. package/templates/base/_gemini/settings.json +3 -0
  31. package/templates/base/_github/copilot-instructions.md +1 -0
  32. package/templates/base/_github/pull_request_template.md +23 -0
  33. package/templates/base/_gitignore +22 -0
  34. package/templates/base/_junie/guidelines.md +1 -0
  35. package/templates/base/commit-instructions.md +92 -0
  36. package/templates/packs/docker/_ai/instructions/docker.instructions.md +193 -0
  37. package/templates/packs/docker/_guidelines.md +10 -0
  38. package/templates/packs/docker/pack.json +8 -0
  39. package/templates/packs/laravel/_ai/instructions/api-resource.instructions.md +251 -0
  40. package/templates/packs/laravel/_ai/instructions/module.instructions.md +133 -0
  41. package/templates/packs/laravel/_ai/instructions/service-repository.instructions.md +215 -0
  42. package/templates/packs/laravel/_ai/instructions/testing.instructions.md +278 -0
  43. package/templates/packs/laravel/_ai/skills/migration/SKILL.md +172 -0
  44. package/templates/packs/laravel/_ai/skills/new-endpoint/SKILL.md +165 -0
  45. package/templates/packs/laravel/_ai/skills/new-module/SKILL.md +208 -0
  46. package/templates/packs/laravel/_ai/skills/queued-job/SKILL.md +248 -0
  47. package/templates/packs/laravel/_ai/skills/testing-feature/SKILL.md +196 -0
  48. package/templates/packs/laravel/_ai/skills/testing-manual/SKILL.md +186 -0
  49. package/templates/packs/laravel/_ai/skills/testing-unit/SKILL.md +200 -0
  50. package/templates/packs/laravel/_guidelines.md +25 -0
  51. package/templates/packs/laravel/pack.json +6 -0
  52. package/templates/packs/playwright/_ai/instructions/playwright.instructions.md +219 -0
  53. package/templates/packs/playwright/_ai/skills/playwright/README.md +194 -0
  54. package/templates/packs/playwright/_ai/skills/playwright/SKILL.md +1245 -0
  55. package/templates/packs/playwright/_ai/skills/playwright-codereview/SKILL.md +642 -0
  56. package/templates/packs/playwright/_ai/skills/playwright-record/README.md +87 -0
  57. package/templates/packs/playwright/_ai/skills/playwright-record/SKILL.md +564 -0
  58. package/templates/packs/playwright/_guidelines.md +12 -0
  59. package/templates/packs/playwright/pack.json +9 -0
  60. package/templates/packs/storybook/_ai/instructions/storybook.instructions.md +181 -0
  61. package/templates/packs/storybook/pack.json +6 -0
  62. package/templates/packs/vitest/_ai/instructions/vitest.instructions.md +688 -0
  63. package/templates/packs/vitest/pack.json +6 -0
  64. package/templates/packs/vue3/_ai/instructions/api.instructions.md +163 -0
  65. package/templates/packs/vue3/_ai/instructions/coding-conventions.instructions.md +160 -0
  66. package/templates/packs/vue3/_ai/instructions/composables.instructions.md +218 -0
  67. package/templates/packs/vue3/_ai/instructions/forms.instructions.md +227 -0
  68. package/templates/packs/vue3/_ai/instructions/store.instructions.md +504 -0
  69. package/templates/packs/vue3/_ai/instructions/vue.instructions.md +339 -0
  70. package/templates/packs/vue3/_ai/skills/api-integration/SKILL.md +195 -0
  71. package/templates/packs/vue3/_ai/skills/new-component/SKILL.md +133 -0
  72. package/templates/packs/vue3/_ai/skills/new-module/SKILL.md +177 -0
  73. package/templates/packs/vue3/_guidelines.md +45 -0
  74. package/templates/packs/vue3/pack.json +11 -0
@@ -0,0 +1,87 @@
1
+ # Playwright Test Recording Skill
2
+
3
+ **Record browser interactions and save raw test code to `tmp/` directory**
4
+
5
+ ## What This Skill Does
6
+
7
+ This skill handles **RECORDING ONLY** - it captures your clicks and saves raw JavaScript to `tmp/`.
8
+
9
+ **Conversion to production code** is handled by separate skill: `playwright/SKILL.md`
10
+
11
+ ## Quick Facts
12
+
13
+ | Aspect | Details |
14
+ |--------|---------|
15
+ | **User involvement** | Only clicking in browser during recording |
16
+ | **AI automation** | Launch Codegen, monitor recording, verify save |
17
+ | **Input** | User clicks in browser + scenario description |
18
+ | **Output** | Raw JavaScript file in `tmp/` directory |
19
+ | **Does NOT do** | Conversion, Page Objects, assertions (use `playwright` skill) |
20
+
21
+ ## Workflow Breakdown
22
+
23
+ ### What AI Does (Automated)
24
+ 1. Setup environment and configuration
25
+ 2. Launch Codegen with proper URL
26
+ 3. Monitor recording process
27
+ 4. Verify raw JavaScript saved to `tmp/`
28
+
29
+ ### What User Does (Manual)
30
+ 1. Click in browser to perform scenario
31
+ 2. Close Playwright Inspector when done
32
+
33
+ **User time**: 2-3 minutes
34
+ **AI time**: 5-10 seconds
35
+ **Output**: Raw `.js` file in `tmp/`
36
+
37
+ ## When to Use This Skill
38
+
39
+ **Use `playwright-record` when**:
40
+ - Creating a NEW test from scratch
41
+ - Want to record user flow by clicking
42
+ - Need to capture browser interactions
43
+
44
+ **Use `playwright` skill instead when**:
45
+ - Need to CONVERT raw test to production code
46
+ - Need to create Page Objects
47
+ - Want to add assertions
48
+ - Want to refactor existing test
49
+
50
+ ## Next Steps After Recording
51
+
52
+ After recording completes, **AI ASKS if you want to continue**.
53
+
54
+ **AI will ask:**
55
+ > "Would you like me to convert this test to production code now?"
56
+
57
+ **If you say YES:**
58
+ - AI switches to `playwright` skill
59
+ - Checks existing Page Objects (NO DUPLICATION!)
60
+ - Converts JS to TS
61
+ - Creates/updates POMs
62
+ - Moves to `tests/`
63
+
64
+ **If you say NO:**
65
+ - Recording ends
66
+ - Raw file stays in `tmp/`
67
+ - You can convert later manually
68
+
69
+ ## Documentation
70
+
71
+ **[SKILL.md](./SKILL.md)** - Complete documentation with:
72
+ - Recording workflow
73
+ - Configuration files
74
+ - Real-world example
75
+ - What happens after recording
76
+
77
+ ## Quick Start
78
+
79
+ ```bash
80
+ # AI launches this automatically (you just click in browser)
81
+ npx playwright codegen {{BASE_URL}}/login \
82
+ --output=tmp/playwright-test-mytest.js
83
+ ```
84
+
85
+ ---
86
+
87
+ **Remember**: This skill only RECORDS. For conversion, use `playwright` skill!
@@ -0,0 +1,564 @@
1
+ ---
2
+ name: playwright-record
3
+ description: Guides users through recording and generating Playwright tests using Codegen tool. Helps convert recorded interactions into production-ready tests following project conventions, including proper Page Objects, data-testid selectors, and project structure.
4
+ ---
5
+
6
+ # Playwright Test Recording
7
+
8
+ Expert skill for recording Playwright tests and converting them into production-ready code that follows project testing standards.
9
+
10
+ ## When to Use This Skill
11
+
12
+ Use this skill when the user:
13
+
14
+ - Wants to record a new test scenario
15
+ - Asks "how do I record a test?"
16
+ - Says "generate test from browser interaction"
17
+ - Wants to quickly prototype a test
18
+ - Asks about Playwright Codegen
19
+ - Needs help converting recorded test to POM pattern
20
+ - Wants to capture complex user flows
21
+
22
+ ## Required Input
23
+
24
+ - Start URL for the recording session (if not provided, ask the user to supply it before running Codegen).
25
+
26
+ ## What This Skill Does vs What User Does
27
+
28
+ **This skill handles RECORDING ONLY** - it captures browser interactions and saves raw code to `{{PLAYWRIGHT_DIR}}/tmp`.
29
+
30
+ **Conversion to production code is handled by `playwright/SKILL.md`** - separate skill for refactoring.
31
+
32
+ ### Recording Workflow Breakdown
33
+
34
+ | **Step** | **What AI Does (Automated)** | **What User Does (Manual)** |
35
+ |----------|------------------------------|------------------------------|
36
+ | **1. Setup** | Checks if `{{PLAYWRIGHT_DIR}}/tmp` directory exists<br>Verifies `.env` and credentials configuration<br>Prepares output file path | Nothing |
37
+ | **2. Launch Codegen** | Runs `npx playwright codegen <URL> --output={{PLAYWRIGHT_DIR}}/tmp/file.js`<br>Opens browser and Playwright Inspector<br>Monitors process status<br>If URL not provided, asks user to provide it before running Codegen | Nothing |
38
+ | **3. Recording** | Monitors Codegen recording<br>Tracks generated code in real-time<br>Waits for user to finish | **Clicks in browser**<br>**Performs scenario steps**<br>**Closes Inspector when done** |
39
+ | **4. Save Raw Code** | Verifies file was saved to `{{PLAYWRIGHT_DIR}}/tmp`<br>Shows path to recorded file<br>**ENDS HERE** | Nothing |
40
+
41
+ ### Summary: Scope of This Skill
42
+
43
+ - **User**: Clicks in browser during recording (Step 3)
44
+ - **AI**: Launches Codegen, monitors recording, verifies save
45
+ - **Output**: Raw JavaScript file in `{{PLAYWRIGHT_DIR}}/tmp` directory
46
+ - **Next step**: Use `playwright/SKILL.md` to convert raw code to production test
47
+
48
+ **This skill does NOT:**
49
+ - Convert JavaScript to TypeScript
50
+ - Create Page Object Models
51
+ - Add assertions
52
+ - Move tests to production
53
+ - **All conversion is done by `playwright/SKILL.md`**
54
+
55
+ ---
56
+
57
+ ## Difference Between This Skill and `playwright/SKILL.md`
58
+
59
+ ### `.github/skills/playwright-record/SKILL.md` (THIS FILE)
60
+
61
+ **Purpose**: Record NEW tests by clicking in browser, then AUTO-CONVERT to production
62
+
63
+ | Aspect | Description |
64
+ |--------|-------------|
65
+ | **When to use** | Creating a NEW test from scratch using browser interaction |
66
+ | **Input** | User scenario description + User clicks in browser |
67
+ | **Process** | Codegen -> Recording -> **AUTOMATIC CONVERSION** -> Production test |
68
+ | **Output** | Clean TypeScript test in `tests/` with POMs, assertions, helpers |
69
+ | **User involvement** | **Manual clicking during recording only** |
70
+ | **AI involvement** | Setup, conversion, optimization, testing, deployment |
71
+
72
+ ### `.github/skills/playwright/SKILL.md`
73
+
74
+ **Purpose**: Run, debug, refactor EXISTING tests
75
+
76
+ | Aspect | Description |
77
+ |--------|-------------|
78
+ | **When to use** | Working with EXISTING tests (already written) |
79
+ | **Input** | Existing test file (TypeScript) |
80
+ | **Process** | Execute -> Analyze results -> Debug -> Refactor |
81
+ | **Output** | Test results (pass/fail), debugging info, refactored code |
82
+ | **User involvement** | None (or specifying what to change) |
83
+ | **AI involvement** | Running tests, analyzing failures, suggesting fixes |
84
+
85
+ ### Quick Decision Guide
86
+
87
+ **Use `playwright-record/SKILL.md` when**:
88
+ - "I want to record a new test by clicking"
89
+ - "Generate test from my browser interaction"
90
+ - "I need to capture this user flow"
91
+ - No test exists yet
92
+
93
+ **Use `playwright/SKILL.md` when**:
94
+ - "Run this test"
95
+ - "Debug why this test is failing"
96
+ - "Refactor this test to use Page Objects"
97
+ - Test already exists in `tests/` or `tmp/`
98
+
99
+ ---
100
+
101
+ ## Real-World Workflow Example
102
+
103
+ ### Scenario: User wants to test a feature workflow
104
+
105
+ **User says**:
106
+ > "Record a test for adding a new item with sub-items"
107
+
108
+ **AI executes (using THIS skill)**:
109
+
110
+ #### Phase 1: Recording Setup (Automated)
111
+ ```bash
112
+ # AI checks configuration
113
+ - Verified tmp/ directory exists
114
+ - Loaded .env configuration (BASE_URL, COMPANY_NAME)
115
+ - Loaded credentials configuration
116
+
117
+ # AI launches Codegen
118
+ npx playwright codegen {{BASE_URL}}/login \
119
+ --output={{PLAYWRIGHT_DIR}}/tmp/playwright-test-feature-name.js
120
+ ```
121
+
122
+ #### Phase 2: User Interaction (Manual)
123
+ ```
124
+ AI: "Browser opened. Please perform these steps:"
125
+ 1. Login as admin
126
+ 2. Navigate to the target module/feature
127
+ 3. Perform the scenario actions
128
+ 4. Close Playwright Inspector when done
129
+
130
+ USER: [clicks in browser following the steps]
131
+ ```
132
+
133
+ #### Phase 3: Save and Verify (Automated)
134
+
135
+ ```bash
136
+ # AI verifies file was saved
137
+ - File saved: tmp/playwright-test-feature-name.js
138
+ - File size: 1.2 KB
139
+ - Contains 26 lines of code
140
+
141
+ # AI reports
142
+ - Recording completed!
143
+ - Raw test saved to: tmp/playwright-test-feature-name.js
144
+ ```
145
+
146
+ **AI output to user**:
147
+ ```
148
+ Recording complete!
149
+
150
+ Saved to: {{PLAYWRIGHT_DIR}}/tmp/playwright-test-feature-name.js
151
+
152
+ Next steps:
153
+ 1. Review the recorded file
154
+ 2. To convert to production test, I can use playwright/SKILL.md
155
+
156
+ Would you like me to convert this test to production code now?
157
+ - This will check existing Page Objects
158
+ - Create/update POMs only if needed
159
+ - Add proper TypeScript structure and assertions
160
+ - Move to tests/ directory
161
+
162
+ Reply "yes" to continue with conversion, or "no" to stop here.
163
+ ```
164
+
165
+ **Total time**:
166
+ - User clicking: 2-3 minutes
167
+ - AI setup/monitoring: 5-10 seconds
168
+ - Result: Raw JavaScript file ready for conversion
169
+
170
+ ---
171
+
172
+ ### What Happens Next?
173
+
174
+ **This skill STOPS here and ASKS user.**
175
+
176
+ **If user confirms**, skill switches to `playwright/SKILL.md`:
177
+ - Read raw JavaScript from `tmp/`
178
+ - **Check existing Page Objects** (IMPORTANT: don't duplicate!)
179
+ - Convert to TypeScript
180
+ - Reuse existing POMs or create new ones
181
+ - Add assertions
182
+ - Move to `tests/` directory
183
+
184
+ **Separation of concerns:**
185
+ - `playwright-record` = **RECORDING** -> ask for confirmation
186
+ - `playwright` = **CONVERSION & TESTING** -> only if user confirms
187
+
188
+ ---
189
+
190
+ ## Recording Tests with Codegen
191
+
192
+ ### Workflow for Recorded Tests
193
+
194
+ **Directory Structure for Temporary Tests**:
195
+ ```
196
+ {{PLAYWRIGHT_DIR}}/
197
+ ├── tmp/ # Temporary/recorded tests (gitignored)
198
+ │ ├── playwright-test-login.js # Raw Codegen output
199
+ │ ├── playwright-test-feature.js # Experimental tests
200
+ │ └── ... # Auto-cleaned during development
201
+ ├── tests/ # Production tests only
202
+ │ ├── 01_Module/
203
+ │ │ ├── 01_01_01_TestName.spec.ts
204
+ │ │ └── 01_01_02_AnotherTest.spec.ts
205
+ │ └── ...
206
+ ```
207
+
208
+ **Purpose of `tmp/` directory**:
209
+ - Isolate experimental/recorded tests from production
210
+ - Easy cleanup of temporary files
211
+ - Clear project structure
212
+ - Gitignored - won't pollute version control
213
+ - Safe testing ground before creating production tests
214
+
215
+ **Workflow**:
216
+ 1. **Record** -> Save to `{{PLAYWRIGHT_DIR}}/tmp/playwright-test-*.js`
217
+ 2. **Test & Iterate** -> Run and refine in `tmp/`
218
+ 3. **Convert** -> Extract POMs, refactor, add structure
219
+ 4. **Move** -> Create production test in `tests/NN_Module/NN_NN_NN_Name.spec.ts`
220
+ 5. **Clean** -> Delete `tmp/` files after conversion
221
+
222
+ ### Basic Recording
223
+
224
+ ```bash
225
+ cd {{PLAYWRIGHT_DIR}}
226
+
227
+ # Start recording on test environment
228
+ npx playwright codegen {{BASE_URL}}/login
229
+
230
+ # Record with specific browser
231
+ npx playwright codegen --browser=chromium {{BASE_URL}}
232
+
233
+ # Record with device emulation
234
+ npx playwright codegen --device="iPhone 12" {{BASE_URL}}
235
+
236
+ # Record with existing context (logged in state)
237
+ npx playwright codegen --load-storage=auth.json {{BASE_URL}}
238
+ ```
239
+
240
+ ### Recording Workflow
241
+
242
+ **Recommended Process**: Record -> Save to `tmp/` -> Test -> Convert -> Production
243
+
244
+ **Step 1: Configuration Files**
245
+
246
+ The project uses configuration files for environment settings and credentials:
247
+
248
+ - **`.env`** - Environment configuration (`{{PLAYWRIGHT_DIR}}/.env`)
249
+ - `BASE_URL` - Application base URL (default: `{{BASE_URL}}`)
250
+ - `COMPANY_NAME` - Company/tenant to test
251
+ - `BROWSER`, `HEADLESS`, `WORKERS` - Test execution settings
252
+
253
+ - **`{{CREDENTIALS_FILE}}`** - Secure credentials (`{{PLAYWRIGHT_DIR}}/{{CREDENTIALS_FILE}}`)
254
+ - Contains login credentials for different environments/tenants
255
+ - **NOT in git** - stored locally only
256
+ - Structure: `{ "tenantName": { "email": { "right": "...", "wrong": "..." }, "password": {...} } }`
257
+
258
+ - **`playwright.config.ts`** - Main Playwright configuration
259
+ - Loads environment variables from `.env`
260
+ - Configures browsers, reporters, timeouts
261
+ - Sets base URL, locale, timezone
262
+
263
+ **Example credentials usage**:
264
+ ```typescript
265
+ // {{CREDENTIALS_FILE}} structure
266
+ {
267
+ "{{TENANT_NAME}}": {
268
+ "email": { "right": "user@test.example.com", "wrong": "wrong@wrong.com" },
269
+ "password": { "right": "SecurePassword!", "wrong": "WrongPass" }
270
+ }
271
+ }
272
+ ```
273
+
274
+ **Step 2: Prepare tmp/ Directory**
275
+
276
+ The `tmp/` directory is **already created and configured** in the project:
277
+ - Directory exists at `{{PLAYWRIGHT_DIR}}/tmp/`
278
+ - Already in `.gitignore` (no need to add manually)
279
+ - Ready for storing temporary recorded tests
280
+
281
+ **No need to run mkdir commands** - the directory structure is already set up!
282
+
283
+ **Step 3: Auto-Detect Dev Server (Optional for local testing)**
284
+
285
+ If testing locally, detect running dev servers:
286
+
287
+ ```bash
288
+ # Check for running dev servers on common ports
289
+ lsof -i :3000 -i :3001 -i :5173 -i :8080 | grep LISTEN
290
+
291
+ # Or manually check your dev server
292
+ npm run dev # Should show: Local: http://localhost:XXXX
293
+ ```
294
+
295
+ **Common dev server ports**:
296
+ - Vite: `5173`
297
+ - Vue CLI: `8080`
298
+ - Next.js: `3000`
299
+ - Custom: check your project configuration
300
+
301
+ **Step 4: Start Codegen**
302
+ ```bash
303
+ cd {{PLAYWRIGHT_DIR}}
304
+
305
+ # Use BASE_URL from .env (test environment)
306
+ npx playwright codegen {{BASE_URL}}/login
307
+
308
+ # Or specify output file for tmp/ directory
309
+ npx playwright codegen --output={{PLAYWRIGHT_DIR}}/tmp/playwright-test-[feature].js {{BASE_URL}}/login
310
+
311
+ # Or for local development
312
+ npx playwright codegen http://localhost/login
313
+ ```
314
+
315
+ **Step 5: Interact with Application**
316
+ - Click through the user flow you want to test
317
+ - Fill forms
318
+ - Navigate pages
319
+ - Trigger modals/dropdowns
320
+ - Complete the scenario
321
+
322
+ **Step 6: Save to tmp/ Directory**
323
+ - Codegen window shows generated code in real-time
324
+ - Copy the code when scenario is complete
325
+ - Save as `{{PLAYWRIGHT_DIR}}/tmp/playwright-test-[feature].js`
326
+ - Example: `{{PLAYWRIGHT_DIR}}/tmp/playwright-test-login-flow.js`
327
+
328
+ **Step 7: Test & Iterate in tmp/**
329
+ ```bash
330
+ cd {{PLAYWRIGHT_DIR}}
331
+
332
+ # Run the temporary test
333
+ npx playwright test tmp/playwright-test-login-flow.js --headed
334
+
335
+ # Refine and re-record if needed
336
+ ```
337
+
338
+
339
+ ## Recording Complex Flows
340
+
341
+ ### Multi-Step Scenarios
342
+
343
+ **Scenario**: Record user performing a multi-step workflow
344
+
345
+ ```bash
346
+ # Start recording
347
+ npx playwright codegen {{BASE_URL}}/login
348
+
349
+ # Perform actions:
350
+ # 1. Login
351
+ # 2. Navigate to target module
352
+ # 3. Click "Add" button
353
+ # 4. Fill the form
354
+ # 5. Submit
355
+ # 6. Verify item created
356
+ ```
357
+
358
+ **Recorded Output**:
359
+ ```typescript
360
+ test('test', async ({ page }) => {
361
+ await page.goto('{{BASE_URL}}/login');
362
+ await page.getByPlaceholder('Email').fill('test@example.com');
363
+ await page.getByRole('button', { name: 'Login' }).click();
364
+ await page.getByRole('link', { name: 'Target Module' }).click();
365
+ await page.getByRole('button', { name: 'Add item' }).click();
366
+ await page.getByPlaceholder('Item title').fill('New item');
367
+ await page.getByRole('button', { name: 'Save' }).click();
368
+ await expect(page.getByText('Item created')).toBeVisible();
369
+ });
370
+ ```
371
+ ### Recording Modal Interactions
372
+
373
+ **Challenge**: Modals, dropdowns, dynamic content
374
+
375
+ ```bash
376
+ # Record with slower actions to see dynamic content
377
+ npx playwright codegen --slowMo=500 {{BASE_URL}}
378
+ ```
379
+
380
+ **Recorded**:
381
+ ```typescript
382
+ await page.getByRole('button', { name: 'Add' }).click();
383
+ await page.locator('#modal').getByPlaceholder('Name').fill('Test');
384
+ await page.getByRole('button', { name: 'Save' }).click();
385
+ ```
386
+
387
+ ## Recording Authentication Flows
388
+
389
+ ### Save Authentication State
390
+
391
+ ```bash
392
+ # Login and save state
393
+ npx playwright codegen --save-storage=auth.json {{BASE_URL}}/login
394
+
395
+ # Use saved state for recording other flows
396
+ npx playwright codegen --load-storage=auth.json {{BASE_URL}}/dashboard
397
+ ```
398
+
399
+ **Benefits**:
400
+ - Skip login for every recording
401
+ - Focus on specific features
402
+ - Faster recording workflow
403
+
404
+ ## Best Practices for Recording
405
+
406
+ ### 1. Prepare Before Recording
407
+
408
+ - Know the user flow you want to test
409
+ - Have test data ready (if needed)
410
+ - Clear browser storage before starting
411
+ - Use test environment
412
+
413
+ ### 2. During Recording
414
+
415
+ - **Go slow** - Give Codegen time to capture actions
416
+ - **Use slowMo** - `--slowMo=500` for complex interactions
417
+ - **Wait for elements** - Let pages fully load
418
+ - **Avoid unnecessary clicks** - Stay focused on test scenario
419
+
420
+ ### 3. After Recording
421
+
422
+ - **Don't commit raw Codegen output**
423
+ - **Extract Page Objects immediately**
424
+ - **Replace all selectors with data-testid**
425
+ - **Add proper test structure**
426
+ - **Use dynamic test data**
427
+
428
+ ### 4. Recording Checklist
429
+
430
+ ### Before moving from tmp/ to production:
431
+
432
+ - [ ] Tested in `tmp/` directory first
433
+ - [ ] Replaced selectors with data-testid
434
+ - [ ] Verified test runs successfully
435
+
436
+ ## Common Recording Scenarios
437
+
438
+ ### Scenario 1: Login Flow
439
+
440
+ **Record**:
441
+ ```bash
442
+ npx playwright codegen {{BASE_URL}}/login
443
+ # Interact: Fill email -> Click continue -> Fill password -> Submit
444
+ ```
445
+
446
+ ## Troubleshooting Recording
447
+
448
+ ### Issue: Codegen doesn't capture action
449
+
450
+ **Solution**:
451
+ - Use `--slowMo=1000` for slower execution
452
+ - Wait for elements to be fully visible
453
+ - Try clicking the element multiple times
454
+
455
+ ### Issue: Generated selectors are fragile
456
+
457
+ **Solution**:
458
+ - Add data-testid to application components
459
+ - Use selector fallbacks in POMs
460
+ - Prefer stable attributes
461
+
462
+ ### Issue: Recording includes unnecessary steps
463
+
464
+ **Solution**:
465
+ - Clear recording and start fresh
466
+ - Focus on main flow only
467
+ - Remove debugging clicks from recording
468
+
469
+ ### Issue: Authentication state not saved
470
+
471
+ **Solution**:
472
+ ```bash
473
+ # Ensure you complete login before saving
474
+ npx playwright codegen --save-storage=auth.json {{BASE_URL}}/login
475
+
476
+ # Verify auth.json file created
477
+ ls -la auth.json
478
+
479
+ # Load in next recording
480
+ npx playwright codegen --load-storage=auth.json {{BASE_URL}}
481
+ ```
482
+
483
+ ## Quick Reference
484
+
485
+ ### tmp/ Workflow
486
+
487
+ The `tmp/` directory is **already set up** in the project - no need to create it.
488
+
489
+ ```bash
490
+ # 1. Navigate to playwright directory
491
+ cd {{PLAYWRIGHT_DIR}}
492
+
493
+ # 2. Record test
494
+ npx playwright codegen {{BASE_URL}}/login
495
+ # Save output to: {{PLAYWRIGHT_DIR}}/tmp/playwright-test-login.js
496
+
497
+ # 3. Test in tmp/
498
+ npx playwright test tmp/playwright-test-login.js --headed
499
+
500
+ # 4. Refine if needed
501
+ npx playwright codegen {{BASE_URL}}/login
502
+ # Update {{PLAYWRIGHT_DIR}}/tmp/playwright-test-login.js
503
+
504
+ # 5. Convert to production
505
+ # Create: tests/01_Module/01_01_01_TestName.spec.ts
506
+ # Following POM patterns from main playwright skill
507
+
508
+ # 6. Clean up
509
+ rm {{PLAYWRIGHT_DIR}}/tmp/playwright-test-login.js
510
+ ```
511
+
512
+ ### Auto-Detect Dev Servers
513
+
514
+ ```bash
515
+ # Check for running servers
516
+ lsof -i :3000 -i :3001 -i :5173 -i :8080 | grep LISTEN
517
+
518
+ # Or check npm process
519
+ ps aux | grep "npm run dev"
520
+
521
+ # Start your dev server
522
+ npm run dev # Note the port shown
523
+ ```
524
+
525
+ ### Recording Commands
526
+
527
+ **IMPORTANT**: URL is **required** before running any Codegen command. If user doesn't provide URL, ask them for it first.
528
+
529
+ ```bash
530
+ # Basic recording
531
+ npx playwright codegen <URL>
532
+
533
+ # Specific browser
534
+ npx playwright codegen --browser=firefox <URL>
535
+
536
+ # Device emulation
537
+ npx playwright codegen --device="iPhone 12" <URL>
538
+
539
+ # Slow motion
540
+ npx playwright codegen --slowMo=500 <URL>
541
+
542
+ # Save auth state
543
+ npx playwright codegen --save-storage=auth.json <URL>
544
+
545
+ # Load auth state
546
+ npx playwright codegen --load-storage=auth.json <URL>
547
+
548
+ # With viewport size
549
+ npx playwright codegen --viewport-size=1920,1080 <URL>
550
+
551
+ # Specific language
552
+ npx playwright codegen --lang=en <URL>
553
+ ```
554
+
555
+ ## Resources
556
+
557
+ - **Main Playwright Skill**: `.github/skills/playwright/SKILL.md`
558
+ - **Code Review Skill**: `.github/skills/playwright-codereview/SKILL.md`
559
+ - **Playwright Codegen Docs**: https://playwright.dev/docs/codegen
560
+ - **Project README**: `{{PLAYWRIGHT_DIR}}/README.md`
561
+
562
+ ---
563
+
564
+ **Remember**: Codegen is a starting point, not the final product. Always convert recorded tests to follow project conventions.
@@ -0,0 +1,12 @@
1
+
2
+
3
+ ---
4
+
5
+ ## Playwright E2E
6
+
7
+ - Test directory: `{{PLAYWRIGHT_DIR}}`
8
+ - Base URL: `{{BASE_URL}}`
9
+ - Use Page Object Model pattern
10
+ - Use `data-testid` selectors, avoid CSS/XPath
11
+ - Always wait for elements before interacting
12
+ - See `.ai/skills/playwright/` for writing and recording tests
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "Playwright E2E",
3
+ "description": "Testy end-to-end z Page Object Model",
4
+ "default": false,
5
+ "placeholders": {
6
+ "PLAYWRIGHT_DIR": { "question": "Katalog testow Playwright", "default": "tests/e2e" },
7
+ "BASE_URL": { "question": "Base URL aplikacji", "default": "http://localhost:3000" }
8
+ }
9
+ }