MCP-Assisted Existing-Suite Migration
Analyze a Selenium, Cypress, or Playwright repository, preview an MCP-assisted ContextQA migration, migrate the tests, and verify the results.
Quick answer
Analyze a Selenium, Cypress, or Playwright repository, preview an MCP-assisted ContextQA migration, migrate the tests, and verify the results. Use this page to understand when the capability applies, complete its user-facing workflow, and verify the expected result.
What this page covers
This guide walks through an MCP-assisted migration: make the repository available through an approved execution environment, analyze it, preview conversion, and verify the resulting ContextQA cases. A Playwright export can support a separate portability evaluation, but conversion and export are not guaranteed to preserve every assertion, fixture, or control-flow construct.
Migration runs through the ContextQA MCP server, so an AI assistant such as Claude Code, Claude Desktop, or Cursor calls the tools on your behalf. You describe what you want in plain English; the agent selects the right tool and fills in the parameters.
By the end of this guide you will have:
Analyzed your existing repository to see what will migrate.
Previewed the migration with a dry run.
Migrated the suite into a ContextQA workspace.
Verified the migrated test cases by running one.
Prerequisites
A ContextQA account with at least one workspace (sign up at contextqa.com).
The MCP server connected to your AI assistant. If you have not done this, complete Tutorial: Create your first test with an AI agent first.
An existing test repository accessible to the configured analysis and migration service. Confirm supported frameworks in the connected tool schema; framework detection does not establish execution parity.
The base URL of the application your tests target — for example,
https://staging.example.com.Familiarity with core concepts — specifically test cases, steps, and workspaces.
How migration works
Migration does not mean running the original test runner unchanged. The service parses supported constructs and creates ContextQA cases; review the retained actions, assertions, and omitted dependencies. Three MCP tools cover analysis, conversion, and export:
analyze_test_repo
Analyzes a repository accessible to the configured service; confirm the data-access boundary.
migrate_repo_to_contextqa
Parses supported tests and creates ContextQA cases. Supports a dry run.
export_to_playwright
Returns a Playwright file manifest for selected cases; review and validate it before standalone use.
Migrated cases can use supported ContextQA execution capabilities, including AI self-healing. Review any maintenance change against the original assertion; a repaired locator does not establish that the business outcome remains correct.
Step 1: Analyze your existing repository
Start with analysis after confirming repository access. Compare the detected framework and file inventory with your checkout. Do not assume this tool runs on your machine or keeps source local simply because its input is a filesystem path.
Ask your agent:
The agent calls analyze_test_repo with your repo_path and returns:
detectedFramework— for example,cypress,playwright,selenium, orjest.language— the language the tests are written in.testFiles— the list of test files found.estimatedTestCount— how many tests are migrated.
Verify it worked: The agent reports the detected framework and a test count that matches your expectation. If the count looks low, confirm you pointed at the directory that actually contains the specs (for example, cypress/e2e or tests/) rather than the project root.
Step 2: Preview the migration with a dry run
Never migrate blind. Run the migration in dry-run mode first to see exactly how many test cases ContextQA creates and how many it skips — without changing anything in your workspace.
Ask your agent:
The agent calls migrate_repo_to_contextqa with dry_run set to true. It returns:
migratedCount— the projected number of test cases.skippedCount— tests that cannot be converted automatically.A
summarymessage describing the result.
In dry-run mode, no test cases are created. Review the projected counts before continuing.
If ContextQA detected the wrong framework in Step 1, override it by naming the framework in your prompt:
The agent passes your value in the framework parameter (cypress, playwright, selenium, or jest).
Verify it worked: The agent reports a projected migratedCount close to the estimatedTestCount from Step 1. A large skippedCount usually means the suite relies on logic that does not map to test steps — see Troubleshooting.
Step 3: Run the migration
Once the dry-run preview looks right, run the migration for real.
Ask your agent:
The agent calls migrate_repo_to_contextqa again with dry_run set to false. It returns:
migratedCount— the number of test cases created.skippedCount— the number skipped.createdTestCaseIds— the IDs of the new ContextQA test cases.A
summarymessage.
Verify it worked: The agent returns a list of createdTestCaseIds. Open your ContextQA workspace and confirm the new test cases appear in the test case list. Note the IDs — you use them in the next step.
Step 4: Verify the migrated tests
A migrated test case is a starting point, not a finished test. AI-inferred steps and assertions need a human review, so verify the migration by inspecting the steps and running at least one test case end to end.
Review the steps
Ask your agent:
The agent retrieves the step definitions. Read them the way you would review a pull request:
Confirm the natural-language steps capture what the original test did.
Check that assertions survived — every meaningful check in the original test should map to a verification step. Add any that were dropped in the Test Steps Editor.
Replace hardcoded credentials or data with environment parameters or a test data profile.
Run one test case
Pick one migrated test and run it to confirm it executes against your application.
The agent runs the test, polls for completion, and reports the result. If a step fails, ask for the root cause:
Verify it worked: Retrieve the actual verdict and relevant step evidence for the same application build and fixture. Completion alone is not a pass, and a single passing case does not validate the entire migration. Investigate assertion, data, environment, and conversion differences before changing steps; treat AI root-cause output as a hypothesis to verify.
Keep a two-way path (optional)
An export can provide a code snapshot for parallel evaluation or handoff to a team that prefers scripts. Treat it as a point-in-time artifact, not as proof of live two-way synchronization or lossless round-trip conversion.
Ask your agent:
The current export_to_playwright tool accepts an explicit test_case_ids list and optional project_name. It returns project_name, file_count, files entries with relative path and content, and summary. The coding client saves these files through its own authorized filesystem capability; the hosted server does not write them to your laptop. Do not assume a tsconfig.json or a type-check setup is included. See export and portability for the complete review workflow.
Run a clean-environment portability test
Use this exit test before a purchase or migration decision depends on portability. It asks whether a representative export can run outside the platform and makes every remaining dependency visible.
Step 1: Select a representative export set
Choose tests that expose the real ownership boundary:
one critical happy path with business assertions;
one negative or permission path;
one data-dependent workflow;
one workflow using environment parameters or credentials;
one failure that requires screenshots, logs, or traces; and
one test that previously needed maintenance or self-healing.
Record the source test-case IDs, names, last-reviewed dates, and ContextQA run references before exporting.
Step 2: Export to an empty directory
Call export_to_playwright with explicit case IDs, inspect its returned manifest, and have the coding client save approved relative paths under an empty local directory. Reject absolute paths, traversal, or unexpected overwrites. Preserve the requested IDs, file count, file inventory, local save location, and actual project instructions.
Inventory the result:
Package manifest
Playwright configuration
TypeScript configuration
One expected spec per selected test
Required assertions
Fixture or setup dependencies
Environment-variable names
Data setup and cleanup instructions
Browser/project configuration
Artifact configuration
The current generator may emit plaintext credentials in credentials.env. Inspect the manifest privately before sharing or committing; move required values into the standalone runner's approved secret store. Also replace assumed-success AI verification, implement manual checkpoints, and restore branch and loop semantics before treating a green run as equivalent coverage.
Step 3: Move to a clean runner
Use a disposable machine, container, or CI job that:
has no ContextQA session or local cache;
has no access to the source workspace unless explicitly required;
installs dependencies from the exported manifest;
receives only documented environment values; and
can reach the same approved test environment.
Record the operating system, runtime, package-manager version, browser installation step, dependency lockfile state, and exact command used.
Step 4: Run normal and seeded-failure cases
Run the exported tests against the same immutable application build used for the ContextQA comparison. Then run a reversible seeded failure in a disposable fixture.
Verify:
The expected tests are discovered.
Required assertions execute rather than being skipped.
The normal fixture produces the expected results.
The seeded defect produces the expected failure.
Failure output is sufficient for the standalone team's debugging workflow.
Retries, timeouts, projects, and concurrency are explicit in the exported configuration or the residual-dependency register.
Step 5: Record residual dependencies
Test logic and assertions
Credentials and secrets
Seed data and cleanup
Browser infrastructure
Parallelism and queueing
Retry and timeout policy
Screenshots, video, logs, and traces
Result history and retention
Failure analysis
Self-healing or maintenance workflow
CI status and reviewer link
Portability means the team understands and accepts this ownership transfer. It does not require every managed capability to appear in a code export.
Step 6: Test the claimed round trip separately
If re-importing edited Playwright code is a requirement, treat it as a separate acceptance test. Do not infer re-import from export.
If no supported re-import path is documented or demonstrated, record No verified round trip and make the workflow one-way with an explicit source of truth.
Portability decision record
Use the AI testing pilot scorecard to combine this result with coverage, reliability, effort, and integration evidence.
Verification
You have completed the migration when:
Troubleshooting
Wrong framework detected
Mixed frameworks or a non-standard layout
Name the framework in your prompt so the agent sets the framework parameter (cypress, playwright, selenium, or jest).
estimatedTestCount is 0 or too low
The path points at the project root, not the specs
Point repo_path at the directory that holds the test files, such as cypress/e2e or tests/.
High skippedCount
Tests rely on conditional logic, loops, or custom code the parser cannot map to steps
Migrate what converts cleanly, then rebuild the complex cases using custom code steps, loops, and conditionals.
Migrated steps miss an assertion
The original assertion had no clear natural-language equivalent
Add a verification step manually in the Test Steps Editor.
A migrated test fails on the first run
Hardcoded data, missing environment config, or a step that needs more detail
Attach an environment or test data profile, then use the root cause analysis to refine the failing step.
Summary
You migrated an existing test suite into ContextQA:
Analyzed the repository to detect its framework and test count.
Previewed the migration with a dry run before changing anything.
Migrated the suite into a ContextQA workspace.
Verified the result by reviewing steps and running a test case.
Your tests now run as natural-language ContextQA test cases with AI self-healing, and you can export them back to Playwright whenever you need to.
Next steps
Organize the migrated tests: Group them into suites and plans so you can run them together. See Managing Test Suites and Test Plans.
Harden data handling: Replace hardcoded values across the suite with parameters. See Test Data Management.
Run in CI: Trigger the migrated suite from your pipeline on every pull request. See GitHub Actions, Jenkins, or GitLab CI.
Explore available tools: Review the documented migration tools, then confirm exact names and parameters in the connected manifest. See Support-to-Fix & Migration Platform Tools.
Related pages
Tutorial: Create your first test with an AI agent — connect the MCP server and run your first agent-driven test
Migration Overview — choose the direct-analysis, intermediate-export, or intent-led path
Migration Planning & Acceptance Checklist — reconcile scope, assertions, evidence, overlap, and rollback
Support-to-Fix & Migration Platform Tools — full parameter reference for
analyze_test_repo,migrate_repo_to_contextqa, andexport_to_playwrightAI Self-Healing — why intent-based steps survive UI changes
Creating Test Cases — how ContextQA test cases are structured
Agent Integration Guide — tool ordering and multi-step orchestration
Last updated
Was this helpful?
