@cementic/cementic-test 0.2.5 β†’ 0.2.7

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.
package/README.md CHANGED
@@ -1,448 +1,379 @@
1
- # CementicTest CLI
1
+ # πŸš€ CementicTest CLI
2
2
 
3
- CementicTest CLI (`ct`) turns plain-English test cases into runnable Playwright tests with a Page Object Model-oriented workflow.
3
+ Turn plain English into **production-ready Playwright tests** β€” instantly.
4
4
 
5
- Current pipeline:
5
+ No setup headaches. No framework confusion. Just run and automate.
6
6
 
7
- ```text
8
- ct tc -> ct normalize -> ct gen -> ct test
7
+ ---
8
+
9
+ ## ⚑ Run instantly (no install)
10
+
11
+ ```bash
12
+ npx @cementic/cementic-test
9
13
  ```
10
14
 
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.
15
+ Works even if your npm environment isn’t perfectly configured.
12
16
 
13
- ## What this version does
17
+ ---
14
18
 
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
19
+ ## πŸ’‘ What this does
25
20
 
26
- ## Installation
21
+ CementicTest converts:
27
22
 
28
- ```bash
29
- # Run without a global install
30
- npx @cementic/cementic-test --help
23
+ πŸ‘‰ Plain English
24
+ πŸ‘‰ Into structured test cases
25
+ πŸ‘‰ Into Playwright specs + Page Objects
26
+ πŸ‘‰ Then runs them
31
27
 
32
- # Or install globally
33
- npm install -g @cementic/cementic-test
34
- ```
28
+ All from your terminal.
29
+
30
+ ---
31
+
32
+ ## 🧠 Why it’s different
35
33
 
36
- Requirements:
34
+ * No framework setup required
35
+ * No Playwright expertise needed
36
+ * No manual scripting to get started
37
+ * AI-assisted test generation
38
+ * Built-in Page Object Model (POM) structure
39
+ * Works from **day one**
37
40
 
38
- - Node.js 18+
39
- - npm
41
+ ---
40
42
 
41
- ## Quick start
43
+ ## πŸ§ͺ What you can do
42
44
 
43
- ### JavaScript project
45
+ * Generate test cases (manual or AI)
46
+ * Capture real websites and generate tests
47
+ * Convert cases β†’ JSON β†’ Playwright code
48
+ * Run tests instantly
49
+ * Generate CI workflows
50
+ * View reports (Playwright + Allure)
51
+
52
+ ---
53
+
54
+ ## ⚑ 60-second quick start
44
55
 
45
56
  ```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
57
+ npx @cementic/cementic-test
51
58
  ```
52
59
 
53
- ### TypeScript project
60
+ Then:
54
61
 
55
62
  ```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
63
+ ct new demo
64
+ cd demo
65
+
66
+ ct tc --feature "Login form" --count 2
67
+ ct normalize ./cases --and-gen
60
68
  ct test
61
69
  ```
62
70
 
63
- ## Command flow
71
+ Done. You just created and ran automation.
64
72
 
65
- ### 1. `ct new <projectName>`
73
+ ---
66
74
 
67
- Scaffolds a new CementicTest + Playwright project.
75
+ ## 🌐 Generate tests from a real website
68
76
 
69
77
  ```bash
70
- ct new my-suite
71
- ct new my-suite --lang ts
72
- ct new my-suite --no-browsers
78
+ ct tc url https://mini-bank.testamplify.com/login --ai --feature "Login" --count 2
73
79
  ```
74
80
 
75
- Current scaffold support:
81
+ This will:
76
82
 
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`
83
+ * Capture the page
84
+ * Understand elements
85
+ * Generate realistic test scenarios
86
+ * Produce runnable Playwright tests
89
87
 
90
- What `ct new` does:
88
+ Important:
91
89
 
92
- - creates the project directory
93
- - copies the selected template
94
- - initializes git
95
- - runs `npm install`
96
- - optionally runs `npx playwright install`
90
+ * Live capture resolves Playwright from your current project first
91
+ * If you are inside a project created with `ct new`, `ct tc url --ai` uses that project's local `@playwright/test`
92
+ * If Playwright is missing or Chromium is not installed, the CLI now prints the exact next step instead of failing with a package-resolution stack trace
97
93
 
98
- ### 2. `ct tc`
94
+ ---
99
95
 
100
- Creates Markdown case files in `./cases`.
96
+ ## 🧱 How it works
101
97
 
