# @saucelabs/testcomposer

> Sauce Labs SDK for the Test-Composer API

Latest version **3.0.2** (published 2024-10-22) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @saucelabs/testcomposer
pnpm add @saucelabs/testcomposer
yarn add @saucelabs/testcomposer
bun add @saucelabs/testcomposer
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2024-10-22 |
| First published | 2022-10-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18.0.0 |
| Dependencies | 1 |
| Unpacked size | 19.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | devx |
| Maintainers | christina.tonkonogaya, joaquin.hurtado, webdev-saucelabs, gracjan.grala, david.missmann, thomas.fett, pawel-sauce, diego.molina, sakhi-sl, navrajsingh, it10403npm, rillgen-saucelabs, saucebot, krzysztof.sulejczak.sauce |

## Links

- npm: https://www.npmjs.com/package/@saucelabs/testcomposer
- Repository: https://github.com/saucelabs/node-testcomposer
- Homepage: https://github.com/saucelabs/node-testcomposer#readme
- Issues: https://github.com/saucelabs/node-testcomposer/issues
- npm.io page: https://npm.io/package/@saucelabs/testcomposer

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.7.5

## Recent versions

- 3.0.2 (latest) — 2024-10-22
- 3.0.1 — 2024-08-29
- 3.0.0 — 2024-06-06
- 2.0.1 — 2024-04-04
- 2.0.0 — 2023-10-10
- 1.2.1 — 2023-08-24
- 1.2.0 — 2023-08-22
- 1.1.0 — 2023-07-11
- 1.0.0 — 2022-10-21
- 0.1.0 — 2022-10-06

## README

# @saucelabs/testcomposer

Sauce Labs SDK for the Test-Composer API.

# Usage

## Initialize TestComposer Client

```javascript
const { TestComposer } = require('@saucelabs/testcomposer');

const client = new TestComposer({
  region: 'us-west-1',
  username: process.env.SAUCE_USERNAME,
  accessKey: process.env.SAUCE_ACCESS_KEY,
  headers: { 'User-Agent': `your-fancy-reporter/1.2.3` },
});
```

## Create Reports

```javascript
const job = await client.createReport({
  name: 'My Fancy Job!',
  passed: true,
  startTime: new Date().toISOString(),
  endTime: new Date().toISOString(),
  browserName: 'Chrome',
  browserVersion: '105',
  framework: 'playwright',
  frameworkVersion: '1.25.0',
  platformName: 'Windows 11',
});
console.log(job.id); // the job ID
console.log(job.url); // the full URL of the job
```

## Upload Assets

You can upload assets to your job using the `uploadAssets` method. By uploading assets, you can include relevant files or resources that are associated with your job, such as log files, screenshots, or other supporting documentation. These assets will be accessible and viewable in the Sauce Labs web UI.

```javascript
const Readable = require('stream').Readable;

const s = new Readable();
s.push('hello!');
s.push(null);
const uploads = await client.uploadAssets(job.id, [
  { filename: 'console.log', data: s },
]);
```

## Explore More Examples

Refer to the following examples for specific frameworks:

[JavaScript Frameworks](./docs/javascript_frameworks.md): Guide on generating reports for Cypress, Playwright, and TestCafe.

[Selenium](./docs/selenium.md): Guide on generating Selenium reports.

[Espresso](./docs/espresso.md): Guide on generating Espresso reports.

[XCUITest](./docs/xcuitest.md): Guide on generating XCUITest reports.

---
_Source: https://npm.io/package/@saucelabs/testcomposer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
