Export Tests to Playwright: Review and Verify

Isometric model rooms with a brass crane moving furniture; one chair sits off its chalk outline, others pass

TL;DR: To export tests to Playwright from ContextQA, the autonomous quality engineer, call export_to_playwright through the MCP server with a nonempty test_case_ids list and an optional project_name. It returns a JSON file manifest that you save to a local directory. A generated project does not prove you have the same coverage. Check assertions, credentials, fixtures and manual steps, then run one representative spec outside ContextQA before adding it to CI.

When you export tests to Playwright from ContextQA, the generated project can look finished. A green run still doesn't prove that its assertions match your source cases, because some AI steps become manual checkpoints or placeholders that don't block the run. This guide shows how to call export_to_playwright, review credentials and manual steps, and prove assertion parity before the specs join your CI pipeline.

Quick answers

Does a Playwright export from ContextQA guarantee the same coverage as the original tests? No. An export is where a portability check begins. Some AI steps need manual work, and others become verification placeholders that don't block the run, so a passing exit code can hide missing checks. Review every generated assertion and run a representative test outside ContextQA first. See the export and portability guide.

How does the ContextQA Playwright export work from an AI coding assistant? From an MCP connected assistant such as Claude Code, Cursor or Codex, call export_to_playwright with a nonempty test_case_ids list. One ID gives a project with a single case, and several IDs give multiple specs. The tool returns a JSON file manifest that your client saves to disk. Setup steps are in the MCP installation and setup guide.

What should my team review before exported Playwright tests join CI? Save the files to an empty directory outside committed source. Check them for credentials, fixtures, manual checkpoints, and assertions that are missing or don't block the run. Run them against a non production environment with a scoped test account and compare the results with the source baseline. Commit only after the assertions match and no secrets remain.

What does it mean to export tests to Playwright?

Exporting turns test cases managed in a testing platform into a Playwright project you run yourself: spec files, configuration and fixtures in your own repository. Teams need it when checking for vendor lock in, handing tests to developers, or moving regression coverage into repository CI. ContextQA handles the export through its MCP server.

In ContextQA, testers build cases with AI generation or the no code recorder. An assistant connected over MCP calls export_to_playwright, and ContextQA resolves prerequisites and reusable step groups while it builds the project (code export, portability guide).

The export is only a starting point. Some AI steps become manual work or verification placeholders that don't block the run, so review them before CI.

Converting suites from another framework is a different job. It is a migration into a new format, not a live sync, and you can't convert back without losing something. The migration guides cover that path.

What do you need before you start?

You need four things: access to the source test cases and their reviewed steps, an MCP connected assistant whose current manifest lists export_to_playwright, a coding client allowed to write local files, and an empty directory outside committed source. You also need a non production environment, a scoped test account, reproducible data and a baseline run to compare against.

The export guide describes a Playwright project but does not list language options. If your team needs TypeScript, JavaScript, Python, Java or C# output, confirm it on a demo call.

OptionBest forPricing modelNotable tradeoff
ContextQA MCP exportMoving managed cases into your repoQuote via demoSome AI steps export as manual or non blocking placeholders
Playwright Test AgentsGenerating new specs from explorationOpen sourceYou review coverage and repairs
Hand written Playwright specsCritical flows that need exact assertionsOpen source plus engineer timeHighest maintenance load

These options can coexist. Use the export for cases you already manage in ContextQA, Test Agents to explore new flows, and hand written specs where one exact assertion matters most (Playwright MCP, CLI, and Test Agents).

Man in a dark room typing on a laptop, his face lit by the bright screen in black and white

How do you run the export, step by step?

Ask an MCP connected assistant to call export_to_playwright with your reviewed test case IDs. Save the returned file manifest to an empty directory, review credentials and manual steps, then run a sample spec outside ContextQA. Treat the export as a draft until its assertions match both the source tests and the baseline run.

  1. Gather the source case IDs, the application build, and a recent execution baseline.
  2. In Claude Code, Cursor, or Codex, request export_to_playwright with a nonempty test_case_ids list and an optional project_name. Several IDs produce several specs.
  3. Write the manifest files to a scratch directory, not committed source.
  4. Search for credentials, manual steps, and non blocking verification placeholders. Replace each placeholder with a real assertion.
  5. Run the project against staging, using the commands from the Playwright installation guide:

cd ~/exports/reporting-pilot

npm install

npx playwright install --with-deps chromium

npx playwright test --reporter=list

Playwright codegen records one new browser session into a spec. The export works differently: it converts cases you already maintain, so you don't have to rewrite them from scratch.

What are the most common mistakes?

The most common failures are treating a green exit code as proof of coverage, committing generated files before reviewing credentials, ignoring AI steps that became manual or non blocking placeholders, and wiring the project into CI before a representative spec has run outside ContextQA. Each one creates false confidence instead of portable coverage.

  • Trusting a passing run. Missing assertions pass silently. Compare each assertion against the source case steps.
  • Exporting into committed source. Credentials or session state can leak. Use an empty directory and ignore playwright/.auth/, which can hold reusable credentials (Playwright authentication docs).
  • Skipping manual checkpoints. Placeholders don't fail the run, so they can hide missing checks. Convert or remove them before merge.
  • Adding to CI too early. Environment drift breaks the pipeline. Run one spec with npx playwright test first.

