Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.0 #52

Merged
merged 6 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 62 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# Client API for automation backend
Used by reporter integrations for JS test frameworks.
# Applause Automation API Access

Written in TypeScript, transpiled to JS for NPM packaging using Rollup
This project contains a shared interface into the Applause Automation API for JS/TS projects that need to communicate with the Applause Services. Each testing framework
requires a custom integration to handle adding these methods into the correct hooks provided by the framework. These methods can also be called manually if a custom integration
is needed.

creates NPM package in /dist folder in ES, UMD, and CJS module formats
## Implementations

also publishes Typescript types and sourcemaps into NPM package
You can find the following reporter interfaces to be used with their corresponding JS/TS Test Runners:
- wdio-applause-reporter: https://github.com/ApplauseOSS/wdio-applause-reporter
- jest-applause-reporter: https://github.com/ApplauseOSS/jest-applause-reporter
- mocha-applause-reporter: https://github.com/ApplauseOSS/mocha-applause-reporter
- cucumber-applause-reporter: https://github.com/ApplauseOSS/cucumber-applause-reporter

runs tests using Node and Jest
## Requirements:
- Node 20.x
- TypeScript

Configured for Node 14+ . To update, change base tsconfig from "extends": "@tsconfig/node14/tsconfig.json", update "engines" section in package.json, and update .node-version file

# Running
Use `yarn run all` . It will configure and run all the build steps
## Running

## Run through local dev setup and build
### Run through local dev setup and build

`yarn all`

Expand All @@ -34,7 +39,52 @@ Use `yarn run all` . It will configure and run all the build steps

`yarn lint`

## Publishing
### Publishing
`yarn publish-verify`

CI will do actual pubish on merge
## Implementation Information

### Applause Shared Reporter
The file reporter.ts contains the implementation of the ApplauseReporter class, which serves as a reporter for the Applause testing framework. This class provides methods to interact with the Applause API and perform various actions related to test runs, test cases, and test case results.

Here's a breakdown of the key components and functionalities of the ApplauseReporter class:

#### startTestCase(...) Method:

Starts a test case by calling the startTestCase method on the reporter property.
If the reporter property is undefined, it throws an error indicating that a run was never initialized.
Returns a promise that resolves to the testCaseId.

#### submitTestCaseResult Method:

Submits a test case result by calling the submitTestCaseResult method on the reporter property.
If the reporter property is undefined, it throws an error indicating that a run was never initialized.
Returns a promise that resolves to the testCaseResultId.

#### runnerEnd Method:

Ends the Applause runner by calling the runnerEnd method on the reporter property.
If the reporter property is undefined, it throws an error indicating that a run was never initialized.
Returns a promise that resolves when the runner is ended.

#### attachTestCaseAsset Method:

Attaches an asset to a test case by calling the attachTestCaseAsset method on the reporter property.
If the reporter property is undefined, it throws an error indicating that a run was never initialized.
Returns a promise that resolves when the asset is attached.

#### isSynchronized Method:

Checks if the Applause runner is synchronized by verifying if the run has started and finished, and if there are no pending API calls.
Returns true if the runner is not yet started or has ended, and all calls made to the Applause API have finished.

Overall, the ApplauseReporter class provides a convenient interface for interacting with the Applause testing framework, allowing you to start test runs, manage test cases, submit test case results, attach assets, and check the synchronization status of the runner.

### Email Testing

The file email-helper.ts, along with the src/email/** directory contains the implementation of our email helper utilities. It handes allocating an email address from the applause services for testing and fetching emails from it. We utilize the 'mailparser' dependency for interacting with the email content.


### Logging Integration

The file logging.ts offers a winston Transport class that allows the Applause reporter to gain access to log messages from the tests. These get stored as assets attched to the test results in the Applause automation service.
Loading
Loading