@cementic/cementic-test 0.2.3 → 0.2.5

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 +300 -457
  2. package/dist/chunk-5QRDTCSM.js +368 -0
  3. package/dist/chunk-5QRDTCSM.js.map +1 -0
  4. package/dist/cli.js +1242 -210
  5. package/dist/cli.js.map +1 -1
  6. package/dist/{gen-54KYT3RO.js → gen-RMRQOAD3.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 +3 -2
  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-RMRQOAD3.js.map} +0 -0
package/README.md CHANGED
@@ -1,625 +1,468 @@
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
29
- ```
30
-
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:
40
-
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
49
-
50
- CT removes boilerplate, enforces good practices, and massively accelerates setup and test authoring.
51
-
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
7
+ ```text
8
+ ct tc -> ct normalize -> ct gen -> ct test
69
9
  ```
70
10
 
71
- Includes:
72
-
73
- * Installed Playwright & browsers
74
- * Sample login page
75
- * Sample test
76
- * Opinionated project structure
77
- * POM-first architecture layout
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.
78
12
 
79
- ---
13
+ ## What this version does
80
14
 
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
- ```
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 capture
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
99
25
 
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
 
32
+ # Or install globally
33
+ npm install -g @cementic/cementic-test
110
34
  ```
111
- ct tc --ai
112
- ```
113
-
114
- ### **URL-aware AI-writing (scrape + understand UI)**
115
35
 
116
- ```
117
- ct tc url https://mini-bank.testamplify.com/login --ai
118
- ```
36
+ Requirements:
119
37
 
120
- ---
38
+ - Node.js 18+
39
+ - npm
121
40
 
122
- ## **3. Test Case Normalization**
41
+ ## Quick start
123
42
 
124
- CT normalizes Markdown test cases into structured machine-readable JSON.
43
+ ### JavaScript project
125
44
 
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
 
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
132
61
  ```
133
- .cementic/normalized/*.json
134
- ```
135
-
136
- Each JSON contains:
137
-
138
- * ID
139
- * Title
140
- * Steps (array)
141
- * Expected results
142
- * Metadata / tags
143
62
 
144
- ---
63
+ ## Command flow
145
64
 
146
- ## ✅ **4. Automatic Playwright Test Generation**
65
+ ### 1. `ct new <projectName>`
147
66
 
148
- Once normalized, CT can generate full Playwright tests using the POM architecture:
67
+ Scaffolds a new CementicTest + Playwright project.
149
68
 
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:
75
+ Current scaffold support:
155
76
 
156
- ```
157
- tests/*.spec.ts
158
- ```
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`
159
89
 
160
- Generated tests **import your Page Objects**:
90
+ What `ct new` does:
161
91
 
162
- ```ts
163
- import { LoginPage } from "../pages/login.page";
92
+ - creates the project directory
93
+ - copies the selected template
94
+ - initializes git
95
+ - runs `npm install`
96
+ - optionally runs `npx playwright install`
164
97
 
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
- ```
98
+ ### 2. `ct tc`
171
99
 
172
- ---
100
+ Creates Markdown case files in `./cases`.
173
101
 
174
- ## ✅ **5. Normalize + Generate in one shot**
102
+ Interactive mode:
175
103
 
176
- Most developers will use:
177
-
178
- ```
179
- ct normalize ./cases --and-gen --lang ts
104
+ ```bash
105
+ ct tc
180
106
  ```
181
107
 
182
- This:
108
+ Non-interactive mode:
183
109
 
184
- 1. Normalizes test cases → JSON
185
- 2. Generates Playwright tests immediately
186
-
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
119
 
205
- ## ✅ **7. Bring Your Own LLM (BYO LLM API key)**
120
+ ### 3. `ct tc url <url>`
206
121
 
207
- CT is **LLM-agnostic**, meaning it does NOT force you to use OpenAI.
122
+ Generates cases with awareness of a live page.
208
123
 
209
- You can set:
210
-
211
- ```
212
- CT_LLM_API_KEY
213
- OPENAI_API_KEY
214
- CT_LLM_MODEL
215
- CT_LLM_BASE_URL
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
127
+ ct tc url https://mini-bank.testamplify.com/login --ai --headed --feature "Login"
128
+ ct tc url https://mini-bank.testamplify.com/login --ai --capture-only --feature "Login"
216
129
  ```
