@cementic/cementic-test 0.2.3 → 0.2.4

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 (26) hide show
  1. package/README.md +273 -458
  2. package/dist/chunk-3EE7LWWT.js +353 -0
  3. package/dist/chunk-3EE7LWWT.js.map +1 -0
  4. package/dist/cli.js +337 -164
  5. package/dist/cli.js.map +1 -1
  6. package/dist/{gen-54KYT3RO.js → gen-IO4KKGYY.js} +2 -2
  7. package/dist/templates/student-framework/README.md +35 -5
  8. package/dist/templates/student-framework/package.json +3 -2
  9. package/dist/templates/student-framework/pages/BasePage.js +19 -0
  10. package/dist/templates/student-framework/pages/DashboardPage.js +16 -0
  11. package/dist/templates/student-framework/pages/FormPage.js +24 -0
  12. package/dist/templates/student-framework/pages/LoginPage.js +24 -0
  13. package/dist/templates/student-framework/tests/dashboard.spec.js +14 -0
  14. package/dist/templates/student-framework/tests/login.spec.js +14 -0
  15. package/dist/templates/student-framework-ts/README.md +20 -0
  16. package/dist/templates/student-framework-ts/package.json +24 -0
  17. package/dist/templates/student-framework-ts/pages/LandingPage.ts +15 -0
  18. package/dist/templates/student-framework-ts/playwright.config.ts +29 -0
  19. package/dist/templates/{student-framework/tests/landing.spec.js → student-framework-ts/tests/landing.spec.ts} +1 -1
  20. package/dist/templates/student-framework-ts/tsconfig.json +19 -0
  21. package/dist/templates/student-framework-ts/workflows/playwright.yml +20 -0
  22. package/package.json +2 -1
  23. package/dist/chunk-J63TUHIV.js +0 -80
  24. package/dist/chunk-J63TUHIV.js.map +0 -1
  25. package/dist/templates/student-framework/pages/LandingPage.js +0 -18
  26. /package/dist/{gen-54KYT3RO.js.map → gen-IO4KKGYY.js.map} +0 -0
package/README.md CHANGED
@@ -1,625 +1,440 @@
1
- **README.md** for CementicTest (CT).
1
+ # CementicTest CLI
2
2
 
3
- # CementicTest CLI (v0.2)
3
+ CementicTest CLI (`ct`) turns plain-English test cases into runnable Playwright tests with a Page Object Model-oriented workflow.
4
4
 
5
- Turn messy human test ideas into runnable Playwright tests — while staying 100% compatible with classic Playwright + POM.
5
+ Current pipeline:
6
6
 