102
- Interactive mode:
103
-
104
- ```bash
105
- ct tc
98
+ ```text
99
+ Plain English β†’ Markdown Cases
100
+ β†’ Normalized JSON
101
+ β†’ Playwright Specs + POM
102
+ β†’ Test Execution
106
103
  ```
107
104
 
108
- Non-interactive mode:
105
+ ---
109
106
 
110
- ```bash
111
- ct tc --feature "Checkout" --desc "Guest checkout flow" --count 3
112
- ```
107
+ ## ⚠️ If install fails (important)
113
108
 
114
- AI mode:
109
+ If you see something like:
115
110
 
116
- ```bash
117
- ct tc --ai --feature "Login" --count 3
118
111
  ```
112
+ npm ERR! Cannot read properties of null (reading 'matches')
113
+ ```
114
+
115
+ πŸ‘‰ That’s an npm issue, not CementicTest.
119
116
 
120
- ### 3. `ct tc url <url>`
117
+ ### βœ… Fix instantly
121
118
 
122
- Generates cases with awareness of a live page.
119
+ Just run:
123
120
 
124
121
  ```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"
122
+ npx @cementic/cementic-test
129
123
  ```
130
124
 
131
- Current behavior:
132
-
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
125
+ No install needed.
138
126
 
139
- ### 4. `ct normalize <path>`
127
+ ---
140
128
 
141
- Converts case files into normalized JSON in `.cementic/normalized/`.
129
+ ## 🧰 Optional install
142
130
 
143
131
  ```bash
144
- ct normalize ./cases
145
- ct normalize "cases/**/*.md"
146
- ct normalize ./cases --and-gen --lang ts
132
+ npm install -g @cementic/cementic-test
147
133
  ```
148
134
 
149
- Current normalized output includes:
135
+ If you use the global CLI, live capture still expects Playwright to be installed in the project you are working in.
150
136
 
151
- - `id`
152
- - `title`
153
- - `tags`
154
- - `steps`
155
- - `expected`
156
- - `needs_review`
157
- - `review_reasons`
158
- - `source`
159
- - `url`
137
+ ---
160
138
 
161
- Important current behavior:
139
+ ## πŸ§ͺ Core commands
162
140
 
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
166
-
167
- ### 5. `ct gen`
168
-
169
- Generates Playwright specs and page-object files from normalized JSON.
141
+ ### Create project
170
142
 
171
143
  ```bash
172
- ct gen --lang ts
173
- ct gen --lang js
174
- ct gen --lang ts --out tests/e2e
144
+ ct new my-suite
175
145
  ```
176
146
 
177
- Current output locations:
147
+ ### Generate test cases
178
148
 
179
- - specs: `tests/generated/` by default
180
- - page objects: `pages/`
181
-
182
- Current generator behavior:
149
+ ```bash
150
+ ct tc --feature "Checkout" --count 3
151
+ ```
183
152
 
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
153
+ ### Generate from live site
191
154
 
192
- ### 6. `ct test`
155
+ ```bash
156
+ ct tc url <url> --ai
157
+ ```
193
158
 
194
- Runs Playwright tests.
159
+ Common setup after scaffolding:
195
160
 
196
161
  ```bash
197
- ct test
198
- ct test --headed
199
- ct test --project chromium
162
+ cd my-suite
163
+ npm install
164
+ npx playwright install chromium
165
+ ct tc url https://example.com/login --ai --feature "Login"
200
166
  ```
201
167
 
202
- This is a thin wrapper over:
168
+ ### Normalize + generate tests
203
169
 
204
170
  ```bash
205
- npx playwright test
171
+ ct normalize ./cases --and-gen
206
172
  ```
207
173
 
208
- Arguments after `ct test` are passed through to Playwright.
209
-
210
- ### 7. `ct flow`
174
+ ### Run tests
211
175
 
212
- Runs the end-to-end workflow:
176
+ ```bash
177
+ ct test
178
+ ```
213
179
 
214
- 1. normalize
215
- 2. generate
216
- 3. test
180
+ ### Full workflow
217
181
 
218
182
  ```bash
219
183
  ct flow
220
- ct flow ./cases
221
- ct flow --lang js
222
- ct flow --no-run
223
184
  ```
224
185
 
225
- ### 8. `ct report`
186
+ ---
226
187
 
227
- Opens the Playwright HTML report.
188
+ ## πŸ“Š Reports
228
189
 
229
190
  ```bash
230
- ct report
191
+ ct report # Playwright report
192
+ ct serve # Allure report (if installed)
231
193
  ```
232
194
 
