Playwright automation testing: what to test first on a web app or online store
Playwright automation for web apps and online stores: the first ten tests to ask for, where testing should stop and how to avoid flaky test suites.
By Rokibul Hasan8 min read
- Testing
- Automation

A small change to the cart goes live on Friday. Nothing looks wrong. The first sign of trouble is a quiet weekend in the orders report. Playwright automation exists to catch that before your customers do: a script opens a real browser, does what a shopper would do and fails loudly if the result is wrong.
This guide is for founders and product people paying for a web app or online store and wondering whether end-to-end tests are worth it. It gives you the first ten tests to ask for, shows where testing should stop, and explains how to avoid a suite nobody trusts.
You will not find advice to test everything here. End-to-end tests are slow to run and take time to maintain, so the skill lies in choosing a few that protect revenue and trust.
What Playwright automation does
Playwright is a free, open-source testing framework from Microsoft, under the Apache 2.0 licence. The current release is 1.64. It drives Chromium, Firefox and WebKit, the engine behind Safari, on Windows, Linux and macOS, and developers can write tests in TypeScript, JavaScript, Python, Java or .NET.
A test reads like instructions to a careful new employee: open this page, click the button labelled "Add to cart", check that the cart shows one mug.
What this buys you is the freedom to change the product without re-checking every flow by hand. Manual checks get skipped as a product grows and deadlines tighten. A test that runs on every change does not get tired.
Two limits are worth knowing early. Playwright can emulate a phone's browser by simulating screen size, touch and user agent, but that is not a real phone, and it is not built for native iOS or Android apps. For those, see my guide to mobile automation testing. It is also not a load-testing tool.
How to choose what to test
Ask three questions about each flow in your product:
- If this broke tonight, how long before we noticed?
- What would each hour of that cost in sales or trust?
- How often does the code around it change?
Add to cart scores high on all three. A footer link scores low on all three. A password reset sits in the middle: rarely used, but when it breaks, someone is locked out and writing to support.
The first ten Playwright tests to ask for
| # | Test | Why it earns a place |
|---|---|---|
| 1 | Product page to cart, with the right item and price | Every sale takes this path |
| 2 | Cart to checkout, with the right total | A failure here loses orders without any error on your screen |
| 3 | Discount codes: a valid one applies, an expired one explains why | Promotions bring your busiest days |
| 4 | Search and filters find a known product | Shoppers cannot buy what they cannot find |
| 5 | A sold-out product cannot be bought | Overselling turns a sale into a refund and a complaint |
| 6 | Tests 1 and 2 again on an emulated phone | Layout bugs often appear only at small widths |
| 7 | Sign-up and sign-in, including a wrong password | Nothing else works without them |
| 8 | The core job of the product, start to finish | This is the one job people came for |
| 9 | One user cannot open another's record by changing the URL | A privacy failure costs more than any visual bug |
| 10 | After a simulated payment the account shows the right plan; after a simulated decline it shows a clear error | Money and access have to agree |
Tests 1 to 6 suit a store, and 7 to 10 suit a web app. Most products need a mix. If you run a Shopify theme or app with custom storefront code, add a test that your block appears where merchants place it.
Here are tests 1 and 2 as code:
import { test, expect } from '@playwright/test';
test('a shopper can add a product and reach checkout', async ({ page }) => {
await page.goto('/products/blue-mug');
await page.getByRole('button', { name: 'Add to cart' }).click();
await expect(page.getByText('Added to cart')).toBeVisible();
await page.goto('/cart');
await expect(page.getByRole('link', { name: 'Blue mug' })).toBeVisible();
await page.getByRole('button', { name: 'Check out' }).click();
await expect(page).toHaveURL(/checkout/);
});
Notice what it does not mention: no CSS classes and no page structure. It finds things by role and visible name, the way a person would, which is what Playwright's best practices recommend, so a redesign is less likely to break it. Each expect keeps checking until the condition is met or the time limit runs out, so there are no fixed pauses.
Where testing should stop
Playwright's guidance on third parties is short: "Only test what you control." External services should be mocked, so a test does not depend on someone else's system being up. This matters most at the point where money changes hands.
Stripe. Stripe's documentation says front-end interfaces such as Checkout and the Payment Element "have security measures in place that prevent automated testing", and its APIs are rate limited. So do not script the card form. Stripe's advice is to simulate its responses with mock data, then test how your app reacts: the success page, the decline message, the state of the account.
Shopify. Checkout is Shopify's code, and keeping it working is Shopify's job. Test up to the handoff, as the example above does. For a full order, Shopify's test order guide describes its Test payment gateway and Shopify Payments test mode. Use them on a development store, because customers cannot place live orders while a provider is in test mode.
Everything else. Email delivery, shipping rates and analytics scripts can all be mocked. A test that fails because a carrier's sandbox is down teaches you nothing about your own code.
Run the suite against a staging site with fake data. If you add a check against the live site, keep it read-only: load the home page, open a product and stop before anything is written.
Flaky tests decide whether the suite survives
A flaky test fails sometimes for no real reason. After a few false alarms people stop reading the results, and at that point the suite is worth nothing. Playwright sorts results into passed, flaky (failed, then passed on retry) and failed, which gives you a list to work through.
The usual causes and fixes:
- Tests sharing data. One test deletes the product another needs. Give each test its own data and sign-in state.
- Fixed waits. A two-second pause is too long on a good day and too short on a bad one. Wait for the condition instead.
- Fragile selectors. CSS classes change with a redesign. Roles and visible text change less often.
Retries absorb noise, and they also hide it. A retry or two in CI is reasonable. A test that needs one every week is a bug report nobody has opened.
Running Playwright automation on every change
Playwright automation only protects you if it runs without anyone remembering. Playwright's installer can add a GitHub Actions workflow that runs the suite on each push and pull request and uploads an HTML report. Failed runs can include a trace, a step-by-step record of what the browser did, so a developer can see what happened without reproducing it.
Two housekeeping points from the docs. Reports and traces can contain sensitive data, so keep them in a trusted store. The file that holds a saved sign-in must stay out of Git.
AI test agents, with a person reading the output
Since version 1.56 Playwright has shipped three agent definitions for AI coding tools. The planner explores your app and writes a test plan in Markdown. The generator turns that plan into tests. The healer runs failing tests and tries to repair them.
This is a quick way to reach a first draft, and the healer needs watching. It patches a test until it passes, and if it believes a feature is broken it can skip the test. Either outcome can turn a real bug into a green run. Someone should read every plan and review every healed or skipped test like any other code change.
Version 1.64 also added page.webmcp, which lets a test call the tools a page registers through the experimental WebMCP API. That has become more relevant since Shopify's Fall '26 Edition put WebMCP tools on every Liquid and Hydrogen storefront. This site exposes WebMCP tools too, documented on the developers page, and WebMCP for online stores explains the idea.
When Playwright is the wrong purchase
Be wary of paying for a suite in these cases:
- A small brochure site. Checking it by hand after a change is cheaper.
- A product changing shape every week. Screens get replaced faster than tests pay back. Cover the core job and wait until it settles.
- A stock Shopify theme with no custom code. Shopify maintains most of what could break.
- A team with a healthy Cypress or Selenium suite. Rewriting tests that work buys you very little.
- Logic-heavy code, such as pricing rules. Unit tests are faster and more precise.
FAQ
Is Playwright free to use?
Yes. Playwright is open source under the Apache 2.0 licence, so there is no per-seat or per-test fee for the framework itself. The costs are a developer's time to write and maintain tests, and the compute to run them, which is usually a small monthly amount for a modest suite on a service like GitHub Actions. Most of the real cost is upkeep, so a short, well-chosen suite is cheaper than a large one.
Can Playwright test a mobile app?
Not a native one. Playwright tests websites and web apps, and it can emulate phone browsers by simulating screen size, touch and user agent, which is useful for catching layout problems. That is a simulation, not a real phone, and Playwright is not built to drive native iOS and Android apps. For React Native and Flutter apps, look at tools made for mobile, such as Maestro, Detox or Appium.
How many Playwright tests does a small product need?
There is no fixed number, and a short list usually beats a long one. Start with the flows that would cost you money or trust if they broke unnoticed: reaching checkout, signing in, the product's core job, and keeping one user's data away from another. A handful of reliable tests that run on every change protects more than a large suite people have stopped reading. Put detailed logic in faster unit tests.
If you want a product tested where it matters, send me a short brief: what it does, how it is built, which flows would hurt most if they broke and how you release today. Adding tests to an existing product is custom work quoted from a brief, and you can send yours through the contact form. You can also read about my full-stack web development work, or see how tests fit into a release in my guide to deployment automation.