7
- ## Installation
8
-
9
- ```bash
10
- # Run directly (no install needed)
11
- npx @cementic/cementic-test new my-app
12
-
13
- # Or install globally
14
- npm install -g @cementic/cementic-test
15
- ```
16
-
17
- ## Quick Start
18
-
19
- ```bash
20
- # 1. Scaffold a new project
21
- ct new "Demo"
22
-
23
- # 2. Generate test cases with AI
24
- cd Demo
25
- ct tc --ai --feature "Login" --count 3
26
-
27
- # 3. Generate & Run
28
- ct flow
7
+ ```text
8
+ ct tc -> ct normalize -> ct gen -> ct test
29
9
  ```
30
10
 
31
- ---
32
-
33
- # 🧪 CementicTest (CT)
34
-
35
- ### **AI-Assisted Playwright Automation — From Test Cases to POM Test Suites in Minutes**
36
-
37
- CementicTest (CT) is a CLI tool that turns **written or AI-generated test cases** into a complete, production-ready **Playwright + Page Object Model** automation framework.
38
-
39
- CT can:
11
+ It can scaffold a project, write or AI-generate case files, normalize them into JSON, generate Playwright specs plus page objects, and run the resulting suite.
40
12
 
41
- * Scaffold new Playwright projects
42
- * Scrape real URLs for UI context
43
- * Generate test cases using LLMs (Bring Your Own API Key)
44
- * Normalize test cases
45
- * Generate full Playwright tests using POM standards
46
- * Run everything instantly via `ct test`
47
- * Enhance existing Playwright projects
48
- * Allow optional migration from raw PW → CT-powered PW
13
+ ## What this version does
49
14
 
50
- CT removes boilerplate, enforces good practices, and massively accelerates setup and test authoring.
15
+ - Scaffolds new Playwright projects in JavaScript or TypeScript
16
+ - Generates Markdown test cases manually or with AI
17
+ - Supports URL-aware case generation with live page scraping
18
+ - Normalizes case files into structured JSON
19
+ - Generates Playwright specs and POM classes from normalized cases
20
+ - Avoids overwriting existing generated page-object files
21
+ - Runs Playwright tests through a CLI wrapper
22
+ - Opens Playwright HTML reports
23
+ - Serves Allure reports if Allure is installed in the target project
24
+ - Generates a GitHub Actions workflow for Playwright CI
51
25
 
52
- ---
53
-
54
- # ⭐️ Features Overview
55
-
56
- ## ✅ **1. Project Initialization (POM-ready workspace)**
57
-
58
- `ct new "<projectName>"` creates a complete, ready-to-run test project:
59
-
60
- ```
61
- pages/
62
- tests/
63
- utils/
64
- test-data/
65
- cases/
66
- .cementic/
67
- normalized/
68
- playwright.config.ts
69
- ```
70
-
71
- Includes:
72
-
73
- * Installed Playwright & browsers
74
- * Sample login page
75
- * Sample test
76
- * Opinionated project structure
77
- * POM-first architecture layout
78
-
79
- ---
80
-
81
- ## ✅ **2. AI-powered Test Case Writer**
82
-
83
- Using your own LLM API key (`CT_LLM_API_KEY`, `OPENAI_API_KEY`, etc.):
84
-
85
- * Scrapes page content
86
- * Extracts headings, buttons, inputs, metadata
87
- * Sends prompt + test spec to LLM
88
- * Generates structured Markdown test cases:
89
-
90
- ```
91
- # AUTH-001 — Valid Login @smoke @auth
92
- ## Steps
93
- 1. Navigate to /login
94
- ...
95
- ## Expected
96
- - Dashboard loads
97
- - User profile visible
98
- ```
99
-
100
- Supports:
101
-
102
- ### **Interactive writing**
103
-
104
- ```
105
- ct tc
106
- ```
26
+ ## Installation
107
27
 
108
- ### **AI-writing**
28
+ ```bash
29
+ # Run without a global install
30
+ npx @cementic/cementic-test --help
109
31
 
110
- ```
111
- ct tc --ai
32
+ # Or install globally
33
+ npm install -g @cementic/cementic-test
112
34
  ```
113
35
 
114
- ### **URL-aware AI-writing (scrape + understand UI)**
36
+ Requirements:
115
37
 
116
- ```
117
- ct tc url https://mini-bank.testamplify.com/login --ai
118
- ```
38
+ - Node.js 18+
39
+ - npm
119
40
 
120
- ---
41
+ ## Quick start
121
42
 
122
- ## **3. Test Case Normalization**
43
+ ### JavaScript project
123
44
 
