This repo shows how to test a complete shopper journey with Playwright and TypeScript, from signup and login to cart, checkout, orders, wishlist, reviews, and contact forms.
π Auth Β· π€ Profile Β· π Cart Β· π³ Checkout Β· π¦ Orders Β· π Wishlist Β· β Reviews Β· π© Contact
Demo site: storedemo.testdino.com
This is a sample Playwright + TypeScript end-to-end test project for the TestDino Ecommerce Demo Store.
It is meant to help developers understand how a real Playwright test suite can be organized. The tests use page objects, shared fixtures, environment variables, CI sharding, Playwright reports, and optional TestDino report uploads.
This is not an ecommerce app. There is no frontend or backend to run here. The tests run against the hosted demo store.
This repo is useful if you want to:
- Learn how to structure Playwright tests with TypeScript
- See a clean Page Object Model setup
- Test real ecommerce user flows end to end
- Understand how Playwright reports work
- Run tests locally and in GitHub Actions
- Upload Playwright results to TestDino
- Give AI coding tools clear project instructions through
AGENTS.md
The test suite covers the main flows a shopper would use in an ecommerce store:
- Sign up for a new account
- Sign in and sign out
- Change password
- Update profile information
- Add, edit, and delete addresses
- Search products
- Filter products by price
- Open product details
- Add products to the cart
- Remove products from the cart
- Update cart quantity
- Place an order
- View order details
- Cancel an order
- Add products to the wishlist
- Move wishlist items to the cart
- Write, edit, and delete product reviews
- Submit the Contact Us form
| Area | Used in this repo |
|---|---|
| Test runner | Playwright Test |
| Language | TypeScript |
| Runtime | Node.js 18+ |
| Module system | ESM |
| Browser | Chromium |
| Test structure | Page Object Model + custom fixtures |
| Environment config | dotenv |
| CI | GitHub Actions |
| Reports | Playwright HTML, JSON, and Blob reports |
| Cloud reporting | TestDino using tdpw |
| AI guidance | AGENTS.md and TestDino Playwright Skill |
.
βββ pages/
β βββ BasePage.ts
β βββ AllPages.ts
β βββ LoginPage.ts
β βββ SignupPage.ts
β βββ HomePage.ts
β βββ InventoryPage.ts
β βββ AllProductsPage.ts
β βββ ProductDetailsPage.ts
β βββ CartPage.ts
β βββ CheckoutPage.ts
β βββ OrderDetailsPage.ts
β βββ OrderPage.ts
β βββ UserPage.ts
β βββ ContactUsPage.ts
βββ tests/
β βββ fixtures.ts
β βββ ecommerce.spec.ts
βββ .agents/
β βββ skills/
β βββ playwright-skill/
βββ .github/
β βββ workflows/
β βββ test.yml
βββ .env.example
βββ AGENTS.md
βββ CONTRIBUTING.md
βββ playwright.config.ts
βββ package.json
βββ tsconfig.json
Before running the tests, make sure you have:
- Node.js 18 or later
- npm
Clone the repo:
git clone https://github.com/testdino-hq/playwright-sample-tests-typescript.git
cd playwright-sample-tests-typescriptInstall dependencies:
npm installInstall Playwright browsers:
npm run install:browsersCreate a local environment file:
cp .env.example .envThen open .env and add the required test credentials and test data.
The tests use environment variables for login credentials and checkout address data.
Use .env.example as the reference.
| Variable | What it is used for |
|---|---|
USERNAME |
Main test user email |
PASSWORD |
Main test user password |
USERNAME1 |
Secondary test user email |
NEW_PASSWORD |
Password used in password-change tests |
S_FIRST_NAME |
Shipping first name |
S_LAST_NAME |
Shipping last name |
S_ADDRESS |
Shipping address |
S_COUNTRY |
Shipping country |
S_STATE |
Shipping state |
S_CITY |
Shipping city |
S_ZIP_CODE |
Shipping ZIP or postal code |
S_MOBILE_NUMBER |
Shipping phone number |
TESTDINO_TOKEN |
Optional token for uploading reports to TestDino |
Do not commit your .env file. It may contain private credentials.
Run all tests:
npm testRun tests with the browser visible:
npm run test:headedOpen Playwright UI mode:
npm run test:uiDebug tests with Playwright Inspector:
npm run test:debugOpen the latest HTML report:
npm run test:reportGenerate a new test with Playwright codegen:
npm run codegenRun a specific spec file:
npx playwright test tests/ecommerce.spec.tsRun tests by title:
npx playwright test -g "user can login and logout"The project uses the Page Object Model.
Page objects are stored in the pages/ folder. Each page object keeps the locators and actions for one page or feature area. This keeps the test files easier to read and avoids repeating selectors across tests.
AllPages.ts creates one typed place to access all page objects. The custom fixture in tests/fixtures.ts makes that available inside every test as allPages.
Example:
import { expect, test } from './fixtures.js';
test('shopper can place an order', async ({ allPages }) => {
await allPages.loginPage.login(process.env.USERNAME!, process.env.PASSWORD!);
await allPages.inventoryPage.searchProduct('GoPro HERO10 Black');
await allPages.cartPage.clickOnCheckoutButton();
await allPages.checkoutPage.clickOnPlaceOrderButton();
await expect(allPages.orderDetailsPage.orderConfirmationMessage).toBeVisible();
});The test reads like a user journey, while the detailed selectors stay inside the page objects.
This project uses native ESM with TypeScript.
For local file imports, use .js extensions even when the source file is TypeScript.
Correct:
import AllPages from '../pages/AllPages.js';Incorrect:
import AllPages from '../pages/AllPages';This is required because the TypeScript files are compiled to JavaScript before running.
Playwright creates test reports after a run.
This repo is configured to generate:
- HTML report
- JSON report
- Blob report
Open the local HTML report:
npm run test:reportThe HTML report is useful when you want to inspect failed tests, screenshots, traces, and step details locally.
Uploading to TestDino is optional.
You can run the tests locally without a TestDino token. Use TestDino when you want shared reporting, test history, trend analysis, and better visibility for your team.
Upload a report manually:
npx tdpw upload ./playwright-report --token="YOUR_TESTDINO_TOKEN" --upload-htmlOr use the npm script:
TESTDINO_TOKEN="YOUR_TESTDINO_TOKEN" npm run report:uploadIn CI, store TESTDINO_TOKEN as a GitHub Actions secret.
This repo includes a GitHub Actions workflow for running the tests in CI.
The workflow is designed for larger Playwright projects. It runs tests in shards, saves the Blob reports, merges them, generates the final report, and uploads the results to TestDino.
Typical CI flow:
- Install dependencies
- Install Playwright browsers
- Run tests in shards
- Upload Blob reports from each shard
- Merge reports
- Generate the final Playwright report
- Upload results to TestDino
This repo includes AGENTS.md.
That file gives AI coding tools clear instructions about the project structure, commands, conventions, imports, fixtures, page objects, and common mistakes.
It is useful when working with tools like:
- Claude Code
- Cursor
- Windsurf
- GitHub Copilot
The repo also includes the TestDino Playwright Skill here:
.agents/skills/playwright-skill/
The skill contains Playwright best practices for locators, assertions, fixtures, Page Object Model, CI, debugging, and reporting.
To install the TestDino Playwright Skill in another project:
npx skills add testdino-hq/playwright-skillnpm install
npm run install:browsers
cp .env.example .env
npm testnpm run test:debugOr debug one test by title:
npx playwright test -g "test title here" --debugnpm run test:reportTESTDINO_TOKEN="YOUR_TESTDINO_TOKEN" npm run report:uploadRun:
npm run install:browsersIf you are running tests in Linux CI, install browser dependencies too:
npx playwright install --with-deps chromiumCheck that:
.envexists- Required values are filled in
- The test account exists on the demo store
- The password is correct
- The
.envfile was not accidentally committed or ignored incorrectly
Check that:
- GitHub Actions secrets are configured
- CI has all required environment variables
- The demo store is reachable from GitHub Actions
- Browser dependencies are installed in CI
- Blob reports are being uploaded and merged correctly
Check that:
TESTDINO_TOKENis set- The token is valid
- The Playwright report was generated
- The upload path points to
./playwright-report - HTML and JSON reporters are enabled in
playwright.config.ts
Check your relative imports.
This project uses ESM, so local imports should include .js extensions.
Correct:
import LoginPage from '../pages/LoginPage.js';Incorrect:
import LoginPage from '../pages/LoginPage';Issues and pull requests are welcome.
Before opening a pull request, run:
npm testAlso review:
CONTRIBUTING.mdAGENTS.md
Keep changes focused. Avoid mixing unrelated refactors with test changes.
- TestDino: https://testdino.com
- TestDino app: https://app.testdino.com
- TestDino Playwright Skill: https://github.com/testdino-hq/playwright-skill
- Playwright docs: https://playwright.dev/docs/intro
- Playwright browsers: https://playwright.dev/docs/browsers
MIT