This repository provides a comprehensive guide to writing end-to-end tests with Playwright, covering a wide range of scenarios to ensure your application is robust and reliable. Learn how to write tests for Authentication, Search, Sorting, API and API mocking, ARIA snapshots, and more.
The source code is a demo Movies App built with Next.js and React, utilizing the The Movie Database (TMDB) API for testing purposes. This project is a fork of next-movies and has been customized to meet our specific requirements.
Clone the repository and then install the dependencies:
git clone https://github.com/debs-obrien/playwright-movies-app.git
cd playwright-movies-app
npm install
To run the login tests, you need to set up environment variables in a .env
file. You can do this by renaming the .env.example
file to .env
, which already contains the necessary variables. Note that this app uses a mock backend, so any username and password will work.
Run the tests using UI mode to walk through a trace of each test:
npx playwright test --ui
Alternatively, you can run the tests directly in VS Code with the Playwright VS Code extension.
Make sure port 3000 is available as the app needs to run on this port. Using a different port will result in errors because the movies loaded from the API use this port.
npm run dev
: dev buildnpm run build
: production buildnpm run start
: start the project
Check out the wiki for more info on the contents of each folder.