124
- CT normalizes Markdown test cases into structured machine-readable JSON.
125
-
126
- ```
127
- ct normalize ./cases
45
+ ```bash
46
+ ct new demo-js --lang js
47
+ cd demo-js
48
+ ct tc --feature "Login form" --count 2
49
+ ct normalize ./cases --and-gen --lang js
50
+ ct test
128
51
  ```
129
52
 
130
- Output goes to:
53
+ ### TypeScript project
131
54
 
132
- ```
133
- .cementic/normalized/*.json
55
+ ```bash
56
+ ct new demo-ts --lang ts
57
+ cd demo-ts
58
+ ct tc url https://mini-bank.testamplify.com/login --feature "Login" --count 2
59
+ ct normalize ./cases --and-gen --lang ts
60
+ ct test
134
61
  ```
135
62
 
136
- Each JSON contains:
63
+ ## Command flow
137
64
 
138
- * ID
139
- * Title
140
- * Steps (array)
141
- * Expected results
142
- * Metadata / tags
65
+ ### 1. `ct new <projectName>`
143
66
 
144
- ---
67
+ Scaffolds a new CementicTest + Playwright project.
145
68
 
146
- ## ✅ **4. Automatic Playwright Test Generation**
147
-
148
- Once normalized, CT can generate full Playwright tests using the POM architecture:
149
-
150
- ```
151
- ct gen --lang ts
69
+ ```bash
70
+ ct new my-suite
71
+ ct new my-suite --lang ts
72
+ ct new my-suite --no-browsers
152
73
  ```
153
74
 
154
- Generated tests go into:
155
-
156
- ```
157
- tests/*.spec.ts
158
- ```
75
+ Current scaffold support:
159
76
 
160
- Generated tests **import your Page Objects**:
77
+ - `--lang js`: JavaScript template with:
78
+ - `pages/BasePage.js`
79
+ - `pages/LoginPage.js`
80
+ - `pages/DashboardPage.js`
81
+ - `pages/FormPage.js`
82
+ - `tests/login.spec.js`
83
+ - `tests/dashboard.spec.js`
84
+ - `--lang ts`: TypeScript template with:
85
+ - `pages/LandingPage.ts`
86
+ - `tests/landing.spec.ts`
87
+ - `tsconfig.json`
88
+ - `playwright.config.ts`
161
89
 
162
- ```ts
163
- import { LoginPage } from "../pages/login.page";
90
+ What `ct new` does:
164
91
 
165
- test('AUTH-001 Valid Login', async ({ page }) => {
166
- const login = new LoginPage(page);
167
- await login.goto();
168
- await login.login("user", "pass");
169
- });
170
- ```
92
+ - creates the project directory
93
+ - copies the selected template
94
+ - initializes git
95
+ - runs `npm install`
96
+ - optionally runs `npx playwright install`
171
97
 
172
- ---
98
+ ### 2. `ct tc`
173
99
 
174
- ## **5. Normalize + Generate in one shot**
100
+ Creates Markdown case files in `./cases`.
175
101
 
176
- Most developers will use:
102
+ Interactive mode:
177
103
 
104
+ ```bash
105
+ ct tc
178
106
  ```
179
- ct normalize ./cases --and-gen --lang ts
180
- ```
181
-
182
- This:
183
107
 
184
- 1. Normalizes test cases → JSON
185
- 2. Generates Playwright tests immediately
108
+ Non-interactive mode:
186
109
 
187
- ---
188
-
189
- ## ✅ **6. Execute Playwright tests**
190
-
191
- CT wraps Playwright for convenience:
192
-
193
- ```
194
- ct test
110
+ ```bash
111
+ ct tc --feature "Checkout" --desc "Guest checkout flow" --count 3
195
112
  ```
196
113
 
197
- Equivalent to:
114
+ AI mode:
198
115
 
116
+ ```bash
117
+ ct tc --ai --feature "Login" --count 3
199
118
  ```
200
- npx playwright test
201
- ```
202
-
203
- ---
204
-
205
- ## ✅ **7. Bring Your Own LLM (BYO LLM API key)**
206
119
 
207
- CT is **LLM-agnostic**, meaning it does NOT force you to use OpenAI.
120
+ ### 3. `ct tc url <url>`
208
121
 
209
- You can set:
122
+ Generates cases with awareness of a live page.
210
123
 
124
+ ```bash
125
+ ct tc url https://mini-bank.testamplify.com/login --feature "Login" --count 2
126
+ ct tc url https://mini-bank.testamplify.com/login --ai --feature "Login" --count 2
211
127
  ```
212
- CT_LLM_API_KEY
213
- OPENAI_API_KEY
214
- CT_LLM_MODEL
215
- CT_LLM_BASE_URL
216
- ```
217
-
218
- Works with:
219
-
220
- * OpenAI
221
- * Anthropic (Claude-compatible proxies)
222
- * Gemini (OpenAI-compatible API wrappers)
223
- * DeepSeek
224
- * Any **OpenAI-compatible LLM server**
225
-
226
- If AI fails or no key exists?
227
- ✨ CT gracefully falls back to manual templates.
228
-
229
- ---
230
-
231
- ## ✅ **8. URL Scraper (Headless page scanner)**
232
-
233
- Given a URL, CT extracts:
234
-
235
- * Page title
236
- * Headings
237
- * Buttons
238
- * Inputs
239
- * Basic layout info
240
-
241
- This helps the LLM generate highly accurate test cases.
242
-
243
- ---
244
128
 
245
- ## ⭐️ CLI Commands Reference
129
+ Current behavior:
246
130
 
247
- Below is every command CT currently supports.
131
+ - scrapes the page for headings, buttons, links, inputs, and metadata
132
+ - passes that context to the AI flow when `--ai` is enabled
133
+ - writes `<!-- ct:url ... -->` metadata into generated Markdown so normalization and generation preserve the target URL
248
134
 
249
- ---
135
+ ### 4. `ct normalize <path>`
250
136
 
251
- # 📦 **CLI Commands**
252
-
253
- ---
254
-
255
- ## `ct new "<projectName>"`
256
-
257
- Scaffold a new CementicTest + Playwright project from scratch.
258
-
259
- **Examples:**
137
+ Converts case files into normalized JSON in `.cementic/normalized/`.
260
138
 
261
139
  ```bash
262
- ct new "Bank"
263
- ct new "Bank" --no-browsers # Skip browser download
140
+ ct normalize ./cases
141
+ ct normalize "cases/**/*.md"
142
+ ct normalize ./cases --and-gen --lang ts
264
143
  ```
265
144
 
266
- What it does:
145
+ Current normalized output includes:
267
146
 
268
- * Installs Playwright
269
- * Runs browser install
270
- * Creates POM structure
271
- * Adds sample pages & test
272
- * Ready in under 30 seconds
147
+ - `id`
148
+ - `title`
149
+ - `tags`
150
+ - `steps`
151
+ - `expected`
152
+ - `needs_review`
153
+ - `review_reasons`
154
+ - `source`
155
+ - `url`
273
156
 
274
- ---
157
+ Important current behavior:
275
158
 
276
- ## `ct tc`
159
+ - title is stored without duplicating the case ID prefix
160
+ - URL metadata is read from `<!-- ct:url ... -->` first
161
+ - if no metadata exists, normalization falls back to URL extraction from steps
277
162
 
278
- Interactive test case writer.
163
+ ### 5. `ct gen`
279
164
 
280
- ```bash
281
- # Interactive mode
282
- ct tc
165
+ Generates Playwright specs and page-object files from normalized JSON.
283
166
 