You avoid lock in only when your team can run and maintain the specs without the platform. Once you have saved and reviewed the manifest, the output is standard Playwright Test code that runs with the usual runner in Jenkins, GitHub Actions or another CI tool.

How do you know it is working?

Exported tests work when a representative spec passes outside ContextQA with the same assertions as its source case, stays green across repeated runs, and fails when you plant a defect. A green exit code alone proves little, because the export guide notes that some AI steps become non blocking verification placeholders.

Watch flakiness first. In 2016, Google reported that almost 16% of its tests showed some level of flakiness (Google Testing Blog, 2016), so a single passing run is weak evidence. Track three checks on a feature branch:

  • Assertion parity: every expected outcome in the source case maps to an expect() call, not a comment or test.fixme().
  • Stability: npx playwright test --repeat-each=10 --retries=0 passes with no intermittent failures (Playwright command line docs).
  • Sensitivity: break the feature on purpose and confirm the spec fails.

Self healing repairs locators for tests managed inside the ContextQA platform. After a spec moves into your repository, your team fixes broken locators through normal code review. One practical split is to keep regression suites that change often in the platform and export only the specs that must run in repository CI.

To measure return, compare maintenance hours per sprint and escaped defects before and after the move. Use your own tracker data, not vendor estimates.

How can you automate the Playwright export with ContextQA?

ContextQA runs the export through its MCP server. In Claude Code, Cursor or Codex, you ask the assistant to call export_to_playwright with reviewed test case IDs. ContextQA builds the project, resolves prerequisites and reusable step groups, and returns a JSON file manifest. Your coding client saves those files locally for review.

  1. Connect the assistant by following the MCP setup guide.
  2. Confirm the export tools appear in the assistant's current manifest.
  3. Have the same assistant create and run managed tests, retrieve their evidence, and export the reviewed cases.

This path covers only tests that already live in ContextQA. Suites coming from other frameworks follow the separate migration guides.

Want to see an export you can review before it reaches CI? Book a demo to walk through ContextQA's code export on your own test cases.
Person in dark clothing typing on a laptop showing code in a dark-themed editor, in a dim teal-lit room

What should you do right now? A checklist

Start with one representative test case. Export it with export_to_playwright, save the files to an empty directory, and check credentials, manual steps and assertions before anything reaches CI. Run the spec against staging and compare the results with the ContextQA baseline. Only then extend the export to more cases.

  • Record the source case IDs, the application build and a passing execution baseline.
  • Call export_to_playwright with one ID in test_case_ids and a project_name.
  • Save the returned manifest to an empty directory outside committed source.
  • Search the specs for hardcoded credentials, and move saved sessions to an ignored playwright/.auth/ path.
  • Replace every manual step or non blocking placeholder with a real assertion.
  • Run the spec against a non production environment with a scoped test account.
  • Compare the pass, fail and assertion counts with the ContextQA baseline.
  • Add the spec to CI only after a reviewer approves assertion parity.

Bottom line

The export_to_playwright tool gives you a file manifest. That is the first step of a portability check, not the end of it. Before any exported spec joins CI, review its assertions, credentials, fixtures and manual checkpoints, then run a representative test outside ContextQA against your baseline. A green exit code alone does not prove the export covers what the original test covered. For older suites, see the migration guides.

Sources

The ContextQA workflow claims in this article come from the product documentation listed below. The flakiness statistic and the Playwright commands come from their primary sources, so you can verify each one directly before you share it with your team.

Share the Post:

Author

Deep Barot

CEO @ ContextQA | Agentic AI for Software Testing | Context-aware Testing

Deep Barot is the Founder and CEO of ContextQA, the only AI testing platform that understands context. He brings decades of experience across DevOps, full-stack engineering, cloud systems, and large-scale platform development.
AI Insights
Real User Intelligence Platform

Turn live sessions into test coverage. No prompts, no manual design - just pointed at your URL and generating suites within minutes.

Minutes
From URL to generated test cases
Zero
Prompts or manual test design needed
40%+
Average coverage increase after first run
100%
Based on real user behavior, not guesses

Frequently Asked Questions

Yes. ContextQA's code export returns a Playwright project through export_to_playwright, and you save it locally and commit it. Before you add it to CI, check its assertions, credentials and manual steps. Some AI steps become non blocking placeholders, which is why the portability check matters.
First, export everything your current vendor allows: test steps, test data, and run evidence. Then confirm the exported assertions still run in Playwright before you cancel the contract. With ContextQA, `export_to_playwright` returns a project you own. Review its credentials and any manual steps before CI.
You get a standard Playwright project that you own, not a proprietary format. Through MCP, `export_to_playwright` returns the project's files for you to save locally. Some AI steps still need manual work or export as non blocking placeholders, so check assertions, credentials and fixtures before you add the specs to CI.
Related Blogs