No results found.

Playwright coverage for Magento, configured rather than forked

A shared suite adapted to each store through five JSON files. Luma, Hyvä and Mage-OS supported out of the box.

npx @samjuk/create-magento-e2e Read the docs on GitHub

Magento 2.4.7 to 2.4.9 and Mage-OS. Luma and Hyvä both supported. MIT licensed, nine packages on npm.

npx playwright test 95 passed
storefrontadmincheckout
guest checkout completes4.1sok
customer account creation2.3sok
add to cart from category page1.8sok
product rename shows in grid and storefront6.2sok
gift message on checkoutnot-applicableskip
95 tests, 55 tracked gaps

Skipped tests carry a reason code, so platform gaps never hide inside a store lacking the feature.

Three steps to a running suite

  1. 1

    Scaffold it into your Magento root

    The installer adds the core package, the package for your theme, and a config directory. Nine packages are published to npm under MIT, currently v0.1.x.

    npx @samjuk/create-magento-e2e
  2. 2

    Describe your store in five JSON files

    They merge in order: core defaults, then the theme package, then yours. Anything you have not moved is inherited.

    dev/tests/e2e/config/selectors.json
  3. 3

    Run it, locally or in CI

    There is no projects array to keep in sync. Install a test package and its tests turn up on the next run.

    npx playwright test

Luma, Hyvä and Mage-OS out of the box

Both theme packages expose identical test titles and tags, so one store config behaves the same under either. CI fails if the two drift apart.

  • @samjuk/e2e-m2-theme-luma
  • @samjuk/e2e-m2-theme-hyva
  • Magento 2.4.7, 2.4.8 and 2.4.9
  • Mage-OS

Five config files, merged in order

Core defaults, then your theme package, then your store. You restate only what you moved. Unrecognised keys pass straight through, which is how a module namespaces its own block rather than earning a sixth file.

config/selectors.json   selectors your theme moved
config/slugs.json       URL keys and route paths
config/inputs.json      addresses and cards that validate
config/fixtures.json    products, categories, customers
config/features.json    what this store has switched on

Tests arrive with the packages you install

Any dependency declaring e2eModule.testDir contributes its specs to the next run. There is no projects array to keep in sync.

npm i -D @acme/e2e-m2-module-subscriptions

# its specs run on the next pass, no config change
npx playwright test

A skipped test is not a passing one

Every exclusion carries a reason code, printed at the start of the run. Without that split, platform debt hides inside a store's legitimate limitations.

  • not-applicable, the store genuinely lacks the feature
  • platform-gap, real customers can do this, the page objects cannot
  • client-bug, it is actually broken

Seeding refuses to start on a dirty database

Dump and restore, with a flag row written once the dump exists and cleared by a completed restore. A run killed before teardown leaves the flag set, so the next run stops rather than dumping an already polluted database as its only clean restore point.

Where your own tests live

Write the test once, in the same place as the thing it covers, then opt in per project.

SourceWhereEnabled by
Theme suite@samjuk/e2e-m2-theme-*config.theme
Module packages@<scope>/e2e-m2-module-*any dependency declaring e2eModule.testDir
Your own testsdev/tests/e2e/tests/always
app/code modulesapp/code/{Vendor}/{Module}/Test/E2E/the directory existing
Composer packagesvendor/<name>/Test/E2E/opt in via config.vendorModules

A module you reuse across clients ships its tests inside the Composer package. Install the module on the next project, name it in config.vendorModules, and the tests come with it.

Common questions

Is this still invite-only?

No. It is open source under MIT and published to npm as nine packages: a core suite, two theme packages, five module packages and the scaffolder. It was invite-only during the private beta and is not any more.

Which Magento versions and themes are supported?

Magento 2.4.7 to 2.4.9 and Mage-OS, with Luma and Hyvä supported out of the box. Earlier Magento versions are not planned.

Why is vendor/ opt-in rather than scanned?

It is a security decision. Test code runs with your developer credentials, your CI runner network access and often a live database connection. A suite that executed whatever specs it found in vendor/ would hand arbitrary code execution in your pipeline to every package in your dependency tree. Adding a package to config.vendorModules is a reviewable line in a pull request.

How do assertions avoid false passes?

They read state back rather than trusting a success message, because a success message only proves a controller did not throw. An address is saved then re-read from the form. A product rename is checked in the form, in the grid and on the storefront. An order confirmation is matched by increment ID.

Should I use this or a simpler suite?

If you have one store and want a suite that grows with it, elgentos/magento2-playwright and ProxiBlue/m2-hyva-playwright are both good and involve considerably less machinery. The configuration layers here start paying for themselves once the same suite runs against stores you did not build together.

How stable is it?

It is an early release at v0.1.x and it will have edges. Bug reports, overrides you had to write, and anything you could not express in config are all useful, including the view that the whole approach is wrong.

Stop maintaining a test suite per client.

It is v0.1.x and it will have edges. Bug reports, overrides you had to write, and config you could not express are all useful.