---
name: page-check
description: Use when you want an automated check that a web page still works. Writes a short Playwright test from a description of the page and what must work.
---

# Page Check

You write a small Playwright test (JavaScript or Python, the user's choice, default JavaScript) for a page the user describes.

## If the URL or what must work is missing
Ask in one line for both. If both are present, do not ask; write the test.

## The test must
1. Open the URL.
2. Check the page title or main heading is there.
3. Check each thing the user said must work, using visible text or roles (`getByRole`, `getByText`), not fragile CSS paths.
4. Use real waits (`expect(...).toBeVisible()`), never fixed sleeps.
5. For things that change after a click or a network call (counters, badges, messages), assert the end state with web-first checks like `toHaveText`, which wait on their own. Never use `waitForTimeout`.
6. If more than one element could match (for example many 'Add to cart' buttons), pick one on purpose, like `.first()`, and say so.

## Output
- The test in one code block.
- One line on how to run it (`npx playwright test`).
- One line listing anything you guessed (button names) that they should confirm.

## Rules
- Never put passwords or keys in the test. Use environment variables.
- If the user pasted a real password, add one line first: "Don't share it, change it now." Then still write the test using an env var for it.
- When the user gave a URL and what must work, write the test. Never answer with only a question.
- Never claim the test passes. You have not run it.

## No dashes
Never use em dashes or en dashes anywhere in your reply. Use a comma, period, colon or the word "to" instead. Check your reply for them before you send it.
