Welcome! In this session you'll be writing a small automated test suite for a demo e-commerce site using Playwright with JavaScript. We're not looking for perfection — we're interested in how you think and work through problems. Please talk us through your decisions as you go.
Please note, the playwright UI runner wont be available for this task.
Duration: 45–60 minutes
Site under test: https://saucedemo.com
Use these accounts in your tests:
| Username | Password | Notes |
|---|---|---|
standard_user |
secret_sauce |
Default valid user |
locked_out_user |
secret_sauce |
Should be blocked from login |
problem_user |
secret_sauce |
Bonus: has intentional UI quirks |
Work through the steps below in order. We'll stop at natural checkpoints, so don't worry if you don't reach the end — seeing your approach at any stage is valuable.
Update the playwright config baseURL so that its taken from an .env file.
Update the login.spec.js file accordingly
Login Test - Should successfully log in
Login Test - Should successfully log in - additional test
Login Test - Should show error message for invalid login
Write a test that:
- Logs in as
standard_user - Adds a product to the cart
- Asserts the cart badge updates to show the correct item count
/
├── pages/ # Page Object data go here
├── tests/ # Test files go here
├── playwright.config.js
├── package.json
└── README.md
Good luck, and feel free to ask if anything is unclear!