@@ -14,7 +14,7 @@ top, letting you see exactly what was tested and how.
14
14
- ** Custom highlight & badge colors:** Easily change the highlight and badge colors used in the iframe for different
15
15
action types or UI states. Great for tailoring the report to your team's visual style or accessibility needs.
16
16
- ** No framework lock-in:** Works with any UI testing framework (Playwright, Selenium, etc.) by simply logging actions
17
- via the ` track_coverage ()` method.
17
+ via the ` trackCoverage ()` method.
18
18
- ** Element-level statistics:** View detailed statistics by selector: type of action, count of actions, and a timeline
19
19
graph of coverage.
20
20
- ** Global history overview:** Track historical trends of total coverage and action types across time.
@@ -81,20 +81,20 @@ If you have any questions or need assistance, feel free to ask [@Nikita Filonov]
81
81
82
82
There are two separate tools, each with its own purpose, strengths, and philosophy:
83
83
84
- 🟢 [ ui-coverage-tool] ( https://github.com/Nikita-Filonov/ui-coverage-tool ) — Simple & Instant Coverage
84
+ 🟢 [ ui-coverage-tool-js ] ( https://github.com/Nikita-Filonov/ui-coverage-tool-js ) — Simple & Instant Coverage
85
85
This is the original tool. It’s designed to be:
86
86
87
87
- ** Extremely simple and fast to integrate**
88
88
- ** Ideal for quick visibility** into which elements your UI tests are interacting with
89
89
- ** Perfect for prototyping or smoke-checks** , where deep scenario structure isn’t needed
90
90
91
- Think of [ ui-coverage-tool] ( https://github.com/Nikita-Filonov/ui-coverage-tool ) as the lightweight, no-frills solution
92
- for getting instant test coverage insights with minimal setup.
91
+ Think of [ ui-coverage-tool-js ] ( https://github.com/Nikita-Filonov/ui-coverage-tool-js ) as the lightweight, no-frills
92
+ solution for getting instant test coverage insights with minimal setup.
93
93
94
- 🔵 [ ui-coverage-scenario-tool] ( https://github.com/Nikita-Filonov/ui-coverage-scenario-tool ) — Scenario-Based & Insightful
95
- This is the advanced version of the original tool, built on top of all its features — and more:
94
+ 🔵 [ ui-coverage-scenario-tool-js ] ( https://github.com/Nikita-Filonov/ui-coverage-scenario-tool-js ) — Scenario-Based &
95
+ Insightful This is the advanced version of the original tool, built on top of all its features — and more:
96
96
97
- - Includes everything from ` ui-coverage-tool `
97
+ - Includes everything from ` ui-coverage-tool-js `
98
98
- Adds ** scenario-level structure** , so your coverage report shows:
99
99
- Which ** scenarios** were executed
100
100
- Which ** elements** were used in each scenario
@@ -110,14 +110,14 @@ coverage, [ui-coverage-scenario-tool](https://github.com/Nikita-Filonov/ui-cover
110
110
111
111
## Why Two Tools?
112
112
113
- While ` ui-coverage-scenario-tool ` is more powerful, the original ` ui-coverage-tool ` still has a place.
113
+ While ` ui-coverage-scenario-tool-js ` is more powerful, the original ` ui-coverage-tool-js ` still has a place.
114
114
115
115
They serve different purposes:
116
116
117
- | Tool | Best For | Strengths |
118
- | -----------------------------| -----------------------------------------------| -----------------------------------------------|
119
- | ` ui-coverage-tool ` | Quick setup, lightweight testing environments | Easy to integrate, minimal overhead |
120
- | ` ui-coverage-scenario-tool ` | Structured E2E scenarios, business test cases | Rich detail, scenario linkage, deeper insight |
117
+ | Tool | Best For | Strengths |
118
+ | -------------------------------- | -----------------------------------------------| -----------------------------------------------|
119
+ | ` ui-coverage-tool-js ` | Quick setup, lightweight testing environments | Easy to integrate, minimal overhead |
120
+ | ` ui-coverage-scenario-tool-js ` | Structured E2E scenarios, business test cases | Rich detail, scenario linkage, deeper insight |
121
121
122
122
Keeping them separate allows users to choose based on ** project needs** , ** team maturity** , and ** desired complexity** .
123
123
@@ -151,8 +151,9 @@ That’s it. No other setup required. Without this script, the coverage report w
151
151
152
152
## Usage
153
153
154
- Below are examples of how to use the tool with two popular UI automation frameworks: ` Playwright ` and ` Selenium ` . In
155
- both cases, coverage data is automatically saved to the ` ./coverage-results ` folder after each call to ` track_coverage ` .
154
+ Below are examples of how to use the tool with popular UI automation
155
+ frameworks: ` Playwright ` , ` Puppeteer ` , ` Selenium ` . In both cases, coverage data is automatically saved to
156
+ the ` ./coverage-results ` folder after each call to ` await tracker.trackCoverage(...) ` .
156
157
157
158
### Playwright
158
159
@@ -174,6 +175,11 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
174
175
175
176
await page .goto (' https://my-ui-app.com/login' );
176
177
178
+ // Start a new scenario with metadata:
179
+ // - url: a link to the test case in TMS or documentation
180
+ // - name: a descriptive scenario name
181
+ tracker .startScenario ({ url: ' http://tms.com/test-cases/1' , name: ' Successful login' });
182
+
177
183
const usernameInput = page .locator (' #username-input' );
178
184
await usernameInput .fill (' user@example.com' );
179
185
@@ -194,24 +200,28 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
194
200
actionType: ActionType .CLICK
195
201
});
196
202
203
+ // End the current scenario.
204
+ // This finalizes and saves the coverage data for this test case.
205
+ await tracker .endScenario ();
206
+
197
207
await browser .close ();
198
208
})();
199
209
200
210
```
201
211
202
212
Quick summary:
203
213
204
- - Call ` tracker.start_scenario( ) ` to begin a new scenario.
205
- - Use ` tracker.track_coverage( ) ` after each user interaction.
214
+ - Call ` tracker.startScenario(... ) ` to begin a new scenario.
215
+ - Use ` await tracker.trackCoverage(... )` after each user interaction.
206
216
- Provide the selector, action type, and selector type.
207
217
- The tool automatically stores tracking data as JSON files.
208
- - Once the scenario is complete, call ` tracker.end_scenario () ` to finalize and save it.
218
+ - Once the scenario is complete, call ` await tracker.endScenario ()` to finalize and save it.
209
219
210
220
### Puppeteer
211
221
212
222
``` typescript
213
223
import puppeteer from ' puppeteer' ;
214
- import { ActionType , SelectorType , UICoverageTracker } from ' ui-coverage-tool-js' ;
224
+ import { ActionType , SelectorType , UICoverageTracker } from ' ui-coverage-scenario- tool-js' ;
215
225
216
226
const tracker = new UICoverageTracker ({ app: ' my-ui-app' });
217
227
@@ -221,6 +231,8 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
221
231
222
232
await page .goto (' https://my-ui-app.com/login' );
223
233
234
+ tracker .startScenario ({ url: ' http://tms.com/test-cases/1' , name: ' Successful login' });
235
+
224
236
await page .type (' #username-input' , ' user@example.com' );
225
237
await tracker .trackCoverage ({
226
238
selector: ' #username-input' ,
@@ -238,6 +250,7 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
238
250
});
239
251
}
240
252
253
+ await tracker .endScenario ();
241
254
await browser .close ();
242
255
})();
243
256
```
@@ -246,7 +259,7 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
246
259
247
260
``` typescript
248
261
import { Builder , By } from ' selenium-webdriver' ;
249
- import { ActionType , SelectorType , UICoverageTracker } from ' ui-coverage-tool-js' ;
262
+ import { ActionType , SelectorType , UICoverageTracker } from ' ui-coverage-scenario- tool-js' ;
250
263
251
264
const tracker = new UICoverageTracker ({ app: ' my-ui-app' });
252
265
@@ -256,6 +269,8 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
256
269
try {
257
270
await driver .get (' https://my-ui-app.com/login' );
258
271
272
+ tracker .startScenario ({ url: ' http://tms.com/test-cases/1' , name: ' Successful login' });
273
+
259
274
const usernameInput = await driver .findElement (By .css (' #username-input' ));
260
275
await usernameInput .sendKeys (' user@example.com' );
261
276
@@ -275,6 +290,7 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
275
290
});
276
291
277
292
} finally {
293
+ await tracker .endScenario ();
278
294
await driver .quit ();
279
295
}
280
296
})();
@@ -283,7 +299,7 @@ const tracker = new UICoverageTracker({ app: 'my-ui-app' });
283
299
284
300
### Coverage Report Generation
285
301
286
- After every call to ` tracker.track_coverage (...) ` , the tool automatically stores coverage data in
302
+ After every call to ` await tracker.trackCoverage (...)` , the tool automatically stores coverage data in
287
303
the ` ./coverage-results/ ` directory as JSON files. You don’t need to manually manage the folder — it’s created and
288
304
populated automatically.
289
305
@@ -294,9 +310,9 @@ populated automatically.
294
310
└── ...
295
311
```
296
312
297
- When you call ` tracker.start_scenario (...) ` , a new scenario automatically begins. All subsequent actions, such as
298
- ` tracker.track_coverage (...) ` , will be logged within the context of this scenario. To finalize and save the scenario,
299
- you need to call ` tracker.end_scenario () ` . This method ends the scenario and saves it to a JSON file.
313
+ When you call ` tracker.startScenario (...) ` , a new scenario automatically begins. All subsequent actions, such as
314
+ ` await tracker.trackCoverage (...)` , will be logged within the context of this scenario. To finalize and save the
315
+ scenario, you need to call ` await tracker.endScenario ()` . This method ends the scenario and saves it to a JSON file.
300
316
301
317
```
302
318
./coverage-results/
@@ -309,7 +325,7 @@ Once your tests are complete and coverage data has been collected, generate a fi
309
325
command:
310
326
311
327
``` shell
312
- ui-coverage-scenario-tool save-report
328
+ npx ui-coverage-scenario-tool save-report
313
329
```
314
330
315
331
This will generate:
@@ -323,34 +339,34 @@ This will generate:
323
339
- Sending metrics to external systems
324
340
- Custom integrations or dashboards
325
341
326
- ** Important!** The ` ui-coverage-scenario-tool save-report ` command must be run from the ** root of your project** , where
327
- your config files (` .env ` , ` ui_coverage_scenario_config. yaml` , etc.) are located. Running it from another directory may
328
- result in missing data or an empty report.
342
+ ** Important!** The ` npx ui-coverage-scenario-tool save-report` command must be run from the ** root of your project** ,
343
+ where your config files (` .env ` , ` ui-coverage-scenario.config. yaml` , etc.) are located. Running it from another
344
+ directory may result in missing data or an empty report.
329
345
330
346
## Configuration
331
347
332
348
You can configure the UI Coverage Tool using a single file: either a YAML, JSON, or ` .env ` file. By default, the
333
349
tool looks for configuration in:
334
350
335
- - ` ui_coverage_scenario_config .yaml`
336
- - ` ui_coverage_scenario_config .json`
351
+ - ` ui-coverage-scenario.config .yaml`
352
+ - ` ui-coverage-scenario.config .json`
337
353
- ` .env ` (for environment variable configuration)
338
354
339
355
All paths are relative to the current working directory, and configuration is automatically loaded
340
- via [ get_settings ()] ( ui_coverage_scenario_tool/ config.py ) .
356
+ via [ getSettings ()] ( ./src/ config/core.ts ) .
341
357
342
358
** Important!** Files must be in the project root.
343
359
344
360
### Configuration via ` .env `
345
361
346
362
All settings can be declared using environment variables. Nested fields use dot notation, and all variables must be
347
- prefixed with ` UI_COVERAGE_ ` .
363
+ prefixed with ` UI_COVERAGE_SCENARIO_ ` .
348
364
349
365
** Example:** [ .env] ( docs/configs/.env.example )
350
366
351
367
``` dotenv
352
368
# Define the applications that should be tracked. In the case of multiple apps, they can be added in a comma-separated list.
353
- UI_COVERAGE_APPS ='[
369
+ UI_COVERAGE_SCENARIO_APPS ='[
354
370
{
355
371
"key": "my-ui-app",
356
372
"url": "https://my-ui-app.com/login",
@@ -361,22 +377,22 @@ UI_COVERAGE_APPS='[
361
377
]'
362
378
363
379
# The directory where the coverage results will be saved.
364
- UI_COVERAGE_RESULTS_DIR ="./coverage-results"
380
+ UI_COVERAGE_SCENARIO_RESULTS_DIR ="./coverage-results"
365
381
366
382
# The file that stores the history of coverage results.
367
- UI_COVERAGE_HISTORY_FILE ="./coverage-history.json"
383
+ UI_COVERAGE_SCENARIO_HISTORY_FILE ="./coverage-history.json"
368
384
369
385
# The retention limit for the coverage history. It controls how many historical results to keep.
370
- UI_COVERAGE_HISTORY_RETENTION_LIMIT =30
386
+ UI_COVERAGE_SCENARIO_HISTORY_RETENTION_LIMIT =30
371
387
372
388
# Optional file paths for the HTML and JSON reports.
373
- UI_COVERAGE_HTML_REPORT_FILE ="./index.html"
374
- UI_COVERAGE_JSON_REPORT_FILE ="./coverage-report.json"
389
+ UI_COVERAGE_SCENARIO_HTML_REPORT_FILE ="./index.html"
390
+ UI_COVERAGE_SCENARIO_JSON_REPORT_FILE ="./coverage-report.json"
375
391
```
376
392
377
393
### Configuration via YAML
378
394
379
- ** Example:** [ ui_coverage_scenario_config. yaml] ( docs/configs/ui_coverage_scenario_config .yaml )
395
+ ** Example:** [ ui-coverage-scenario.config. yaml] ( docs/configs/ui-coverage-scenario.config .yaml )
380
396
381
397
``` yaml
382
398
apps :
@@ -386,20 +402,20 @@ apps:
386
402
tags : [ "UI", "PRODUCTION" ]
387
403
repository : " https://github.com/my-ui-app"
388
404
389
- results_dir : " ./coverage-results"
390
- history_file : " ./coverage-history.json"
391
- history_retention_limit : 30
392
- html_report_file : " ./index.html"
393
- json_report_file : " ./coverage-report.json"
405
+ resultsDir : " ./coverage-results"
406
+ historyFile : " ./coverage-history.json"
407
+ historyRetentionLimit : 30
408
+ htmlReportFile : " ./index.html"
409
+ jsonReportFile : " ./coverage-report.json"
394
410
` ` `
395
411
396
412
### Configuration via JSON
397
413
398
- **Example:** [ui_coverage_scenario_config. json](docs/configs/ui_coverage_scenario_config .json)
414
+ **Example:** [ui-coverage-scenario.config. json](docs/configs/ui-coverage-scenario.config .json)
399
415
400
416
` ` ` json
401
417
{
402
- " services " : [
418
+ " apps " : [
403
419
{
404
420
" key " : " my-ui-app" ,
405
421
" url " : " https://my-ui-app.com/login" ,
@@ -411,29 +427,29 @@ json_report_file: "./coverage-report.json"
411
427
" repository " : " https://github.com/my-ui-app"
412
428
}
413
429
],
414
- " results_dir " : " ./coverage-results" ,
415
- " history_file " : " ./coverage-history.json" ,
416
- " history_retention_limit " : 30,
417
- " html_report_file " : " ./index.html" ,
418
- " json_report_file " : " ./coverage-report.json"
430
+ " resultsDir " : " ./coverage-results" ,
431
+ " historyFile " : " ./coverage-history.json" ,
432
+ " historyRetentionLimit " : 30,
433
+ " htmlReportFile " : " ./index.html" ,
434
+ " jsonReportFile " : " ./coverage-report.json"
419
435
}
420
436
```
421
437
422
438
### Configuration Reference
423
439
424
- | Key | Description | Required | Default |
425
- | --------------------------- | ---------------------------------------------------------------------------| ----------| ---------------------------|
426
- | ` apps ` | List of applications to track. Each must define ` key ` , ` name ` , and ` url ` . | ✅ | — |
427
- | ` services[].key ` | Unique internal identifier for the service. | ✅ | — |
428
- | ` services[].url ` | Entry point URL of the app. | ✅ | — |
429
- | ` services[].name ` | Human-friendly name for the service (used in reports). | ✅ | — |
430
- | ` services[].tags ` | Optional tags used in reports for filtering or grouping. | ❌ | — |
431
- | ` services[].repository ` | Optional repository URL (will be shown in report). | ❌ | — |
432
- | ` results_dir ` | Directory to store raw coverage result files. | ❌ | ` ./coverage-results ` |
433
- | ` history_file ` | File to store historical coverage data. | ❌ | ` ./coverage-history.json ` |
434
- | ` history_retention_limit ` | Maximum number of historical entries to keep. | ❌ | ` 30 ` |
435
- | ` html_report_file ` | Path to save the final HTML report (if enabled). | ❌ | ` ./index.html ` |
436
- | ` json_report_file ` | Path to save the raw JSON report (if enabled). | ❌ | ` ./coverage-report.json ` |
440
+ | Key | Description | Required | Default |
441
+ | -------------------------| ---------------------------------------------------------------------------| ----------| ---------------------------|
442
+ | ` apps ` | List of applications to track. Each must define ` key ` , ` name ` , and ` url ` . | ✅ | — |
443
+ | ` services[].key ` | Unique internal identifier for the service. | ✅ | — |
444
+ | ` services[].url ` | Entry point URL of the app. | ✅ | — |
445
+ | ` services[].name ` | Human-friendly name for the service (used in reports). | ✅ | — |
446
+ | ` services[].tags ` | Optional tags used in reports for filtering or grouping. | ❌ | — |
447
+ | ` services[].repository ` | Optional repository URL (will be shown in report). | ❌ | — |
448
+ | ` resultsDir ` | Directory to store raw coverage result files. | ❌ | ` ./coverage-results ` |
449
+ | ` historyFile ` | File to store historical coverage data. | ❌ | ` ./coverage-history.json ` |
450
+ | ` historyRetentionLimit ` | Maximum number of historical entries to keep. | ❌ | ` 30 ` |
451
+ | ` htmlReportFile ` | Path to save the final HTML report (if enabled). | ❌ | ` ./index.html ` |
452
+ | ` jsonReportFile ` | Path to save the raw JSON report (if enabled). | ❌ | ` ./coverage-report.json ` |
437
453
438
454
### How It Works
439
455
@@ -457,29 +473,13 @@ data stored in the `coverage-results` directory and generate an HTML report.
457
473
** Usage:**
458
474
459
475
``` shell
460
- ui-coverage-scenario-tool save-report
476
+ npx ui-coverage-scenario-tool save-report
461
477
```
462
478
463
479
- This is the main command to generate a coverage report. After executing UI tests and collecting coverage data, use
464
480
this command to aggregate the results into a final report.
465
481
- The report is saved as an HTML file, typically named index.html, which can be opened in any browser.
466
482
467
- ### Command: ` copy-report `
468
-
469
- This is an internal command mainly used during local development. It updates the report template for the generated
470
- coverage reports. It is typically used to ensure that the latest report template is available when you generate new
471
- reports.
472
-
473
- ** Usage:**
474
-
475
- ``` shell
476
- ui-coverage-scenario-tool copy-report
477
- ```
478
-
479
- - This command updates the internal template used by the save-report command. It's useful if the template structure or
480
- styling has changed and you need the latest version for your reports.
481
- - This command is typically only used by developers working on the tool itself.
482
-
483
483
### Command: ` print-config `
484
484
485
485
Prints the resolved configuration to the console. This can be useful for debugging or verifying that the configuration
@@ -488,10 +488,10 @@ file has been loaded and parsed correctly.
488
488
** Usage:**
489
489
490
490
``` shell
491
- ui-coverage-scenario-tool print-config
491
+ npx ui-coverage-scenario-tool print-config
492
492
```
493
493
494
- - This command reads the configuration file (` ui_coverage_scenario_config. yaml` , ` ui_coverage_scenario_config .json` ,
494
+ - This command reads the configuration file (` ui-coverage-scenario.config. yaml` , ` ui-coverage-scenario.config .json` ,
495
495
or ` .env ` )
496
496
and prints the final configuration values to the console.
497
497
- It helps verify that the correct settings are being applied and is particularly useful if something is not working as
@@ -501,9 +501,9 @@ ui-coverage-scenario-tool print-config
501
501
502
502
### The report is empty or missing data
503
503
504
- - Ensure that ` start_scenario ()` is called before the test.
505
- - Ensure that ` end_scenario ()` is called after the test.
506
- - Ensure that ` track_coverage ()` is called during your test.
507
- - Make sure you run ` ui-coverage-scenario-tool save-report ` from the root directory.
504
+ - Ensure that ` startScenario ()` is called before the test.
505
+ - Ensure that ` endScenario ()` is called after the test.
506
+ - Ensure that ` trackCoverage ()` is called during your test.
507
+ - Make sure you run ` npx ui-coverage-scenario-tool save-report` from the root directory.
508
508
- Make sure to setup configuration correctly.
509
509
- Check that the ` coverage-results ` directory contains ` .json ` files.
0 commit comments