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

1.0.0 • Public • Published

@saucelabs/testcomposer

Sauce Labs SDK for the Test-Composer API.

Usage

Create Reports

const {Region, 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`}
});

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

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

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`}
});

const s = new Readable();
s.push('hello!');
s.push(null);

const uploads = await client.uploadAssets(job.id, [{filename: "console.log", data: s}]);
// Upon success, the array `uploads.uploaded` will equal in length to the number of assets you intended to upload.
// Individual assets that fail to upload will be reported via `uploads.errors`.

Keywords

none

Install

npm i @saucelabs/testcomposer

DownloadsWeekly Downloads

1,129

Version

1.0.0

License

Apache-2.0

Unpacked Size

18.8 kB

Total Files

6

Last publish

Collaborators

  • anish.mehta
  • mubeshgiri
  • christina.tonkonogaya
  • ashley.bell
  • piyushgupte
  • joaquin.hurtado
  • webdev-saucelabs
  • gracjan.grala
  • david.missmann
  • thomas.fett
  • aluedeke_sauce
  • wswebcreation-nl
  • pawel-sauce
  • nick.sauce
  • diego.molina
  • sakhi-sl
  • navrajsingh
  • it10403npm
  • rillgen-saucelabs
  • wathiq.abumaali
  • saucebot
  • krzysztof.sulejczak.sauce
  • josh.obrien