Write a Playwright test. Press Run. Watch it drive the browser.
A real page object, a real spec file and a real TypeScript file – running against one of our own applications in the pane beside your code. No install, no npx playwright install, no waiting for a browser to download.
What is real here, and what is not
- Your JavaScript really runs. Your loops, your variables, your helper functions and your
awaitbehave exactly as they would under Node. - The TypeScript really compiles, with the official TypeScript compiler, in your browser.
- The page object is a real file. Change a selector in it and the test that uses it changes with it.
- The clicks are real clicks on the real page in the pane, and a click on a hidden element fails, as it would anywhere else.
- There is no Node process, so no file system, no
require()of real packages and no terminal. - No screenshots, video or trace. The pane beside your code is the view.
- Only our own applications. A browser cannot read a page from another site, so
page.goto('https://example.com')is refused with that reason rather than failing strangely. - One browser – the one you are sitting in. No cross-browser matrix.
Everything that transfers to a real job is in the first list: locators, auto-waiting, web-first assertions that retry, the test/describe/beforeEach shape, and failures that name the locator. Those are the parts people get wrong, and they are wrong here in the same way.
Framework
Six things to change, in order
Each one breaks something on purpose. Reading the failure is the skill.
- Break a locatorIn
CatalogPage.js, change#search-inputto#search-inptand run. Read which locator the failure names – that is why page objects are worth having. - Assert the wrong thingChange the expected cart count to
'9999'. The assertion retries for four seconds before it gives up, then tells you what it found instead. - Remove the waitDelete the
await expect(...).toBeVisible()before the first click. It still passes – Playwright waits for you. Now you know what auto-waiting is doing. - Add a second testWrite another
test(...)in the spec file. Both run, andbeforeEachruns before each one. - Use a different locator strategySwap a CSS selector for
page.getByRole('button', { name: 'Add to cart' }). Our applications carrydata-testidon every control, sogetByTestIdworks too. - Type something wrong in the .ts fileGive a variable the wrong type and run. The TypeScript compiler reports it before a single click happens.
Take it off this page
A real Playwright project
The framework ZIP, with the folder structure, config and reporting a real repository needs.
Something bigger to automate
Nine practice applications and a demo site, free, with stable ids on every control.