284
- # Non-interactive mode (CI/Scripting)
285
- ct tc --feature "Login" --desc "Login page" --count 5
167
+ ```bash
168
+ ct gen --lang ts
169
+ ct gen --lang js
170
+ ct gen --lang ts --out tests/e2e
286
171
  ```
287
172
 
288
- Prompts (Interactive):
173
+ Current output locations:
289
174
 
290
- * Feature/page name
291
- * Optional app description
292
- * Number of test cases
175
+ - specs: `tests/generated/` by default
176
+ - page objects: `pages/`
293
177
 
294
- Generates Markdown inside `/cases`.
178
+ Current generator behavior:
295
179
 
296
- ---
180
+ - maps common natural-language steps to Playwright actions
181
+ - maps common expected-result phrases to Playwright assertions
182
+ - derives one POM class per feature prefix where possible
183
+ - uses `norm.url` for page-object `goto()`
184
+ - avoids duplicate navigation when setup already handles the target URL
185
+ - does not overwrite existing POM files
186
+ - emits correct relative imports for generated specs
297
187
 
298
- ## `ct tc --ai`
188
+ ### 6. `ct test`
299
189
 
300
- Same as above, but uses AI (requires API key):
190
+ Runs Playwright tests.
301
191
 
302
192
  ```bash
303
- ct tc --ai
193
+ ct test
194
+ ct test --headed
195
+ ct test --project chromium
304
196
  ```
