open-index/open-npm huggingface dataset:
npm package: @saucelabs/sauce-json-reporter
Description: A library for creating test results in the Sauce Labs JSON format.
Latest version: 4.1.0

# sauce-json-reporter-js

A javascript library for creating Sauce Labs JSON test results.

A [JSON schema](api/schema.json) describing the report is also available.

## Examples

```javascript
const {TestRun, Status} = require('@saucelabs/sauce-json-reporter');

let r = new TestRun()
r.attach({name: 'screenshot.png', path:'./screenshot.png'})
const s1 = r.withSuite('somegroup')
const s2 = s1.withSuite('somefile.test.js')
s1.attach({name: 'screenshot1.png', path: './screenshot1.png'})
s2.withTest('yay', {
  status: Status.Passed,
  duration: 123,
  attachments: [
    {name: 'video.mp4', path: './video.mp4'},
    {name: 'screenshot2.png', path: './screenshot2.png'}
  ],
})
s2.withTest('nay', {
  status: Status.Failed,
  output: 'test failed',
  duration: 123,
  attachments: [
    {name: 'video.mp4', path: './video.mp4'},
  ]
})
s2.withTest('oops', {
  status: Status.Skipped,
  output: 'test skipped',
  duration: 123,
})

r.metadata = {
  'id': '123'
}

r.stringify() // returns a JSON string representing the entire test run
// or
r.toFile('my_json_report.json') // writes the JSON to a file instead
```

The resulting JSON of the above example is:

```json
{
  "status": "failed",
  "attachments": [
    {
      "name": "screenshot.png",
      "path": "./screenshot.png"
    }
  ],
  "suites": [
    {
      "name": "somegroup",
      "status": "failed",
      "metadata": {},
      "suites": [
        {
          "name": "somefile.test.js",
          "status": "failed",
          "metadata": {},
          "suites": [],
          "attachments": [],
          "tests": [
            {
              "name": "yay",
              "status": "passed",
              "duration": 123,
              "startTime": "2023-06-19T18:26:06.227Z",
              "attachments": [
                {
                  "name": "video.mp4",
                  "path": "./video.mp4"
                },
                {
                  "name": "screenshot2.png",
                  "path": "./screenshot2.png"
                }
              ],
              "metadata": {}
            },
            {
              "name": "nay",
              "status": "failed",
              "duration": 123,
              "output": "test failed",
              "startTime": "2023-06-19T18:26:06.227Z",
              "attachments": [
                {
                  "name": "video.mp4",
                  "path": "./video.mp4"
                }
              ],
              "metadata": {}
            },
            {
              "name": "oops",
              "status": "skipped",
              "duration": 123,
              "output": "test skipped",
              "startTime": "2023-06-19T18:26:06.227Z",
              "attachments": [],
              "metadata": {}
            }
          ]
        }
      ],
      "attachments": [
        {
          "name": "screenshot1.png",
          "path": "./screenshot1.png"
        }
      ],
      "tests": []
    }
  ],
  "metadata": {
    "id": "123"
  }
}
```
npm package: @saucelabs/saucewright
Description: CLI for dynamically configuring saucectl via playwright config files.
Author: devx
Latest version: 0.1.0

# saucewright

CLI for dynamically configuring saucectl via playwright config files.

This project is a proof of concept and as such does not represent a fully finished product.

Do NOT use this in production.

All the warnings out of the way, how does it work? `saucewright` inspects your local _playwright.config.js/ts_ file
and generates a _config.yml_ file that saucectl understands, which it then invokes with. All this happens in one step.

This is very convenient for running adhoc tests, especially where saucectl is not yet configured. The general idea is
that `saucewright` mimics (in terms of flags/args) the playwright CLI almost 1:1, so that the user has the least amount
of friction getting started with playwright on Sauce Labs.

We are actively looking for feedback and would love to [hear from you](https://github.com/saucelabs/saucewright/discussions)!

# TODO

This list is not exhaustive, but gives you an idea of what's still missing/possible.

- [ ] Allow user to select the playwright version (currently set to `1.27.1`)
- [ ] Allow user to select the platform (mac/win) (defaults to Windows 10)
- [ ] Add support for the other CLI native flags (run `npx saucewright test -h` to see what's implemented)
- [ ] Add support for browser == 'all'

## Requirements

- Node.js 16+
- Sauce Labs Account
- saucectl
- playwright

## Usage

```shell
Usage: saucewright test [options] [test-filter...]

Arguments:
  test-filter                  Pass arguments to filter test files. Each argument is treated as a regular expression.

Options:
  --browser <browser>          Browser to use for tests, one of "all", "chromium", "firefox" or "webkit" (default: "chromium").
  --headed                     Run tests in headed browsers (default: headless).
  -g, --grep <grep>            Only run tests matching this regular expression (default: ".*").
  -gv, --grep-invert <grep>    Only run tests that do not match this regular expression.
  --project <project-name...>  Only run tests from the specified list of projects (default: run all projects).
  -h, --help                   display help for command
```

### Setup Playwright Project

Execute the following commands in your playwright project. 

#### Install saucewright

```shell
npm i @saucelabs/saucewright
```

#### Install saucectl

Since `saucewright` requires `saucectl`:

```shell
npm i -g saucectl
```

#### Run Tests

```shell
npx saucewright test
```