@testlease/playwright
v0.4.0
Published
Playwright fixtures for TestLease: worker- and test-scoped exclusive resources with heartbeat, release and sanitized evidence
Maintainers
Readme
@testlease/playwright
Playwright fixtures for TestLease: each worker (or each
test) receives an exclusive, heartbeated lease on a shared test resource and returns it
automatically. Every test gets a sanitized testlease.json attachment.
import { test as base } from '@playwright/test';
import { withTestLease } from '@testlease/playwright';
export const test = withTestLease(base, {
client: { baseUrl: process.env.TESTLEASE_URL!, token: process.env.TESTLEASE_TOKEN },
fixtures: {
buyer: { pool: 'premium-buyers', scope: 'worker', tags: { region: 'nl' } },
scratchTenant: { pool: 'tenants', scope: 'test', secrets: false },
},
});
test('checkout', async ({ page, buyer }) => {
await login(page, { email: buyer.metadata.email as string, password: buyer.secret('password') });
// …
if (broken) await buyer.quarantine('account locked'); // next test in this worker gets a replacement
});- Owner:
<run id>/<project>/worker-<parallelIndex>(callensureRunId()inplaywright.config.tsso every worker shares the run id). A replacement worker after a crash takes over the previous lease via the idempotent request id. - A worker that is killed never releases; the server-side TTL frees the resource.
- Default
waitTimeoutMsis 60 s;heartbeat,evidenceandrunIdare configurable. - Requires
@playwright/test >= 1.40.
Guide: https://github.com/testlease/testlease/blob/main/docs/playwright.md
