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
- Yarn
- pnpm
npm init playwright@latest
yarn create playwright
pnpm create playwright
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
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
- Yarn
- pnpm
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
yarn add --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
pnpm add --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:
@serenity-js/core@serenity-js/console-reporter@serenity-js/playwright@serenity-js/playwright-test@serenity-js/rest@serenity-js/web@serenity-js/serenity-bdd
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.