@saucelabs/testcomposer
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

@saucelabs/testcomposer

Sauce Labs SDK for the Test-Composer API.

Usage

Initialize TestComposer Client

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

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.

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: Guide on generating reports for Cypress, Playwright, and TestCafe.

Selenium: Guide on generating Selenium reports.

Espresso: Guide on generating Espresso reports.

XCUITest: Guide on generating XCUITest reports.

Readme

Keywords

none

Package Sidebar

Install

npm i @saucelabs/testcomposer

Weekly Downloads

23,812

Version

3.0.0

License

Apache-2.0

Unpacked Size

20 kB

Total Files

6

Last publish

Collaborators

  • william.nunes-sl
  • christina.tonkonogaya
  • joaquin.hurtado
  • webdev-saucelabs
  • gracjan.grala
  • david.missmann
  • thomas.fett
  • aluedeke_sauce
  • pawel-sauce
  • nick.sauce
  • diego.molina
  • sakhi-sl
  • navrajsingh
  • it10403npm
  • rillgen-saucelabs
  • saucebot
  • krzysztof.sulejczak.sauce