@hmcts/zephyr-automation-nodejs
v0.0.6
Published
Node.js library for Zephyr automation in HMCTS projects
Keywords
Readme
@hmcts/zephyr-automation-nodejs
Node.js library for Zephyr automation in HMCTS projects.
Overview
This package provides utilities and a custom Mocha reporter to generate, merge, and manage Zephyr-compatible JSON test reports for use in HMCTS projects. It is designed to be used with Cypress and Mocha test suites.
Features
- ZephyrReporter: Custom Mocha reporter that outputs Zephyr-compatible JSON reports.
- Report merging: Utilities to merge multiple Zephyr JSON reports, with deduplication and thread-awareness.
- Report cleaning: Utility to clean up Zephyr report directories.
Installation
yarn add @hmcts/zephyr-automation-nodejs
# or
npm install @hmcts/zephyr-automation-nodejsUsage
ZephyrReporter (Mocha)
Add the reporter to your Mocha configuration or CLI:
mocha --reporter @hmcts/zephyr-automation-nodejs/dist/cypress/ZephyrReporter.jsOr in your Cypress plugins (if using programmatically):
const { ZephyrReporter } = require('@hmcts/zephyr-automation-nodejs/dist/cypress/ZephyrReporter');Report Utilities
Import and use the utilities in your scripts:
import { mergeZephyrReports, cleanZephyrReports } from '@hmcts/zephyr-automation-nodejs';
mergeZephyrReports({ rootDir: '<Your output directory>', dedupe: true });
cleanZephyrReports({ rootDir: '<Your output directory>' });Options
rootDir: Root directory containing Zephyr reports (e.g.<Your output directory>).dedupe: (optional) Deduplicate tests when merging reports.allowMergeOnAllThreads: (optional) Allow merging on any thread (default: only on thread 1).
API
ZephyrReporter
A Mocha reporter that outputs Zephyr-compatible JSON reports. Output files are written to <Your output directory>/zephyr/temp/ by default.
mergeZephyrReports(options)
Merges all Zephyr JSON reports in the specified directory into a single report.
cleanZephyrReports(options)
Removes all Zephyr report files from the specified directory.
Development
- Build:
yarn build - Lint:
yarn lint - Test: (add your test instructions here)
Updating the zephyr-automation-independent jar
To update the zephyr-automation-independent jar, follow these steps:
- Update pom.xml with the new version of the tool both in the
dependenciessection and the header version - Run fetch-jar.sh
- Commit the updated jar file in
scripts/tools/zephyr/zephyr-automation-independent.jarand push to the repository. - Update the version of
@hmcts/zephyr-automation-nodejsinpackage.jsonand publish a new version.
For local testing of changes to the jar file:
yarn add @hmcts/zephyr-automation-nodejs@file: I.e yarn add @hmcts/zephyr-automation-nodejs@file:/Users/benedwards/Desktop/Projects/opal/github/zephyr-automation-nodejs
License
MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please open issues or pull requests on GitHub.
