Skip to content

PushkarajAwad2/jest-playwright-junit-demo

Repository files navigation

try-jest-playwright

Example test suite with Playwright and Jest with jest-playwright-preset to configure the Jest environment for browser tests. The example uses Visual Studio Codespaces but can be extended to work with any web app with authentication.

Features

  • Isolated context per test: Uses context global which is an isolated browser context per test.
  • Screenshots on failure: Auto-capture screenshots of failed test pages (in the screenshots directory).
  • Login only once: Uses globalSetup in Jest config to setup a one-time login which is then re-used in tests.
  • TypeScript support

Usage

Install dependencies

npm install

Note: Running tests requires test account credentials set as USER and PASSWORD environment variables.

Run all tests in headless mode.

npm test # or npx jest

Run all tests in a particular browser and headful mode.

HEADLESS=false BROWSER=chromium npm test

Run single test by spec name (see other options in Jest CLI config).

BROWSER=chromium npx jest -t "should be logged in"

Future work

  • Add support for using the VS Code debugger
  • Add support for junit reports
  • Replace environment variables with something more cross-platform

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published