k11 Playwright QA

v0.4.2
io.github.K11-Software-Solutions/playwright-qa Checked 2 hours ago Published 4 days ago

User stories to verified Playwright tests, and self-healing locators with an audit trail.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

explore_page Explore page

Open a URL in a headless browser (optionally with a saved login and/or steps to reach a deeper page) and list its meaningful elements with locators verified to match exactly one element, most stable first. Use these locators when writing tests instead of guessing selectors.

ParameterTypeDescription
url *stringStart URL (http, https or file)
devicestringEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
interactive_onlybooleanOnly buttons, links, inputs and other controls
max_elementsinteger
sessionobjectReach pages behind a login or several steps into a flow

check_locator Check locator

Check how many elements a Playwright locator matches on a page (1 = good) and whether the match is visible. Accepts the same session as explore_page.

ParameterTypeDescription
locator *stringe.g. page.getByRole('button', { name: 'Sign in' })
url *string
devicestringEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
devicesarrayCheck on several devices at once, e.g. ["desktop", "iPhone 15", "Pixel 7"]
sessionobjectReach pages behind a login or several steps into a flow

save_login_state Save login state

Log in once by running steps on a login page, then save the browser's cookies and storage to .qa-mcp/auth/<name>.json. Pass that file as session.storage_state to other tools, or to Playwright's storageState in tests. Put passwords in environment variables and reference them as ${ENV:NAME}; never pass them literally. The saved file contains session tokens: keep .qa-mcp/auth out of version control.

ParameterTypeDescription
steps *array
url *stringLogin page URL
devicestringEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
namestring
success_locatorstringLocator that must be visible after login, e.g. page.getByRole('heading', { name: 'My account' })

review_user_story Review user story before testing

Call this BEFORE parse_user_story. Finds what a careful tester would ask before writing tests: missing acceptance criteria, outcomes that can't be asserted, no user role, untestable words (fast, easy, many), limits without numbers, no failure path, missing preconditions, and (with context) terms the context never explains. Returns questions for a person to answer, each with why it matters and the words that raised it. If ready is false, ask the user these questions and wait; do not guess the answers.

ParameterTypeDescription
story *string
contextstringRelated product docs, glossary or notes; terms the story uses but this never explains become questions

parse_user_story Parse user story

Turn a user story (As a.../I want.../so that..., Gherkin scenarios, or acceptance-criteria bullets) into structured scenarios and a Playwright Test skeleton with one test per scenario and one test.step per step. Call review_user_story first; the result includes a short review so open questions are never silently skipped.

ParameterTypeDescription
story *string
urlstringStart page, added as page.goto in beforeEach

write_test Write test file

Write a Playwright spec into the project's tests/ folder. Refuses paths outside tests/ and will not overwrite unless overwrite=true.

ParameterTypeDescription
code *string
path *stringRelative to tests/, e.g. login.spec.ts
overwriteboolean

run_tests Run Playwright tests

Run Playwright Test in the project and return per-test results. Failures include the error, its location and, when the cause was a locator, the locator Playwright was waiting for (pass it to heal_locator).

ParameterTypeDescription
grepstringOnly run tests whose title matches
projectstringOnly this Playwright project from playwright.config, e.g. "Mobile Safari"; omit to run all projects
specstringSpec file relative to tests/; omit to run everything

capture_baseline Capture locator baselines

While tests pass, record a fingerprint (role, name, test id, id, classes, text...) of the element each locator matches, saved in .qa-mcp/baselines.json under the page reached. heal_locator uses these after the UI changes. Accepts the same session as explore_page for pages behind a login.

ParameterTypeDescription
locators *array
url *string
devicestringEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
sessionobjectReach pages behind a login or several steps into a flow

heal_locator Heal locator

For a locator that no longer matches (or matches several elements), find the most likely intended element on the current page and suggest a verified replacement with a confidence score and reasons. Accepts the same session as explore_page. Never edits files: review the suggestion, update the test, then re-run.

ParameterTypeDescription
locator *string
url *string
check_devicesarrayAlso verify the suggestion on these devices, e.g. ["desktop", "iPhone 15"], so a mobile fix does not break desktop
devicestringEmulate a device for mobile web: a Playwright device name such as "iPhone 15" or "Pixel 7" (list_devices), or "desktop" (default)
sessionobjectReach pages behind a login or several steps into a flow

list_devices List devices

Device profiles for mobile web testing (Playwright's built-in list): phones and tablets with their screen size, pixel density and touch. Pass a name as device to explore_page, check_locator, capture_baseline and heal_locator.