217
130
 
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
- ---
131
+ Current behavior:
244
132
 
245
- ## ⭐️ CLI Commands Reference
133
+ - captures a live page with Playwright and extracts headings, buttons, links, inputs, status regions, and selector candidates
134
+ - sends that captured element map to the capture-aware AI flow when `--ai` is enabled
135
+ - saves the full capture artifact to `.cementic/capture/capture-*.json`
136
+ - saves a runnable preview spec to `tests/preview/spec-preview-*.spec.cjs` when AI scenarios are generated
137
+ - writes `<!-- ct:url ... -->` metadata plus selector and `playwright` hints into generated Markdown so normalization and generation preserve the capture output
246
138
 
247
- Below is every command CT currently supports.
139
+ ### 4. `ct normalize <path>`
248
140
 
249
- ---
250
-
251
- # 📦 **CLI Commands**
252
-
253
- ---
254
-
255
- ## `ct new "<projectName>"`
256
-
257
- Scaffold a new CementicTest + Playwright project from scratch.
258
-
259
- **Examples:**
141
+ Converts case files into normalized JSON in `.cementic/normalized/`.
260
142
 
261
143
  ```bash
262
- ct new "Bank"
263
- ct new "Bank" --no-browsers # Skip browser download
144
+ ct normalize ./cases
145
+ ct normalize "cases/**/*.md"
146
+ ct normalize ./cases --and-gen --lang ts
264
147
  ```
265
148
 
266
- What it does:
149
+ Current normalized output includes:
267
150
 
268
- * Installs Playwright
269
- * Runs browser install
270
- * Creates POM structure
271
- * Adds sample pages & test
272
- * Ready in under 30 seconds
151
+ - `id`
152
+ - `title`
153
+ - `tags`
154
+ - `steps`
155
+ - `expected`
156
+ - `needs_review`
157
+ - `review_reasons`
158
+ - `source`
159
+ - `url`
273
160
 
274
- ---
161
+ Important current behavior:
275
162
 
276
- ## `ct tc`
163
+ - title is stored without duplicating the case ID prefix
164
+ - URL metadata is read from `<!-- ct:url ... -->` first
165
+ - if no metadata exists, normalization falls back to URL extraction from steps
277
166
 
278
- Interactive test case writer.
167
+ ### 5. `ct gen`
279
168
 
280
- ```bash
281
- # Interactive mode
282
- ct tc
169
+ Generates Playwright specs and page-object files from normalized JSON.
283
170
 
284
- # Non-interactive mode (CI/Scripting)
285
- ct tc --feature "Login" --desc "Login page" --count 5
171
+ ```bash
172
+ ct gen --lang ts
173
+ ct gen --lang js
174
+ ct gen --lang ts --out tests/e2e
286
175
  ```
287
176
 
288
- Prompts (Interactive):
177
+ Current output locations:
289
178
 
290
- * Feature/page name
291
- * Optional app description
292
- * Number of test cases
179
+ - specs: `tests/generated/` by default
180
+ - page objects: `pages/`
293
181
 
294
- Generates Markdown inside `/cases`.
182
+ Current generator behavior:
295
183
 
296
- ---
184
+ - maps common natural-language steps to Playwright actions
185
+ - maps common expected-result phrases to Playwright assertions
186
+ - derives one POM class per feature prefix where possible
187
+ - uses `norm.url` for page-object `goto()`
188
+ - avoids duplicate navigation when setup already handles the target URL
189
+ - does not overwrite existing POM files
190
+ - emits correct relative imports for generated specs
297
191
 
298
- ## `ct tc --ai`
192
+ ### 6. `ct test`
299
193
 
300
- Same as above, but uses AI (requires API key):
194
+ Runs Playwright tests.
301
195
 
302
196
  ```bash
303
- ct tc --ai
197
+ ct test
198
+ ct test --headed
199
+ ct test --project chromium
304
200
  ```
305
201
 
306
- ---
307
-
308
- ## `ct tc url <url> --ai`
309
-
310
- Scrape + AI test case writer.
202
+ This is a thin wrapper over:
311
203
 
312
204
  ```bash
