This repository provides a template for getting started with building a Playwright framework. It includes a pre-configured setup for writing, running, and managing end-to-end tests for web applications.
E-Commerce - Website
Postman collection. Import the downloaded JSON into Postman.
- TypeScript foundations and beyond.
- Playwright.
- Install Git
- For Windows - Install Git Bash
- For MacOS X
- Install brew by executing
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Install git -
brew install git
- Install brew by executing
- Install NodeJS >=18 - based on your platform
- Run
git clone- to clone the repo - Install Cursor an AI coding agent and open the cloned repo
- Install recommended VS code extensions
- Run
make setup- install all dependencies. - In folder 📁.env create
<env_file_name>.envfile containing variables of app which has to be maintained as a secret. Below is the example,BASE_URL=https://web-playground.ultralesson.com/account/login EMAIL=xxxx@gmail.com PASSWORD=Xxxx@xx24
Caution
Do not hardcode any sensitive information
ENV=<env_file_name> yarn playwright test <relative_path_to_test_file>
Warning
If using Windows, set IDE terminal to Git Bash and execute.
- Reporting: Utilized native playwright html report, view by executing
yarn playwright show-report. - Debugging: follow steps mentioned here.
Follow one of the below examples to configure CI.
- Jenkins - Create a pipeline as per required style, map the Jenkinsfile in build config.
- Github Actions - .yml will reflect automatically in Actions when pushed.
Important
Install all plugins for Jenkins mentioned in Jenkinsfile comments. Delete .yml if using different CI tool other than Github Actions.
- If you encounter any dependency issues, follow these steps:
- Delete the
node_modulesfolder and theyarn.lockfile. - Run
yarnto install the dependencies.
- Delete the
- In Windows
- if you get nodejs permission issue
- Navigate to
C:\Program Files\nodejs - Right click on
nodejsfolder and click on Properties - Go to Security tab and click Edit
- Click on Users(hostname of your PC) and check Full control permission for Allow
- Click on Apply and OK
- Navigate to
- if you get EPERM: operation not permitted" on Windows with npm
- Open
.npmrcfile by executingnpm config editin terminal or manually with any text editor. - Change
prefixvariable toC:\Users\<User Name>\AppData\Roaming\npm
- Open
- if you get nodejs permission issue
Tip
Upgrade playwright with yarn up @playwright/test
Set yarn latest stable version with yarn set version stable