open-index/open-npm huggingface dataset:
npm package: @session-foundation/playwright-reporter
Description: This package is a custom Playwright reporter that can be used to format the results of our QA runs for Session. It's been made as a package so that we can reuse it for each platforms (android, iOS, desktop, etc).
Latest version: 0.0.8

# Playwright Reporter for Session

This package is a custom Playwright reporter that can be used to format the results of our QA runs for Session.
It's been made as a package so that we can reuse it for each platforms (android, iOS, desktop, etc).

## Description

It will output the results to `console.log` and to a CSV file named `test-results.csv`.

If the tests are running in a CI environment (see `isCI` below), it will keep the CSV from one run and append the next results to it. That way, the `test-results.csv` file will contain all the results of all the runs for that CI job, even if `npx playwright test` is run multiple times.

### Usage

To use this reporter, you need to add it to your Playwright configuration file (e.g. `playwright.config.ts`).

First add `@session-foundation/playwright-reporter` as a dev dependency on your project.

```sh
yarn add -D @session-foundation/playwright-reporter
```

Then, configure it
```ts
export default defineConfig = {
  reporter: [
    ['./node_modules/@session-foundation/playwright-reporter/dist/index.js'],
  ],
};
```

### Configuration

You can configure the reporter by setting environment variables.

- `PRINT_ONGOING_TEST_LOGS`: Set to `1` to print ongoing test logs.
- `PRINT_FAILED_TEST_LOGS`: Set to `1` to print failed test logs.
- `CI`: Set to `1` to indicate that the tests are running in a CI environment. If they are, the CSV file will be kept and appended to.

Note: those are to be defined before `defineConfig()` is called, so before the playwright suite is started.

### Playwright documentation

For more information about Playwright custom reporters, see the [Playwright documentation](https://playwright.dev/docs/test-reporters#custom-reporters).