@webtestingsuite/client
v1.0.1
Published
Client for the Web Testing Suite public API (shared by the CLI and the GitHub Action)
Readme
@webtestingsuite/client
Small, zero-dependency JavaScript client for the Web Testing Suite public API (/api/v1).
Uses the global fetch. No dependencies.
Installation
npm install @webtestingsuite/clientUsage
import { WtsClient } from '@webtestingsuite/client';
const client = new WtsClient({
baseUrl: 'https://webtestingsuite.com',
apiKey: process.env.WTS_API_KEY,
});
// Start a test run
const run = await client.createRun({
url: 'https://example.com',
level: 'quick',
});
console.log('Started run:', run.scanId);
// Wait for it with automatic ETag polling & backoff
const result = await client.waitForRun(run.scanId);
console.log('Finished status:', result.status);
// Fetch the report with gate thresholds
const summary = await client.getReport(run.scanId, {
format: 'summary',
failUnder: 80,
failOn: 'critical',
minCoverage: 50, // fail if under half of the pages found were tested
});
console.log(summary); // summary.coverage: level, pages scanned / remaining, notes, canContinue
// A plan's page limit can leave pages untested (Pro and above; counts against the quota)
if (JSON.parse(summary).data.coverage?.canContinue) await client.continueRun(run.scanId);createScan, waitForScan and continueScan are the same methods under their old names.
Projects, suites, schedules and monitors
const [project] = await client.listProjects(); // scope project:read
await client.putSuites(project.id, { journeys: [/* … */] }); // suite:write; getSuites reads them
await client.putSchedule(project.id, { enabled: true, schedule: { frequency: 'daily', hour: 6, minute: 0, timezone: 'UTC' } }); // schedule:write, Pro and above
const { monitors } = await client.listMonitors(project.id); // monitor:read
await client.createMonitor(project.id, { kind: 'uptime', name: 'Home', url: 'https://example.com/', intervalMin: 15 }); // monitor:writeShared by @webtestingsuite/cli and ProzenTechnologies/webtestingsuite-github-action.
License
Commercial software. Copyright (c) 2026 Prozen Technologies OPC Pvt Ltd. All rights reserved. Web Testing Suite is a product of Prozen Technologies OPC Pvt Ltd. Use is governed by the LICENSE file included with this package and the Terms of Service.
