0.2.1 • Published 9 months ago

@tracetest/playwright v0.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@tracetest/playwright

NPM Published Version

About

This module provides a way to enhance your existing Playwright E2E tests with trace-based testing. It allows you to create, run, and orchestrate Tracetest Tests based on your existing Playwright scripts with minimal configuration and code.

To find a detailed step-by-step tutorial on how to use this module head out to the main integration page in our docs.

Usage

Import and Create the Tracetest Instance

import Tracetest, { Types } from '@tracetest/playwright';

const { TRACETEST_API_TOKEN = '' } = process.env;

let tracetest: Types.TracetestPlaywright | undefined = undefined;

test.beforeAll(async () => {
  tracetest = await Tracetest({ apiToken: TRACETEST_API_TOKEN });
});

Follow the guide in the Tracetest documentation website to generate the TRACETEST_API_TOKEN

Capture the Tracetest Parent for the Current Test

test.beforeEach(async ({ page, context }, { title }) => {
  await tracetest?.capture({title, page, context});
  await page.goto('/');
});

Wait for the Trace-Based Tests to Complete

// Optional: You can add this to the code to fail the execution based on the trace-based tests results
test.afterAll(async ({}, testInfo) => {
  testInfo.setTimeout(80000);
  await tracetest?.summary();
});

Output

> pokeshop@1.0.0 pw:run
> playwright test


Running 1 test using 1 worker
[chromium] › home.spec.ts:53:5 › Playwright: imports a pokemon
Test `Playwright: imports a pokemon` started
Find the results at https://app.tracetest.io/organizations/ttorg_ced62e34638d965e/environments/ttenv_b42fa137465c6e04/test/UGxheXdyaWdodDogaW1wb3J0cyBhIHBva2Vtb24=/run/73
Test `Playwright: imports a pokemon` finished

Successful: 1
Failed: 0

[SUCCESSFUL - FINISHED] Playwright: imports a pokemon - https://app.tracetest.io/organizations/ttorg_ced62e34638d965e/environments/ttenv_b42fa137465c6e04/test/UGxheXdyaWdodDogaW1wb3J0cyBhIHBva2Vtb24=/run/73

  1 passed (19.5s)

To open last HTML report run:

  npx playwright show-report

Useful Links

0.2.1

9 months ago

0.1.34

10 months ago

0.1.35

10 months ago

0.2.0

9 months ago

0.0.40

1 year ago

0.0.41

1 year ago

0.1.32

10 months ago

0.1.33

10 months ago

0.0.38

1 year ago

0.0.39

1 year ago

0.1.0

12 months ago

0.0.37

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.24

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.20-alpha.0

1 year ago

0.0.19

1 year ago