@tracera/playwright
v1.3.1
Published
Playwright reporter and runtime for Tracera autotest
Maintainers
Readme
@tracera/playwright
Playwright reporter and runtime for Tracera autotest.
Requires Node.js ≥ 22.19 and Playwright ≥ 1.40.
npm install @tracera/playwrightHow-to: Playwright JS. Shared env / run mode: Autotest adapters.
Setup
// playwright.config.ts
import '@tracera/playwright/register';
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [['@tracera/playwright/reporter']],
use: {
video: 'retain-on-failure',
trace: 'retain-on-failure', // or "on-first-retry"
},
});import "@tracera/playwright/register" patches test.step and hooks so comment / error nest on the current step. Enable screenshot, video, and trace in config — Playwright artifacts attach to the Tracera result automatically. Retries: final attempt only; PLAYWRIGHT_RETRY on Env when retry > 0.
Bind
Import test / expect from @playwright/test, and tracera / annotations from this package. Prefer { annotation: annotations(id, name) }; or tracera.testCase in the body. Annotation names are literal (no {param}).
Skip
Use stock Playwright skip (test.skip, testInfo.skip(…)). The reason becomes a result comment.
Steps
test.step, or tracera.step(title, fn) / @tracera.step("open {path}") on class methods / tracera.step("…")(fn) wrap ({name} / {0} from args, or a title function). Stock beforeEach / afterEach → Setup / Teardown; beforeAll / afterAll are not reported.
Comments, errors, and attachments
tracera.comment / tracera.error / tracera.attachment — see Autotest adapters. Prefer testInfo.attach for extra files; screenshots, video, and Playwright trace from config attach on their own.
Parameterized
Loop or test.describe with a distinct id/name per row, or tracera.testCase in the body. Annotation names stay literal.
Custom fixtures
Extend Playwright fixtures as usual; call tracera APIs inside fixture setup/teardown that run per test.
