Docs Cypress Migration Guide

Migrating from Cypress to Mockarty

You write browser tests in Cypress. Mockarty covers the same loop — record →
get ready code → edit → run in a real browser → read the report
— and adds
what Cypress makes you assemble yourself:

  1. Record without writing selectors by hand. Drive your app in the browser
    with the Mockarty Capture extension; get a ready test in your language —
    Go, Python, Java, or Playwright-compatible TypeScript. No cypress open
    selector playground, no hand-picking cy.get(...).
  2. One report for everything. The browser run lands next to your API, load,
    fuzz, and contract runs — with per-step screenshots, video, a time-travel
    trace, and visual regression built in (no cypress-image-diff plugin to wire
    up).
  3. A real cross-browser engine. Replays run on actual Chromium, Firefox, or
    WebKit via a shared browser-runner — no browser install on each machine.

TL;DR

Cypress Mockarty
cypress open, hand-pick selectors Click Record, drive the app, selectors are chosen for you
cypress run (Node + browser per machine) Run on a shared browser-runner — nothing to install locally
*.cy.js specs in your repo Export the recording as Go / Python / Java / .spec.ts, commit it
Screenshots + video config in cypress.config.js Screenshots, video, and trace are per-run options
Visual diff via a plugin Visual regression is built in, with inline approve in the report
Results in cypress/ + a dashboard product Results in your unified test report

The workflow

The record → export → edit → run loop is the same one described in detail for
Playwright — see Migrating from Playwright.
In short:

  1. Record with the Mockarty Capture extension (or a live session over the
    API). Each recording is saved as a UI test.

  2. Export it in your language:

    mockarty ui list
    mockarty ui export <ui-test-id> --lang python   # go | java | playwright | appium
    
  3. Edit the generated code and commit it next to your app. The SDK builder
    reconstructs exactly the step list Mockarty runs — what you commit is what
    executes.

  4. Run it on a browser-runner and read the verdict:

    from mockarty import MockartyClient
    
    client = MockartyClient(base_url="http://localhost:5770", api_key="mk_...")
    saved = client.ui_tests.create(login_flow())
    run = client.ui_tests.run(saved["id"])
    result = client.ui_tests.wait_for_run(run["taskId"])
    print(result["status"])   # passed | failed | broken
    

Here is a recorded Cypress-style login as committed Python:

from mockarty import UITest


def login_flow() -> UITest:
    return (
        UITest("Login flow")
        .navigate("https://app.example.com/login")
        .fill("#email", "user@example.com")
        .fill("#pw", "secret")
        .click("#login")
        .assert_text("#welcome", "Welcome")
    )

Command mapping

Cypress Mockarty step
cy.visit(url) navigate
cy.get(sel).click() click
cy.get(sel).dblclick() doubleClick
cy.get(sel).type(v) type / fill
cy.get(sel).clear() clear
cy.get(sel).select(v) select
cy.get(sel).check() / .uncheck() check / uncheck
cy.get(sel).trigger('mouseover') hover
cy.get(sel).type('{enter}') press
cy.get(sel).selectFile(f) upload
cy.contains(t) text="t" locator
.should('contain', t) assertText
.should('be.visible') / .should('not.be.visible') assertVisible / assertHidden
.should('have.value', v) assertValue
.should('have.length', n) assertCount
cy.url().should('include', u) assertURL
cy.title().should('eq', t) assertTitle
.should('be.enabled') / .should('be.disabled') assertEnabled / assertDisabled
.should('be.checked') assertChecked
cy.matchImageSnapshot() (plugin) visual checkpoint (built in)

Selectors

Cypress leans on data-cy / data-test attributes. Mockarty records exactly
those ([data-testid='x'], [data-cy='x'], or whatever attribute your app
uses), plus text, role, id, and structural CSS — picking the most stable one and
keeping the alternates so a replay self-heals when a selector drifts.

Fixtures, config & retries

Cypress Mockarty
cy.fixture() / Cypress.env() envVars on the run, referenced as {{name}} in URLs / values
baseUrl in cypress.config.js an env var you substitute
cy.session() (logged-in state) saved storage-state — replay authenticated (“log in once, run for a month”)
retries per-step assertions wait/retry automatically before failing
viewportWidth / viewportHeight the viewport run option ("1280x800")
browser flag the browser run option (chromium / firefox / webkit)
run = client.ui_tests.run(saved["id"], {
    "envVars": {"BASE_URL": "https://staging.example.com"},
    "browser": "chromium",
    "viewport": "1280x800",
})

What you gain

  • No plugin assembly — video, screenshots, trace, and visual regression are
    built in, not third-party plugins you maintain.
  • Tests in Go / Python / Java, not only JavaScript.
  • A shared runner — no cypress run with Node + a browser on every CI agent.
  • One report for browser + API + load + fuzz + contract, instead of a
    separate Cypress dashboard.