313
- ct tc url https://mini-bank.testamplify.com/login --ai
205
+ npx playwright test
314
206
  ```
315
207
 
316
- This is the most powerful mode.
208
+ Arguments after `ct test` are passed through to Playwright.
317
209
 
318
- ---
210
+ ### 7. `ct flow`
319
211
 
320
- ## `ct normalize <path>`
212
+ Runs the end-to-end workflow:
321
213
 
322
- Convert human-readable test cases into machine-readable JSON format.
214
+ 1. normalize
215
+ 2. generate
216
+ 3. test
323
217
 
324
218
  ```bash
325
- ct normalize ./cases
326
- ```
327
-
328
- Outputs:
329
-
330
- ```
331
- .cementic/normalized/*.json
219
+ ct flow
220
+ ct flow ./cases
221
+ ct flow --lang js
222
+ ct flow --no-run
332
223
  ```
333
224
 
334
- ---
335
-
336
- ## `ct normalize <path> --and-gen --lang ts`
225
+ ### 8. `ct report`
337
226
 
338
- Normalize AND generate tests in one step.
227
+ Opens the Playwright HTML report.
339
228
 
340
229
  ```bash
341
- ct normalize ./cases --and-gen --lang ts
230
+ ct report
342
231
  ```
343
232
 
344
- ---
345
-
346
- ## `ct gen --lang ts`
347
-
348
- Generate Playwright test files from normalized JSON cases.
233
+ Equivalent behavior:
349
234
 
350
235
  ```bash
351
- ct gen --lang ts
352
- ct gen --lang ts --out tests/e2e # Custom output directory
236
+ npx playwright show-report
353
237
  ```
354
238
 
355
- ---
356
-
357
- ## `ct test`
239
+ ### 9. `ct serve`
358
240
 
359
- Runs Playwright test runner.
241
+ Serves the Allure report if `allure-commandline` is available in the current project.
360
242
 
361
243
  ```bash
362
- ct test
244
+ ct serve
363
245
  ```
364
246
 
365
- ---
247
+ Current behavior:
248
+
249
+ - prefers the local `node_modules/allure-commandline/bin/allure` binary
250
+ - falls back to `npx allure serve ./allure-results`
366
251
 
367
- ## `ct flow`
252
+ ### 10. `ct ci`
368
253
 
369
- **One-Shot Command**: Normalizes cases, generates tests, and runs them in sequence.
254
+ Generates a GitHub Actions workflow at `.github/workflows/cementic.yml`.
370
255
 
371
256
  ```bash
372
- ct flow
373
- ct flow --lang js
374
- ct flow --no-run # Normalize & Generate only (skip execution)
257
+ ct ci
375
258
  ```
376
259
 
377
- ---
260
+ Current workflow behavior:
378
261
 
379
- ## `ct report`
262
+ - skips generation if the workflow file already exists
263
+ - installs dependencies
264
+ - installs Playwright browsers
265
+ - runs `npx playwright test`
266
+ - uploads the Playwright HTML report as an artifact
380
267
 
381
- Opens the Playwright HTML report in your default browser.
268
+ ## AI provider support
382
269
 
383
- ```bash
384
- ct report
385
- ```
270
+ Current AI flows live in `src/core/llm.ts` and `src/core/analyse.ts`.
386
271
 
387
- ---
272
+ Provider behavior in this version:
388
273
 
389
- ## `ct serve`
274
+ - `ct tc --ai` uses the standard Markdown case writer in `src/core/llm.ts`
275
+ - `ct tc url --ai` uses the capture-aware analysis flow in `src/core/analyse.ts`
276
+ - manual template generation is used if AI generation fails
390
277
 
391
- Starts the Allure report server (if Allure is configured).
278
+ Supported environment variables:
392
279
 
393
- ```bash
394
- ct serve
395
- ```
280
+ | Variable | Purpose |
281
+ | --- | --- |
282
+ | `DEEPSEEK_API_KEY` | DeepSeek key for capture-aware analysis |
283
+ | `ANTHROPIC_API_KEY` | Primary Anthropic key |
284
+ | `CT_ANTHROPIC_API_KEY` | Alternate Anthropic key |
285
+ | `GEMINI_API_KEY` | Gemini key for capture-aware analysis |
286
+ | `OPENAI_API_KEY` | OpenAI key |
287
+ | `QWEN_API_KEY` | Qwen key for capture-aware analysis |
288
+ | `KIMI_API_KEY` | Kimi / Moonshot key for capture-aware analysis |
289
+ | `CT_LLM_API_KEY` | Generic OpenAI-compatible API key |
290
+ | `CT_LLM_PROVIDER` | Optional provider override (`deepseek`, `anthropic`, `gemini`, `qwen`, `kimi`, or `openai`) |
291
+ | `CT_LLM_MODEL` | Model override |
292
+ | `CT_LLM_BASE_URL` | OpenAI-compatible base URL override |
396
293
 
397
- ---
294
+ Current defaults:
398
295
 
399
- ## `ct ci`
400
-
401
- Generates a GitHub Actions workflow file (`.github/workflows/cementic.yml`) for CI/CD.
402
-
403
- ```bash
404
- ct ci
405
- ```
296
+ - DeepSeek default: `deepseek-chat`
297
+ - Anthropic default: `claude-sonnet-4-5`
298
+ - Gemini default: `gemini-2.5-flash`
299
+ - Qwen default: `qwen-plus`
300
+ - Kimi default: `moonshot-v1-8k`
301
+ - OpenAI-compatible default: `gpt-4o-mini`
406
302
 
407
- ---
303
+ ## URL capture
408
304
 
409
- # ⚙️ Environment Variables
305
+ Current capture behavior lives in `src/core/capture.ts`.
410
306
 
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 |
307
+ Primary path:
418
308
 
419
- ---
309
+ - uses a real Playwright browser
310
+ - extracts:
311
+ - page title
312
+ - headings
313
+ - buttons
314
+ - links
315
+ - inputs with label, placeholder, name, type, and `data-testid`
316
+ - status and alert regions
317
+ - selector confidence and alternative selectors
318
+ - builds a structured `ElementMap`
319
+ - passes that capture into `src/core/analyse.ts` for evidence-backed scenario generation
320
+ - formats markdown, JSON, and preview-spec outputs through `src/core/report.ts`
420
321
 
421
- # 📁 Project Structure
322
+ ## Generated project structure
422
323
 
423
- After running `ct new “MyProject”`:
324
+ After a typical run:
424
325
 
425
- ```
326
+ ```text
426
327
  project/
328
+ cases/
427
329
  pages/
428
- login.page.ts
429
- ...
430
330
  tests/
431
- sample.spec.ts
432
- test-data/
433
- utils/
434
- cases/
331
+ generated/
435
332
  .cementic/
436
333
  normalized/
437
- playwright.config.ts
334
+ playwright.config.js|ts
438
335
  ```
439
336
 
440
- ---
337
+ Typical file flow:
441
338
 
442
- # 🧩 Architecture Overview
443
-
444
- ### **Input**
339
+ ```text
340
+ cases/*.md
341
+ -> .cementic/normalized/*.json
342
+ -> tests/generated/*.spec.ts|js
343
+ -> pages/*.ts|js
344
+ ```
445
345
 
446
- * Human test cases (Markdown)
447
- * AI-generated test cases
448
- * Scraped UI context
346
+ ## Example case file
449
347
 
450
- ### **Processing**
348
+ ```md
349
+ # AUTH-001 — User can log in @smoke @auth
350
+ <!-- ct:url https://mini-bank.testamplify.com/login -->
351
+ ## Steps
352
+ 1. Navigate to https://mini-bank.testamplify.com/login
353
+ 2. Fill in email with [EMAIL_ADDRESS]'
354
+ 3. Fill in password with 'secret'
355
+ 4. Click the 'Sign In' button
451
356
 
452
- 1. Normalize (Markdown → JSON)
453
- 2. Generate POM-based Playwright tests
454
- 3. Maintain test ID prefixes (AUTH-###, DASH-###, etc.)
357
+ ## Expected Results
358
+ - Page redirects to /dashboard
359
+ - Welcome message is visible
360
+ ```
455
361
 
456
- ### **Output**
362
+ ## Current implementation notes
457
363
 
458
- * Full Playwright automation suite ready to run
364
+ This version is intentionally heuristic and file-oriented.
459
365
 
460
- ---
366
+ Important current characteristics:
461
367
 
462
- # 🚀 Developer Setup (For Internal Development)
368
+ - generated specs are POM-oriented, not raw recorded scripts
369
+ - capture-generated selector and assertion hints are preserved through `normalize` and `gen`
370
+ - generator rules still cover non-capture cases heuristically, but capture-backed cases now keep exact selectors and assertions
371
+ - Playwright itself is used for capture and test execution
372
+ - Playwright CLI and Playwright agents are not yet first-class runtime backends in this version
463
373
 
464
- ### Clone & install dependencies
374
+ ## Developer setup
465
375
 
466
376
  ```bash
467
377
  git clone <repo>
468
- cd cementic-test
378
+ cd cementic-test-cli
469
379
  npm install
470
380
  ```
471
381
 
472
- ### Build the CLI
382
+ Build the CLI:
473
383
 
474
384
  ```bash
475
385
  npm run build
476
386
  ```
477
387
 
478
- ### Link locally
388
+ Run the repo test suite:
479
389
 
480
390
  ```bash
481
- npm link
391
+ npm test
482
392
  ```
483
393
 
484
- Test globally:
394
+ What `npm test` currently verifies:
395
+
396
+ - build succeeds
397
+ - `ct tc url` writes URL metadata
398
+ - capture-generated selector and `playwright` hints survive `normalize` and `gen`
399
+ - `ct normalize` and `ct gen` preserve the recent generator fixes
400
+ - the JavaScript scaffold contains the expected page objects and sample specs
401
+
402
+ ## Local development loop
485
403
 
486
404
  ```bash
405
+ npm run build
406
+ npm link
407
+
487
408
  ct --help
488
409
  ```
489
410
 
490
- ---
491
-
492
- # 🧪 Developer Testing Loop
493
-
494
- 1. Modify code
495
- 2. Run:
411
+ Manual smoke flow:
496
412
 
497
- ```
498
- npm run build && npm link
499
- ```
413
+ ```bash
414
+ mkdir demo
415
+ cd demo
500
416
 
501
- 3. In a sample project:
417
+ ct new sample --lang ts --no-browsers
418
+ cd sample
502
419
 
503
- ```
504
- mkdir demo && cd demo
505
- ct new "Shop"
506
- ct tc url https://example.com/login --ai
420
+ ct tc url https://mini-bank.testamplify.com/login --ai --feature "Login" --count 1
507
421
  ct normalize ./cases --and-gen --lang ts
508
422
  ct test
509
423
  ```
510
424
 
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)
425
+ ## Key source files
557
426
 
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
427
+ ```text
428
+ src/cli.ts
429
+ src/commands/new.ts
430
+ src/commands/tc.ts
431
+ src/commands/normalize.ts
432
+ src/commands/gen.ts
433
+ src/commands/test.ts
434
+ src/commands/flow.ts
435
+ src/core/capture.ts
436
+ src/core/analyse.ts
437
+ src/core/llm.ts
438
+ src/core/report.ts
439
+ src/core/prefix.ts
440
+ templates/student-framework/
441
+ templates/student-framework-ts/
568
442
  ```
569
443
 
570
- ### 2. Push to Main
571
- ```bash
572
- git push origin main
573
- ```
574
- *CI will run tests and build.*
575
-
576
- ### 3. Create Release Tag
577
- ```bash
578
- git push --tags
579
- ```
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
- ---
444
+ ## Changelog
605
445
 
606
- ### Phase 3 (Future)
446
+ ### v0.2.5
607
447
 
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)
448
+ - replaced the legacy URL scraping path with full Playwright-based live page capture
449
+ - integrated the POC capture and AI analysis flow into `ct tc url --ai`
450
+ - added capture artifacts at `.cementic/capture/capture-*.json`
451
+ - added preview spec output at `tests/preview/spec-preview-*.spec.cjs`
452
+ - preserved capture-generated selector hints and exact `playwright` assertions through `normalize` and `gen`
453
+ - added `--headed` and `--capture-only` support for the URL capture flow
454
+ - expanded capture-aware AI provider support to DeepSeek, Anthropic, Gemini, Qwen, Kimi, and OpenAI-compatible endpoints
613
455
 
614
- ---
456
+ ## Current limitations
615
457
 
616
- # 🤝 Contributing
458
+ - generator assertions and step mapping are heuristic
459
+ - there is no built-in self-healing test loop yet
460
+ - there is no first-class Playwright CLI integration yet
461
+ - POM generation intentionally avoids overwriting existing page objects, so existing pages may diverge from later normalized cases
617
462
 
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?
463
+ ## Contributing
624
464
 
625
- We created an org on NPMjs
465
+ 1. Create a branch
466
+ 2. Run `npm test`
467
+ 3. Verify a manual `tc -> normalize -> gen -> test` flow if your change affects generation
468
+ 4. Open a PR with the behavior change clearly described