233
- Equivalent behavior:
195
+ ---
196
+
197
+ ## βš™οΈ CI (GitHub Actions)
234
198
 
235
199
  ```bash
236
- npx playwright show-report
200
+ ct ci
237
201
  ```
238
202
 
239
- ### 9. `ct serve`
203
+ Generates a ready-to-run workflow.
240
204
 
241
- Serves the Allure report if `allure-commandline` is available in the current project.
205
+ ---
242
206
 
243
- ```bash
244
- ct serve
245
- ```
207
+ ## πŸ€– AI support
246
208
 
247
- Current behavior:
209
+ Supports multiple providers:
248
210
 
249
- - prefers the local `node_modules/allure-commandline/bin/allure` binary
250
- - falls back to `npx allure serve ./allure-results`
211
+ * OpenAI
212
+ * Anthropic
213
+ * Gemini
214
+ * DeepSeek
215
+ * Qwen
216
+ * Kimi
251
217
 
252
- ### 10. `ct ci`
218
+ Set your key:
253
219
 
254
- Generates a GitHub Actions workflow at `.github/workflows/cementic.yml`.
220
+ ```bash
221
+ export OPENAI_API_KEY=your_key
222
+ ```
223
+ or
255
224
 
256
225
  ```bash
257
- ct ci
226
+ export ANTHROPIC_API_KEY=your_key
227
+ export GEMINI_API_KEY=your_key
228
+ export DEEPSEEK_API_KEY=your_key
229
+ export QWEN_API_KEY=your_key
230
+ export KIMI_API_KEY=your_key
258
231
  ```
259
232
 
260
- Current workflow behavior:
233
+ # Optional (generic / override)
234
+ ```bash
235
+ export CT_LLM_API_KEY=your_key
236
+ export CT_LLM_PROVIDER=openai
237
+ export CT_LLM_MODEL=your_model
238
+ export CT_LLM_BASE_URL=https://your-api-base-url
239
+ ```
240
+
241
+ Provider notes:
242
+
243
+ * `DEEPSEEK_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `QWEN_API_KEY`, `KIMI_API_KEY`, and `OPENAI_API_KEY` are all detected directly
244
+ * `CT_LLM_API_KEY` + `CT_LLM_BASE_URL` works for OpenAI-compatible endpoints
245
+ * `CT_LLM_PROVIDER` can explicitly select `deepseek`, `anthropic`, `gemini`, `qwen`, `kimi`, or `openai`
246
+ ---
261
247
 
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
248
+ ## πŸ› οΈ Troubleshooting
267
249
 
268
- ## AI provider support
250
+ ### `ct tc url --ai` says Playwright is not found
269
251
 
270
- Current AI flows live in `src/core/llm.ts` and `src/core/analyse.ts`.
252
+ Run:
253
+
254
+ ```bash
255
+ npm install
256
+ npx playwright install chromium
257
+ ```
271
258
 
272
- Provider behavior in this version:
259
+ This command resolves Playwright from the active project directory first, not from the CLI's global install.
273
260
 
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
261
+ ### `ct tc url --ai` says Chromium is not installed
277
262
 
278
- Supported environment variables:
263
+ Run:
279
264
 
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 |
265
+ ```bash
266
+ npx playwright install chromium
267
+ ```
293
268
 
294
- Current defaults:
269
+ ### No AI key found
295
270
 
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`
271
+ Set one of:
302
272
 
303
- ## URL capture
273
+ ```bash
274
+ export OPENAI_API_KEY=your_key
275
+ export ANTHROPIC_API_KEY=your_key
276
+ export GEMINI_API_KEY=your_key
277
+ export DEEPSEEK_API_KEY=your_key
278
+ export QWEN_API_KEY=your_key
279
+ export KIMI_API_KEY=your_key
280
+ ```
304
281
 
305
- Current capture behavior lives in `src/core/capture.ts`.
282
+ Or use:
306
283
 
307
- Primary path:
284
+ ```bash
285
+ export CT_LLM_API_KEY=your_key
286
+ export CT_LLM_BASE_URL=https://your-api-base-url
287
+ ```
308
288
 
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`
289
+ ### Legacy macOS project setup
321
290
 
322
- ## Generated project structure
291
+ On macOS 13 and older, `ct new` installs Chromium only during Playwright browser setup to avoid unsupported WebKit failures.
323
292
 
324
- After a typical run:
293
+ ## πŸ“ Output structure
325
294
 
326
295
  ```text
327
296
  project/
328
297
  cases/
329
298
  pages/