305
197
 
306
- ---
307
-
308
- ## `ct tc url <url> --ai`
309
-
310
- Scrape + AI test case writer.
198
+ This is a thin wrapper over:
311
199
 
312
200
  ```bash
313
- ct tc url https://mini-bank.testamplify.com/login --ai
201
+ npx playwright test
314
202
  ```
315
203
 
316
- This is the most powerful mode.
204
+ Arguments after `ct test` are passed through to Playwright.
317
205
 
318
- ---
206
+ ### 7. `ct flow`
319
207
 
320
- ## `ct normalize <path>`
208
+ Runs the end-to-end workflow:
321
209
 
322
- Convert human-readable test cases into machine-readable JSON format.
210
+ 1. normalize
211
+ 2. generate
212
+ 3. test
323
213
 
324
214
  ```bash
325
- ct normalize ./cases
326
- ```
327
-
328
- Outputs:
329
-
330
- ```
331
- .cementic/normalized/*.json
215
+ ct flow
216
+ ct flow ./cases
217
+ ct flow --lang js
218
+ ct flow --no-run
332
219
  ```
333
220
 
334
- ---
221
+ ### 8. `ct report`
335
222
 
336
- ## `ct normalize <path> --and-gen --lang ts`
337
-
338
- Normalize AND generate tests in one step.
223
+ Opens the Playwright HTML report.
339
224
 
340
225
  ```bash
341
- ct normalize ./cases --and-gen --lang ts
226
+ ct report
342
227
  ```
343
228
 
344
- ---
345
-
346
- ## `ct gen --lang ts`
347
-
348
- Generate Playwright test files from normalized JSON cases.
229
+ Equivalent behavior:
349
230
 
350
231
  ```bash
351
- ct gen --lang ts
352
- ct gen --lang ts --out tests/e2e # Custom output directory
232
+ npx playwright show-report
353
233
  ```
354
234
 
355
- ---
356
-
357
- ## `ct test`
235
+ ### 9. `ct serve`
358
236
 
359
- Runs Playwright test runner.
237
+ Serves the Allure report if `allure-commandline` is available in the current project.
360
238
 
361
239
  ```bash
362
- ct test
240
+ ct serve
363
241
  ```
364
242
 
365
- ---
243
+ Current behavior:
244
+
245
+ - prefers the local `node_modules/allure-commandline/bin/allure` binary
246
+ - falls back to `npx allure serve ./allure-results`
366
247
 
367
- ## `ct flow`
248
+ ### 10. `ct ci`
368
249
 
369
- **One-Shot Command**: Normalizes cases, generates tests, and runs them in sequence.
250
+ Generates a GitHub Actions workflow at `.github/workflows/cementic.yml`.
370
251
 
371
252
  ```bash
372
- ct flow
373
- ct flow --lang js
374
- ct flow --no-run # Normalize & Generate only (skip execution)
253
+ ct ci
375
254
  ```
376
255
 
377
- ---
256
+ Current workflow behavior:
378
257
 
379
- ## `ct report`
258
+ - skips generation if the workflow file already exists
259
+ - installs dependencies
260
+ - installs Playwright browsers
261
+ - runs `npx playwright test`
262
+ - uploads the Playwright HTML report as an artifact
380
263
 
