-
Book Overview & Buying
-
Table Of Contents
Hands-On Automated Testing with Playwright
By :
In this section, we’ll lay the groundwork for a smooth testing process by initializing the project and managing authentication with storage states.
The first step is to create a dedicated directory for the project and initialize a Playwright project:
mkdir ecom-test-project
cd ecom-test-project
npm init playwright@latest
This command makes a new folder called ecom-test-project and sets up a new Playwright project inside it with a starter template. When running the npm init playwright@latest command, you will be presented with a series of questions to build out the initial scaffolding of a project. We’ll choose TypeScript for our language, we’ll set tests as our end-to-end tests folder, and skip adding a GitHub Actions file for now. You will also have a chance here to install the Playwright browsers.
You can verify installation by running the --version flag to confirm the installed version:
npx playwright --version...