Skip to content

Commit

Permalink
Asset Upload Support
Browse files Browse the repository at this point in the history
Upgrade the applause-reporter-common package so we can upload assets to the Applause Automation API.

We needed to transition our reporter to multiple services to gain access to more hooks that webdriverio provides. This also means that we now require two services to exeucte tests against the automation api. This is because services can only be classified as either launcher services, or worker services. The RunService is considered a launcher service, while the result service is a worker service.

To better handle logging for results, we built in the ability to inject a custom winston logger into the services. If one is not provided, we construct a default logger that is used for each component of the service.
  • Loading branch information
rconner46 committed Aug 8, 2024
1 parent 8bf2fea commit f1c6691
Show file tree
Hide file tree
Showing 13 changed files with 1,081 additions and 289 deletions.
203 changes: 189 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,204 @@ runs tests using Node and UVU

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
# Usage

## Setup
## Configuration Setup

## Configuration Setup

To set up the `applause.json` config file for the WebdriverIO tests, follow these steps:

1. Create a new file named `applause.json` in the root directory of your project.

2. Open the `applause.json` file and add the following JSON structure:

```json
{
"apiKey": "API_KEY",
"productId": 0,
"applauseTestCycleId": 0,
"testRailOptions": {
"projectId": 0,
"suiteId": 0,
"planName": "Example Plan Name",
"runName": "Example Run Name"
}
}
```

The `apiKey` and `productId` settings are required for execution. The `testRailOptions` and `applauseTestCycleId` settings are optional.

3. Save the `applause.json` file.

Now, when you run your WebdriverIO tests, they will be configured to use the settings specified in the `applause.json` file.

## Applause Automation Reporting

To use the `ApplauseRunService` and `ApplauseResultService` in a WebdriverIO configuration file, follow these steps:

1. Install the `wdio-applause-reporter` package as a dev dependency by running the command: `npm install wdio-applause-reporter --save-dev`.

2. Import the `ApplauseRunService` and `ApplauseResultService` classes in your WebdriverIO configuration file:

```javascript
import { ApplauseRunService, ApplauseResultService } frpom 'wdio-applause-reporter';
```

3. Add the `ApplauseRunService` and `ApplauseResultService` to the `services` array in your WebdriverIO configuration file:

```javascript
exports.config = {
// ... other configuration options

services: [
// ... other services
[ApplauseRunService, {}],
[ApplauseResultService, {}]
],

// ... other configuration options
};
```

4. Run your WebdriverIO tests as usual. The `ApplauseRunService` will handle setting up the Applause TestRun the `ApplauseResultService` will handle the reporting.

## Applause Platform Reporting

To use the `ApplausePlatformReporter` in the reporter section of a WebdriverIO configuration file, follow these steps:

1. Install the `wdio-applause-reporter` package as a dev dependency by running the command: `npm install wdio-applause-reporter --save-dev`.

`yarn install`
2. Import the `ApplausePlatformReporter` class in your WebdriverIO configuration file:

### build
```javascript
import { ApplausePlatformReporter } from 'wdio-applause-reporter';
```

`yarn build`
3. Add the `ApplausePlatformReporter` to the `reporters` array in your WebdriverIO configuration file:

### test
```javascript
exports.config = {
// ... other configuration options

`yarn test`
reporters: [
// ... other reporters
[ApplausePlatformReporter, {}]
],

### clean
// ... other configuration options
};
```

`yarn clean`
4. Run your WebdriverIO tests as usual. The `ApplausePlatformReporter` will handle reporting to the Applause Platform.

### lint
## Winston Logger Configurations

To insert a custom Winston logger into the `ApplausePlatformReporter`, `ApplauseRunService`, and `ApplauseResultService`, you can follow these steps:

1. Create a custom Winston logger configuration in your WebdriverIO configuration file. You can use the `winston` package to create and configure your logger. Here's an example:

```javascript
import winston from 'winston';

const logger = winston.createLogger({
level: 'info',
format: winston.format.simple(),
transports: [
new winston.transports.Console()
]
});
```

2. Pass the custom logger to the respective services and reporter by adding the `logger` option to their configuration. Here's an example:

```javascript
exports.config = {
// ... other configuration options

services: [
// ... other services
[ApplauseRunService, {
logger: logger
}],
[ApplauseResultService, {
logger: logger
}]
],

reporters: [
// ... other reporters
[ApplausePlatformReporter, {
logger: logger
}]
],

// ... other configuration options
};
```

By providing the `logger` option with your custom logger, you can integrate it into the `ApplausePlatformReporter`, `ApplauseRunService`, and `ApplauseResultService` for logging purposes.

To insert a custom Winston logger into the `ApplausePlatformReporter`, `ApplauseRunService`, and `ApplauseResultService`, you can follow these steps:

1. Create a custom Winston logger configuration in your WebdriverIO configuration file. You can use the `winston` package to create and configure your logger. Here's an example:

```javascript
import winston from 'winston';

const logger = winston.createLogger({
level: 'info',
format: winston.format.simple(),
transports: [
new winston.transports.Console(),
new ApplauseTransport(),
]
});
```

2. Pass the custom logger to the respective services and reporter by adding the `logger` option to their configuration. Here's an example:

```javascript
exports.config = {
// ... other configuration options

services: [
// ... other services
[ApplauseRunService, {
logger: logger
}],
[ApplauseResultService, {
logger: logger
}]
],

reporters: [
// ... other reporters
[ApplausePlatformReporter, {
logger: logger
}]
],

// ... other configuration options
};
```

By providing the `logger` option with your custom logger, you can integrate it into the `ApplausePlatformReporter`, `ApplauseRunService`, and `ApplauseResultService` for logging purposes.


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

## Setup

`yarn lint`
To set up the project, follow these steps:

## Publishing
1. Clone the repository to your local machine.
2. Navigate to the project directory: `/Users/rconner/src/wdio-applause-reporter/`.
3. Install the project dependencies by running the command: `yarn install`.
4. Build the project by running: `yarn build`.
5. Run the tests using: `yarn test`.
6. Clean the project by running: `yarn clean`.
7. Lint the code with: `yarn lint`.

`yarn publish`
Make sure you have Node.js 14+ installed and configured before proceeding with these steps.
Loading

0 comments on commit f1c6691

Please sign in to comment.