381
- Opens the Playwright HTML report in your default browser.
264
+ ## AI provider support
382
265
 
383
- ```bash
384
- ct report
385
- ```
266
+ Current AI flow lives in `src/core/llm.ts`.
386
267
 
387
- ---
268
+ Provider behavior in this version:
388
269
 
389
- ## `ct serve`
270
+ - Anthropic is first-class and preferred when `ANTHROPIC_API_KEY` is set
271
+ - OpenAI-compatible mode is used when Anthropic is not configured
272
+ - manual template generation is used if AI generation fails
390
273
 
391
- Starts the Allure report server (if Allure is configured).
274
+ Supported environment variables:
392
275
 
393
- ```bash
394
- ct serve
395
- ```
276
+ | Variable | Purpose |
277
+ | --- | --- |
278
+ | `ANTHROPIC_API_KEY` | Primary Anthropic key |
279
+ | `CT_ANTHROPIC_API_KEY` | Alternate Anthropic key |
280
+ | `OPENAI_API_KEY` | OpenAI key |
281
+ | `CT_LLM_API_KEY` | Generic OpenAI-compatible API key |
282
+ | `CT_LLM_PROVIDER` | Optional provider override (`anthropic` or `openai`) |
283
+ | `CT_LLM_MODEL` | Model override |
284
+ | `CT_LLM_BASE_URL` | OpenAI-compatible base URL override |
396
285
 
397
- ---
286
+ Current defaults:
398
287
 
399
- ## `ct ci`
288
+ - Anthropic model default: `claude-sonnet-4-5`
289
+ - OpenAI-compatible model default: `gpt-4o-mini`
400
290
 
401
- Generates a GitHub Actions workflow file (`.github/workflows/cementic.yml`) for CI/CD.
291
+ ## URL scraping
402
292
 
403
- ```bash
404
- ct ci
405
- ```
293
+ Current scraping behavior lives in `src/core/scrape.ts`.
406
294
 
407
- ---
295
+ Primary path:
408
296
 
409
- # ⚙️ Environment Variables
297
+ - uses a real Playwright browser
298
+ - extracts:
299
+ - page title
300
+ - headings
301
+ - buttons
302
+ - links
303
+ - inputs with label, placeholder, name, type, and `data-testid`
304
+ - landmark roles
410
305
 
411
- | Variable | Description |
412
- | ----------------- | --------------------------------------- |
413
- | `CT_LLM_API_KEY` | Primary AI key |
414
- | `OPENAI_API_KEY` | Secondary AI key |
415
- | `CT_LLM_MODEL` | Override default model (`gpt-4.1-mini`) |
416
- | `CT_LLM_BASE_URL` | Custom LLM endpoint |
417
- | `CT_DEBUG` | Enables verbose logging |
306
+ Fallback path:
418
307
 
419
- ---
308
+ - falls back to `fetch` + regex parsing when Playwright is unavailable
420
309
 
421
- # 📁 Project Structure
310
+ ## Generated project structure
422
311
 
423
- After running `ct new “MyProject”`:
312
+ After a typical run:
424
313
 
425
- ```
314
+ ```text
426
315
  project/
316
+ cases/
427
317
  pages/
428
- login.page.ts
429
- ...
430
318
  tests/
431
- sample.spec.ts
432
- test-data/
433
- utils/
434
- cases/
319
+ generated/
435
320
  .cementic/
436
321
  normalized/
