CLI
Overview
HTML Reporter has the following commands:
- gui—to run Testplane in GUI mode;
- merge-reports—to merge multiple reports into one.
- remove-unused-screens—to remove reference screenshots that are not used in tests;
When using HTML Reporter with Testplane, you can also use commands through Testplane, for example: npx testplane gui
.
When using with other tools, you need to specify the tool name in the tool argument, for example: npx html-reporter gui --tool playwright
.
gui
This command is only available when using HTML Reporter with Testplane and Playwright.
Use the gui
command to launch Testplane in GUI mode.
GUI mode allows you to:
- run tests interactively;
- update screenshots—visually viewing them and taking only the necessary diffs;
- reuse reports from CI;
- filter the results of the run by errors, keys from meta, etc.
Usage
npx html-reporter gui
merge-reports
This command is only available when using HTML Reporter with Testplane and Playwright.
Use the merge-reports
command to merge multiple reports into one.
The command accepts paths to report directories, database files, or databaseUrls.json
files.
It creates a new html-report in the destination folder with data from all passed reports.
- When merging local reports—all data, including SQLite databases and screenshots, are copied to the destination directory.
- When merging reports by link (for example, if
databaseUrls.json
files with links to reports in S3 are passed as input)—a report with links to the original reports indatabaseUrls.json
will be created in the destination directory, without downloading and copying all nested resources. When working with the report, this will not be noticeable, but you need to keep in mind that the original reports must remain accessible, as the merged report gets data from them.
Usage
The merge-reports
command supports the following required option:
Option | Description |
-d, --destination <folder> | The path to the folder where you want to save the final report. |
-h, --header <header> | Http header for databaseUrls.json files from source paths. |
Usage example:
npx html-reporter merge-reports report-dir/ path-to-database.db path-to-databaseUrls.json -d dest-report -h foo=bar
Http headers can also be send using the environment variable — html_reporter_headers
(has a higher priority than the cli option `--header'). Example:
html_reporter_headers='{"foo":"bar"}' npx hermione merge-reports path-to-database.db path-to-databaseUrls.json -d dest-report -h baz=qux
In this call, the path-to-databaseUrls.json
will be requested with headers: {foo: 'bar', baz: 'qux'}
.
remove-unused-screens
This command is only available when using HTML Reporter with Testplane.
Use the remove-unused-screens
command to remove the reference screenshots that are not used in tests.
How does it work?
First, the command looks for screenshots for which there are no tests on the file system.
Next, the command searches for screenshots that were not used in successful testing (the test result is taken from the SQLite database). To do this, the html-report must exist on the file system and contain the results of the tests run. This means that you must run the tests locally or download the report from CI before running the remove-unused-screens
command.
Usage
The remove-unused-screens
command supports several options:
Option | Description |
-p, --pattern <pattern> | A pattern for finding screenshots on the file system. |
--skip-questions | Do not ask questions during execution (use default values). |
-h, --help | Output the reference information on the command to the terminal. |
Usage examples
Specifying the folder in which to search for unused screenshots:
npx testplane remove-unused-screens -p 'testplane-screens-folder'
Setting the pattern by which to search for screenshots:
npx testplane remove-unused-screens -p 'screens/**/*.png'
Setting several patterns by which to search for screenshots:
npx testplane remove-unused-screens -p 'screens/**/chrome/*.png' -p 'screens/**/firefox/*.png'
Specifying the folder in which to search for unused screenshots and setting do-not-ask-questions option:
npx testplane remove-unused-screens -p 'testplane-screens-folder' --skip-questions
Getting the reference information about the command:
npx testplane remove-unused-screens --help