Speed and caching
How the multi-modal cache works
A cached step stores more than one way to find the target: where it sits on screen, what it looks like, what text it contains, and the structural and accessibility attributes around it. Which of those signals matters for a given step is inferred from the natural-language description. “The red Cancel button below the Order Summary header” leans on visual and positional signals; “the Submit button in the form” leans on structure and role. When a step replays, the runner checks the stored signals against the live page and runs the action without invoking the LLM when there’s a match.What happens on replay
The authoring loop only matters if the generated artifact survives the next day. Take this generated Playwright spec the day after authoring, against the same app with one change: the team replaced the static welcome string with a personalized one ("Welcome, Ada" -> "Hi Ada, welcome back").
Playwright MCP, replay:
page.locator('input[type="email"]').fill(...)and the subsequent interactions resolve normally.page.waitForTimeout(2000)blocks for 2s regardless of whether the page is ready.expect(page.getByText("Welcome, Ada")).toBeVisible()fails. The text was guessed from the snapshot the agent saw during authoring; it no longer matches.- The CI job fails. The maintainer either re-runs the MCP authoring loop from scratch or hand-edits the spec to use a different selector. Either way it’s a code review.
type/clicksteps hit the cache and run in milliseconds.assert: The dashboard chart is visible and not cut offis evaluated by the assertion agent against the current page state. The agent reasons over the intent of the assertion, not a literal string match, so the rephrased welcome banner doesn’t trip it.- The test passes without a code change to review.
Why context grows for Playwright MCP
Why context grows for Playwright MCP
Each MCP tool call (
browser_click, browser_snapshot, browser_navigate,
…) returns a structured snapshot of the page: rendered DOM, a11y tree, and
console messages. The agent’s prompt history accumulates every snapshot from
every tool call in the session.Momentic’s MCP server returns a compressed screenshot plus a short status from
each preview / run call. Snapshot expansion happens server-side during locator
resolution; the full DOM is only returned when the agent explicitly asks for the
session state. Locator resolution runs against the cache first; cache hits
return without invoking the LLM at all.Authoring loop
Agent rule for spec-driven development
Agent rule for spec-driven development
Add a spec-driven section to
AGENTS.md so the coding agent keeps Momentic
tests in sync with feature work. See
the integration docs.Generated artifact side-by-side
Playwright MCP (after running the flow once from memory):2000ms wait was inserted
because the agent saw a transient loading state. Replay often fails on one or
both.
Agentic simplified format (each step previewed live before commit):
A more realistic test
The hello-world above doesn’t show the full simplified format surface. A representative checkout regression with module reuse, parameter inputs, typed extraction, and a conditional looks like this:checkout.test.yaml
../modules/sign-in.module.yaml