330
- tests/
331
- generated/
332
- .cementic/
333
- normalized/
334
- playwright.config.js|ts
335
- ```
336
-
337
- Typical file flow:
338
-
339
- ```text
340
- cases/*.md
341
- -> .cementic/normalized/*.json
342
- -> tests/generated/*.spec.ts|js
343
- -> pages/*.ts|js
299
+ tests/generated/
300
+ .cementic/normalized/
344
301
  ```
345
302
 
346
- ## Example case file
347
-
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
303
+ ---
356
304
 
357
- ## Expected Results
358
- - Page redirects to /dashboard
359
- - Welcome message is visible
360
- ```
305
+ ## 🎯 Who this is for
361
306
 
362
- ## Current implementation notes
307
+ * QA engineers moving into automation
308
+ * Beginners learning Playwright
309
+ * Teams needing fast test generation
310
+ * Developers who want speed over setup
363
311
 
364
- This version is intentionally heuristic and file-oriented.
312
+ ---
365
313
 
366
- Important current characteristics:
314
+ ## πŸš€ Philosophy
367
315
 
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
316
+ > Meaning β†’ Structure β†’ System β†’ Resilience
373
317
 
374
- ## Developer setup
318
+ CementicTest flips automation from:
375
319
 
376
- ```bash
377
- git clone <repo>
378
- cd cementic-test-cli
379
- npm install
320
+ ```
321
+ Code β†’ Tests
380
322
  ```
381
323
 
382
- Build the CLI:
324
+ to:
383
325
 
384
- ```bash
385
- npm run build
326
+ ```
327
+ Intent β†’ Tests
386
328
  ```
387
329
 
388
- Run the repo test suite:
330
+ ---
389
331
 
390
- ```bash
391
- npm test
392
- ```
332
+ ## πŸ”— Links
393
333
 
394
- What `npm test` currently verifies:
334
+ * 🌐 Website: [https://cementic.testamplify.io/](https://cementic.testamplify.io/)
335
+ * πŸ’¬ Community: [https://t.me/+Wbx7oK7ivqgxZGJh](https://t.me/+Wbx7oK7ivqgxZGJh)
395
336
 
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
337
+ ---
401
338
 
402
- ## Local development loop
339
+ ## πŸ§ͺ Status
403
340
 
404
- ```bash
405
- npm run build
406
- npm link
341
+ * CLI: βœ… Production-ready
342
+ * Web App (Agentic UI): 🚧 Coming soon
407
343
 
408
- ct --help
409
- ```
344
+ ---
410
345
 
411
- Manual smoke flow:
346
+ ## πŸ’¬ Final note
412
347
 
413
- ```bash
414
- mkdir demo
415
- cd demo
348
+ You don’t need to install anything.
349
+ You don’t need to configure anything.
416
350
 
417
- ct new sample --lang ts --no-browsers
418
- cd sample
351
+ Just run:
419
352
 
420
- ct tc url https://mini-bank.testamplify.com/login --ai --feature "Login" --count 1
421
- ct normalize ./cases --and-gen --lang ts
422
- ct test
353
+ ```bash
354
+ npx @cementic/cementic-test
423
355
  ```
424
356
 
425
- ## Key source files
357
+ And start automating.
426
358
 
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/
442
- ```
443
359
 
444
360
  ## Changelog
445
361
 
362
+ ### v0.2.7
363
+
364
+ - fixed project-first Playwright resolution for `ct tc url --ai`, including global and `npx` CLI usage
365
+ - added clearer capture failure categories and setup guidance for missing Playwright, missing browsers, and page-load failures
366
+ - centralized AI provider detection so `tc --ai` and capture analysis recognize the same providers and env vars
367
+ - fixed missing DeepSeek guidance in the CLI help path
368
+ - changed legacy macOS browser setup to install Chromium only by default and avoid WebKit unsupported failures
369
+
370
+ ### v0.2.6
371
+
372
+ - added an install-time banner with links to the website and community
373
+ - surfaced project links and web app status near the top of the README
374
+ - added a standalone `CONTRIBUTING.md`
375
+ - added a `CODE_OF_CONDUCT.md`
376
+
446
377
  ### v0.2.5
447
378
 
448
379
  - replaced the legacy URL scraping path with full Playwright-based live page capture
@@ -462,7 +393,4 @@ templates/student-framework-ts/
462
393
 
463
394
  ## Contributing
464
395
 
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
396
+ Contribution guidelines live in [CONTRIBUTING.md](./CONTRIBUTING.md).