A passing test is only part of the picture
A browser test can pass while missing the branch or template binding changed by an AI assistant. Coverage helps answer a narrower, useful question: did this run execute the relevant code?
That feedback can guide the next test. Find an uncovered error path, add a scenario and an assertion for its behavior, then run the suite again. The goal is a better connection between a change and the evidence used to review it.
Coverage across the Magento stack
MageLens sets up a local Magento Open Source or Mage-OS environment in Docker. It collects coverage from Cypress or Playwright runs and presents a combined report that links to:
- PHP coverage: executed PHP lines in PHP and PHTML files.
- JavaScript coverage: statements in whole JavaScript files.
- Template coverage: HTML/PHTML bindings, template expressions, and inline scripts, with DOM presence reported separately.
The environment supports Luma and Hyvä workflows. The selected platform, theme, test runner, and configured source roots determine what a run measures.
The template coverage layer
Magento Template Coverage can also be used in an existing Cypress or Playwright setup. It inventories HTML/PHTML source, instruments disposable copies, collects execution counters, and maps the results back to the original files.
It covers supported Knockout bindings, Underscore and jQuery template expressions, Alpine/Hyvä directives, and inline scripts. Original source files stay untouched.
For AI-assisted work, the report becomes a concrete handoff: inspect a source file, find an unexercised binding, write a test that reaches it, and check the result.
Read coverage with its limits
Executed is not the same as correct. Coverage shows what ran. Assertions check behavior. Both are needed to evaluate a change.
DOM presence and executable-line coverage answer different questions. Unsupported directives or PHP-generated output may produce warnings; percentages only describe the parts the tools can measure.
Review source roots, exclusions, report warnings, and the actual test assertions alongside the numbers. MageLens is a local development and testing environment.
Common questions
Can I use Playwright instead of Cypress?
Yes. MageLens supports either runner. The template coverage package also supplies adapters for Cypress and Playwright.
Does template coverage replace PHP coverage?
No. Executable PHP inside PHTML belongs in PHP coverage. Browser-side bindings, template expressions, and inline scripts belong in template coverage.
Does full coverage prove that an AI change is safe?
No. Coverage is evidence of execution within the measured scope. Correct assertions, meaningful scenarios, review, and other relevant checks are still required.