437
- playwright.config.ts
322
+ playwright.config.js|ts
438
323
  ```
439
324
 
440
- ---
325
+ Typical file flow:
441
326
 
442
- # 🧩 Architecture Overview
443
-
444
- ### **Input**
327
+ ```text
328
+ cases/*.md
329
+ -> .cementic/normalized/*.json
330
+ -> tests/generated/*.spec.ts|js
331
+ -> pages/*.ts|js
332
+ ```
445
333
 
446
- * Human test cases (Markdown)
447
- * AI-generated test cases
448
- * Scraped UI context
334
+ ## Example case file
449
335
 
450
- ### **Processing**
336
+ ```md
337
+ # AUTH-001 — User can log in @smoke @auth
338
+ <!-- ct:url https://mini-bank.testamplify.com/login -->
339
+ ## Steps
340
+ 1. Navigate to https://mini-bank.testamplify.com/login
341
+ 2. Fill in email with [EMAIL_ADDRESS]'
342
+ 3. Fill in password with 'secret'
343
+ 4. Click the 'Sign In' button
451
344
 
452
- 1. Normalize (Markdown → JSON)
453
- 2. Generate POM-based Playwright tests
454
- 3. Maintain test ID prefixes (AUTH-###, DASH-###, etc.)
345
+ ## Expected Results
346
+ - Page redirects to /dashboard
347
+ - Welcome message is visible
348
+ ```
455
349
 
456
- ### **Output**
350
+ ## Current implementation notes
457
351
 
458
- * Full Playwright automation suite ready to run
352
+ This version is intentionally heuristic and file-oriented.
459
353
 
460
- ---
354
+ Important current characteristics:
461
355
 
462
- # 🚀 Developer Setup (For Internal Development)
356
+ - generated specs are POM-oriented, not raw recorded scripts
357
+ - generator rules cover common cases well but are not a replacement for live self-healing
358
+ - Playwright itself is used for scraping and test execution
359
+ - Playwright CLI and Playwright agents are not yet first-class runtime backends in this version
463
360
 
464
- ### Clone & install dependencies
361
+ ## Developer setup
465
362
 
466
363
  ```bash
467
364
  git clone <repo>
468
- cd cementic-test
365
+ cd cementic-test-cli
469
366
  npm install
470
367
  ```
471
368
 
472
- ### Build the CLI
369
+ Build the CLI:
473
370
 
474
371
  ```bash
475
372
  npm run build
476
373
  ```
477
374
 
478
- ### Link locally
375
+ Run the repo test suite:
479
376
 
480
377
  ```bash
481
- npm link
378
+ npm test
482
379
  ```
483
380
 
484
- Test globally:
381
+ What `npm test` currently verifies:
382
+
383
+ - build succeeds
384
+ - `ct tc url` writes URL metadata
385
+ - `ct normalize` and `ct gen` preserve the recent generator fixes
386
+ - the JavaScript scaffold contains the expected page objects and sample specs
387
+
388
+ ## Local development loop
485
389
 
486
390
  ```bash
391
+ npm run build
392
+ npm link
393
+
487
394
  ct --help
488
395
  ```
489
396
 
490
- ---
491
-
492
- # 🧪 Developer Testing Loop
493
-
494
- 1. Modify code
495
- 2. Run:
397
+ Manual smoke flow:
496
398
 
497
- ```
498
- npm run build && npm link
499
- ```
399
+ ```bash
400
+ mkdir demo
401
+ cd demo
500
402
 
501
- 3. In a sample project:
403
+ ct new sample --lang ts --no-browsers
404
+ cd sample
502
405
 
503
- ```
504
- mkdir demo && cd demo
505
- ct new "Shop"
506
- ct tc url https://example.com/login --ai
406
+ ct tc url https://mini-bank.testamplify.com/login --feature "Login" --count 1
507
407
  ct normalize ./cases --and-gen --lang ts
508
408
  ct test
509
409
  ```
510
410
 
511
- ---
512
-
513
- # 🏗 Implementation Notes (For Your Developer)
514
-
515
- ### Key directories:
516
-
517
- ```
518
- src/
519
- cli.ts
520
- commands/
521
- new.ts
522
- tc.ts
523
- normalize.ts
524
- gen.ts
525
- test.ts
526
- core/
527
- prefix.ts
528
- normalize.ts
529
- llm.ts
530
- scrape.ts
531
- generator.ts
532
- templates/
533
- ```
534
-
535
- ### Important details:
536
-
537
- * **`tc.ts`** manually checks `process.argv` for `--ai`
538
- (because Commander is inconsistent with subcommands)
539
- * URL mode scrapes with `scrapePageSummary()`
540
- * LLM integration is fully isolated inside `core/llm.ts`
541
- * Test generation happens in `core/generator.ts`
542
- * Normalization lives in `core/normalize.ts`
543
- * Pages generator/templates live inside `templates/pages`
544
-
545
- ### Code standards:
546
-
547
- * TypeScript everywhere
548
- * ESM modules
549
- * No external runtime dependencies except Playwright
550
- * Everything async
551
- * Clear separation between:
552
-
553
- * Commands (CLI)
554
- * Logic (core)
555
- * Templates (scaffolding)
556
- * Outputs (.cementic, tests, pages, cases)
557
-
558
- ---
559
-
560
- # 📦 Release Process
561
-
562
- We use GitHub Actions for automated releases.
563
-
564
- ### 1. Bump Version
565
- Update `package.json` version:
566
- ```bash
567
- npm version patch # or minor/major
568
- ```
569
-
570
- ### 2. Push to Main
571
- ```bash
572
- git push origin main
573
- ```
574
- *CI will run tests and build.*
411
+ ## Key source files
575
412
 
576
- ### 3. Create Release Tag
577
- ```bash
578
- git push --tags
413
+ ```text
414
+ src/cli.ts
415
+ src/commands/new.ts
416
+ src/commands/tc.ts
417
+ src/commands/normalize.ts
418
+ src/commands/gen.ts
419
+ src/commands/test.ts
420
+ src/commands/flow.ts
421
+ src/core/llm.ts
422
+ src/core/scrape.ts
423
+ src/core/prefix.ts
424
+ templates/student-framework/
425
+ templates/student-framework-ts/
579
426
  ```
580
- *CI will detect the `v*` tag and automatically publish to NPM.*
581
-
582
- ---
583
-
584
- # 📅 Roadmap
585
-
586
- ### Phase 1 (Current)
587
-
588
- ✔️ CLI scaffolding
589
- ✔️ AI test case generator
590
- ✔️ URL scraping
591
- ✔️ Normalization pipeline
592
- ✔️ POM test generator
593
- ✔️ Playwright runner wrapper
594
-
595
- ---
596
-
597
- ### Phase 2 (Next)
598
-
599
- 🔜 Self-healing locators
600
- 🔜 Page synchronizer (`ct update pages`)
601
- 🔜 API automation support (`ct api`)
602
- 🔜 Test coverage reports
603
-
604
- ---
605
-
606
- ### Phase 3 (Future)
607
-
608
- 🔜 CT Desktop App (UI version of CLI)
609
- 🔜 VS Code extension
610
- 🔜 CI/CD pipeline builder
611
- 🔜 Visual assertion generator
612
- 🔜 CT Agent (continuous learning on test failures)
613
427
 
614
- ---
428
+ ## Current limitations
615
429
 
616
- # 🤝 Contributing
430
+ - generator assertions and step mapping are heuristic
431
+ - there is no built-in self-healing test loop yet
432
+ - there is no first-class Playwright CLI integration yet
433
+ - POM generation intentionally avoids overwriting existing page objects, so existing pages may diverge from later normalized cases
617
434
 
618
- 1. Fork the repo
619
- 2. Create a feature branch
620
- 3. Follow code conventions
621
- 4. Build & test locally (`npm link`)
622
- 5. Submit PR# cementic-test
623
- 6. What's Next?
435
+ ## Contributing
624
436
 
625
- We created an org on NPMjs
437
+ 1. Create a branch
438
+ 2. Run `npm test`
439
+ 3. Verify a manual `tc -> normalize -> gen -> test` flow if your change affects generation
440
+ 4. Open a PR with the behavior change clearly described