Skip to main content

Installation

To use Serenity/JS with Playwright Test, follow the Serenity/JS installation guide to set up your development environment and core runtime dependencies. Then, create a new Playwright Test project or add Serenity/JS integration and reporting modules to an existing project.

Initialising a Playwright Test projectโ€‹

If you already have a Playwright Test project, skip this step and proceed to installing Serenity/JS.

To create a new Playwright Test project, follow the Playwright Test installation instructions and run the following command:

npm init playwright@latest

Expected output (example):

Getting started with writing end-to-end tests with Playwright:
Initialising project in '.'
โœ” Do you want to use TypeScript or JavaScript? ยท TypeScript
โœ” Where to put your end-to-end tests? ยท tests
โœ” Add a GitHub Actions workflow? (y/N) ยท false
โœ” Install Playwright browsers (can be done manually via 'npx playwright install')? (Y/n) ยท true
TypeScript or JavaScript?

Using TypeScript improves code completion support in JetBrains IDEs and Visual Studio Code, reducing common coding errors.

Installing Serenity/JSโ€‹

To add Serenity/JS to a Playwright Test project, install the following modules:

npm install --save-dev @serenity-js/core @serenity-js/console-reporter @serenity-js/playwright @serenity-js/playwright-test @serenity-js/rest @serenity-js/web @serenity-js/serenity-bdd

This command installs:

To ensure that your version of Playwright Test is compatible with the latest version of Serenity/JS, check the Serenity/JS releases and compatibility page.

What you learntโ€‹

  • Initialise a Playwright Test project with npm init playwright@latest.
  • Install Serenity/JS modules (@serenity-js/core, @serenity-js/playwright-test, etc.) as dev dependencies.
  • Check the releases page for version compatibility.

Next stepโ€‹

Once you've installed the dependencies, proceed to configuring Serenity/JS reporting.