Skip to main content
Move one Cypress flow at a time, preserving its authentication, mocked responses, actions, assertions, and cleanup. Momentic tests are YAML steps rather than cy command chains. A coding agent with the MCP server and coding agent skills can draft the port; review the result against the spec before changing your CI gate.

Before and after

This example assumes baseUrl: https://shop.example.com, an existing cy.loginByApi custom command, and this cart fixture:
cypress/fixtures/cart.json
Both tests use a signed-in test account and create an order. Isolate or reset that account’s server-side data between runs.
checkout.cy.js
The same user-flow checks in Momentic. Before running it, create tests/modules/log-in.module.yaml by porting cy.loginByApi; it must establish and validate the same signed-in identity. See session and fixture scope below.
tests/checkout/checkout.test.yaml
The mock and listener are registered before navigating to the product page. This preserves the request wait, including a request made during page load. Adapt the matcher if your endpoint has query parameters. The response body matches cart.json; copying the filename alone would not load a fixture into a mock. YAML regex values omit JavaScript’s surrounding /.../ delimiters. Lint and run the new file alone, with whole-test retries disabled:

API mapping

Fixture and plugin mapping

Session and fixture scope

cy.session caches browser state by an ID and can validate a restored session before rerunning login. A live login module in Momentic’s before runs on each whole-test attempt. For reuse, configure a cached auth module with an explicit cache key and expiry; this does not port Cypress’s session callback or validation function. authLoad restores state without testing whether a server-side session is still valid. Add an authenticated-page or API check, and regenerate expired state in your bootstrap. Port a login helper’s API call with request or Node javascript. Browser cookies are not established merely by calling fetch in Node: use extractCookiesFromResponse, then authLoad with the resulting state, or authenticate through the browser. See cookie extraction and saved state. Cypress’s internal session cache is not a Playwright storage-state JSON file you can give to authLoad. Momentic initializes a browser for each whole-test attempt. Tests that rely on Cypress testIsolation: false need explicit per-test setup or one combined flow. Browser isolation does not reset shared database records. Use unique accounts or records before enabling parallel runs. Map beforeEach and afterEach to before and after. Keep suite-level before/after scripts outside the test unless repeating them per attempt is intentional. Momentic teardown runs after setup or main-step failures and can itself fail the test; initial navigation failure or process interruption can prevent cleanup. Make cleanup idempotent and retain an external cleanup path. Separate Cypress whole-test retries from query retry behavior. Preset conditions can wait; step retries repeat the step and may repeat side effects. Use checks or JavaScript that throws for exact response values, counts, and text. Returning a value from JavaScript alone does not assert it. Review AI assertions against the original expected state rather than replacing them with a broad page-success check. Carry forward CSS constraints, text matching rules, and scope from cy.get/cy.contains; keep an explicit CSS target when a description cannot preserve them.

What does not map

  • There is no cy object or command queue. Port cy.wrap subjects into values passed through saveAs/env, and rewrite custom queue manipulation; a JavaScript step cannot execute a Cypress command chain.
  • There is no preset equivalent of cy.spy/cy.stub. mock covers network interception; browser javascript can inspect the current page. It is not a drop-in replacement for stubs installed before app initialization.
  • cypress-real-events and raw Chrome DevTools Protocol calls have no direct equivalent. Keep tests that require those behaviors in their existing runner.
  • Cypress’s time-travel snapshots UI has no scrubbable equivalent. Momentic’s editor and run viewer expose screenshots, logs, and available recordings. Compare the evidence you rely on before retiring the original job.
  • Keep Firefox/WebKit runs and component-test jobs in their existing runner. Momentic’s web browser targets are Chromium-based; --env does not change that support boundary.

Incremental strategy

  1. Keep Cypress and its CI gate. Follow web setup to add Momentic, preserving existing config. Commit the dependency lockfile and confirm the config includes your new test/module directories.
  2. Inventory each flow’s login helper, session validation, fixtures, intercepts, assertions, plugin tasks, and cleanup. Port authentication first and run it independently. Test both fresh login and expired saved state.
  3. Port one critical flow and label it migrated. Lint it and run it alone with --parallel 1 --retries 0. In a test environment, confirm a deliberate response or assertion mismatch fails the replacement, then restore it.
  4. Run a separate Momentic CI job with its own output directory and test data. Keep Cypress required while comparing the same critical paths. Preserve the request wait and response checks from every intercept; review any recovery, classification, or quarantine before accepting a passing result.
  5. Switch the gate one flow at a time after repeated passes and a reviewed expected failure. Preserve the Cypress specs and CI config in Git so you can restore the old gate. Remove Cypress only after its remaining plugin, browser, and component coverage has a replacement.
Inspect the selected paths before running the overlap job:
By default, results check rejects non-quarantined runs that failed, were cancelled, recovered, or had a failure classification. It ignores quarantined runs and accepts an archive with zero tests. The recipe uses --ignore-quarantine so quarantine does not mask the selected tests’ statuses; confirm the list and run totals contain the enabled tests you intend to port. --filter selects a workspace project, not a Cypress spec. See results checks and GitHub Actions for CI setup.

Porting at scale with a coding agent

Point your coding agent at the spec files and the momentic-test skill. Use a prompt that names the behavior to preserve: