@clawdtesting/sdk
v1.0.1
Published
TypeScript SDK for Visual Testing Platform - Integrate visual regression testing into your CI/CD pipeline
Maintainers
Readme
@clawdtesting/sdk
TypeScript/JavaScript SDK for Visual Testing Platform
Installation
npm install @clawdtesting/sdkQuick Start
import { ClawdTestClient } from '@clawdtesting/sdk';
const client = new ClawdTestClient({
apiUrl: 'https://your-instance.com',
apiKey: 'your-api-key',
projectId: 'your-project-id'
});
// Create a test session
const session = await client.createSession({
testName: 'Homepage Test',
browser: 'chrome',
viewport: { width: 1920, height: 1080 }
});
// Upload screenshot
const result = await client.uploadScreenshot(session.id, {
name: 'homepage-header',
imageBuffer: screenshotBuffer
});
// Complete session
await client.completeSession(session.id);API Reference
Client Configuration
interface ClientConfig {
apiUrl: string; // ClawdTest Platform URL
apiKey: string; // Your API key
projectId: string; // Project ID
timeout?: number; // Request timeout (default: 30000ms)
debug?: boolean; // Enable debug logging
}Methods
createSession(config: SessionConfig): Promise<Session>
Create a new test session.
uploadScreenshot(sessionId: string, config: ScreenshotConfig): Promise<ComparisonResult>
Upload a screenshot and perform visual comparison.
completeSession(sessionId: string, status?: 'passed' | 'failed'): Promise<Session>
Mark a session as complete.
getSession(sessionId: string): Promise<Session>
Get session details.
getScreenshots(sessionId: string): Promise<Screenshot[]>
Get all screenshots for a session.
acceptScreenshot(screenshotId: string): Promise<Baseline>
Accept a screenshot as new baseline.
getBaselines(config?: BaselineConfig): Promise<Baseline[]>
Get baselines for the project.
waitForCompletion(sessionId: string, options?: WaitOptions): Promise<Session>
Wait for a session to complete (useful in CI/CD).
Examples
See /examples directory for:
- Playwright integration
- Puppeteer integration
- CI/CD configurations
- Webhook handlers
License
MIT
