@testkase/playwright-reporter
v0.5.6
Published
Drop-in wrapper for running Playwright tests on the TestKase Automate Browser cloud grid. Zero customer code changes — your tests + playwright.config.ts stay 100% native Playwright; integration lives in testkase.yml + the testkase-playwright wrapper CLI.
Maintainers
Readme
@testkase/playwright-reporter
Drop-in integration for running existing Playwright tests on the
TestKase Automate Browser
cloud grid. Your test files + playwright.config.ts stay 100 %
native Playwright — integration lives in a testkase.yml file +
the testkase-playwright wrapper CLI.
Same shape as
@lambdatest/playwright-node-sdk
and
browserstack-node-sdk.
Install
npm install --save-dev @testkase/playwright-reporterSet up testkase.yml
In your project root:
# Required
user: [email protected]
accessKey: xyz_… # from Settings → Access Key on the dashboard
# Required — which browser to drive (matches a TestKase brand)
browserName: Chrome # Chrome | Firefox | MicrosoftEdge | pw-firefox | pw-webkit
# Optional
build: ci-${CI_BUILD_ID} # groups sessions on the dashboard
name: "checkout suite" # default session name
platformName: MacOS Sequoia # MacOS Sequoia | MacOS Tahoe
browserVersion: latest # omit → latest
headless: false
tags: [smoke, checkout]
# Capture flags — all default OFF. Enable per kind for sessions you want to debug.
recording: true
console: true
network: true
driver: trueRun
# Drop-in replacement for `npx playwright test`
npx testkase-playwright test
# All Playwright flags pass through
npx testkase-playwright test --project=chrome --grep=checkout --headedThat's it. Your test files stay unchanged:
// tests/checkout.spec.ts — 100 % native Playwright, no TestKase imports
import { test, expect } from "@playwright/test";
test("user can place an order", async ({ page }) => {
await test.step("login", async () => {
await page.goto("/login");
await page.fill("#email", "[email protected]");
await page.click("text=Sign in");
});
// …
});What lights up automatically:
- Test rail populates with
test.title/ pass-fail status per test - Test Output sub-tab gets one line per
test.step("label", …)call - Browser Console + Network capture on Chrome (CDP) AND Firefox (Playwright
page.on('console')/page.on('request')) - Recording + Driver logs as always
- Per-test MP4 slicing — fresh ffmpeg per test, finalized + uploaded at test end
All four kinds (console.jsonl.gz, network.har.jsonl.gz, driver.jsonl.gz, test-output.jsonl.gz) land on R2 at session end and render live during the run.
Multi-browser via Playwright's projects
// playwright.config.ts — purely native Playwright, no TestKase imports
import { defineConfig } from "@playwright/test";
export default defineConfig({
projects: [
{ name: "chrome", use: { browserName: "chromium" } },
{ name: "firefox", use: { browserName: "firefox" } },
],
});Run the same test file against both:
npx testkase-playwright test # both browsers
npx testkase-playwright test --project=firefox # oneThe wrapper picks the matching TestKase brand for each project (chromium → Chrome, firefox → Firefox).
Credentials via env vars (CI-friendly)
YAML values support env interpolation, and user / accessKey fall back to env vars:
# testkase.yml — commit-safe
build: ${BUILD:-local}
# user + accessKey fall back to TK_USERNAME + ACCESS_KEY env vars when omittedexport [email protected]
export ACCESS_KEY=xyz_…
export BUILD=ci-1234
npx testkase-playwright testAlternative: chromium.connect() style (no wrapper CLI)
If you can't run a wrapper CLI (locked-down CI, custom runners), you can connect to the TestKase hub directly. Capture coverage drops to what's available without our preload:
- Chrome / Edge: full coverage (Recording, Driver, Console, Network via server-side
cdp-tap) - Firefox: Recording + Driver only (Mozilla protocol doesn't allow a server-side 3rd-party tap)
- Test rail + Test Output: only if you manually emit
testkase_action:magic strings (see LambdaTest's Direct docs for the equivalent pattern)
import { chromium } from "@playwright/test";
import { tkWsEndpoint } from "@testkase/playwright-reporter";
// tkWsEndpoint is exported as a helper to build the wss:// URL with
// capabilities baked in — same caps the wrapper CLI sets via YAML.
const browser = await chromium.connect(
tkWsEndpoint({
name: "smoke",
browserName: "Chrome",
recording: true,
console: true,
network: true,
driver: true,
}),
);What gets installed
| File | Purpose |
|---|---|
| dist/cli.cjs | testkase-playwright bin |
| dist/preload.cjs | Loaded via NODE_OPTIONS=--require by the CLI; mutates @playwright/test cached exports |
| dist/index.{js,cjs,d.ts} | Direct API surface (tkWsEndpoint, attachTestkaseCapture, tklog, wrapped firefox/chromium/webkit, extended test) |
Peer dep: @playwright/test >= 1.10.0. Runtime dep: yaml.
Per-browser feature coverage
| Feature | Chrome | Edge | Firefox | |---|---|---|---| | Recording (MP4) | ✅ | ✅ | ✅ | | Driver logs | ✅ | ✅ | ✅ | | Browser Console | ✅ | ✅ | ✅ | | Network HAR | ✅ | ✅ | ✅ | | Test rail (name + status) | ✅ | ✅ | ✅ | | Test Output (step labels) | ✅ | ✅ | ✅ | | Per-test recording slicing | ✅ | ✅ | ✅ | | Commands tab | ✅ | ✅ | ✅ | | Live View (WebRTC) | ✅ | ✅ | ✅ |
License
MIT
