super-api-playwright-tester
v1.0.0
Published
Unified E2E framework combining Playwright UI automation with hyper-fast super-api-tester contract assertions.
Readme
super-api-playwright-tester 🎭🚀
A unified, high-performance E2E testing wrapper that combines the lightning-fast API contract assertions of super-api-tester with the robust browser automation layers of Playwright.
Bypass slow UI forms by seeding your test environments and verifying backend contracts using ultra-fast Undici HTTP requests, then instantly dive into native browser testing—all from within a single, elegant test suite runner.
Features
- Unified Imports: Get your custom API engine (
superApi), assertions (expect), and runtime schemas (s) directly from a single import stream. - Blistering Fast Setup: Avoid UI login bloat. Use the API runner to seed test environments or grab authorization keys in milliseconds before launching a browser context.
- Strict Type Safety: Fully integrated with Zod via the
sshorthand object for strict backend runtime validations. - Native Playwright Integration: Works perfectly with Playwright's parallel execution engine, trace viewers, HTML reports, and CI configurations.
Installation
Install the wrapper alongside Playwright's browser binaries in your project repository:
npm install -D super-api-playwright-tester
npx playwright install
Getting Started
Because this package extends Playwright's core testing runner using custom fixtures, you can jump straight into writing your hybrid E2E workflows without any extra wrapper architecture files.
Basic Example (tests/hybrid-demo.spec.ts)
TypeScript
import { test, expect, s } from 'super-api-playwright-tester';
// 1. Define your strict backend payload contract
const UserProfileBlueprint = s.object({
id: s.number(),
username: s.string(),
role: s.string(),
});
test('Hybrid Flow: Seed data via fast API context, then verify Web UI', async ({ page, superApi }) => {
// Phase 1: High-speed contract verification (Bypasses browser layers)
const apiResponse = await superApi.post('/api/users/setup', {
body: { username: 'qa_lead_automation', role: 'admin' }
});
// Fluid assertion chains from super-api-tester
apiResponse
.expectStatus(201)
.expectSchema(UserProfileBlueprint);
const verifiedUser = apiResponse.body;
// Phase 2: Instant front-end UI assertion using Playwright
await page.goto(`https://your-platform-domain.com/profile/${verifiedUser.id}`);
// Standard native Playwright UI verification
const profileHeader = page.locator('h1.user-heading');
await expect(profileHeader).toHaveText('Welcome back, qa_lead_automation!');
});