Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f0cbb65
feat(warden): serve the environment for browser-based tests
marcelmtz Nov 5, 2026
291691c
test(e2e): run a storefront smoke test against the Warden environment
marcelmtz Nov 5, 2026
8971c3d
test(e2e): check this repository out into a subdirectory
marcelmtz Nov 5, 2026
100535d
docs(e2e): correct how to verify an assertion still bites
marcelmtz Nov 5, 2026
fed2ea6
test(e2e): keep the evidence from the first failure
marcelmtz Nov 5, 2026
99b519e
test(e2e): place a guest order against the served store
marcelmtz Nov 10, 2026
04e710e
ci(e2e): seed a catalog before the storefront tests
marcelmtz Nov 10, 2026
a53d46b
ci(e2e): stream the fixture profile into the container
marcelmtz Nov 10, 2026
f69b5e6
test(e2e): add to the cart whatever the catalog lists first
marcelmtz Nov 10, 2026
53fa1d0
feat(e2e): add a reusable workflow for browser-based tests
marcelmtz Nov 10, 2026
9fe237d
ci(e2e): pass the base URL through the environment
marcelmtz Nov 10, 2026
acca57c
ci(e2e): record the stack the gate ran against
marcelmtz Nov 10, 2026
0543ee2
test(e2e): sign in to the admin
marcelmtz Nov 12, 2026
0a885fe
docs(e2e): note what to pair with disable_admin_auth_modules: false
marcelmtz Nov 12, 2026
d40cea7
test(e2e): work a grid and create a product in the admin
marcelmtz Nov 14, 2026
dad990d
fix(e2e): fail when the store does not answer
marcelmtz Nov 14, 2026
97a55ef
fix(warden): serve the environment through a Traefik the daemon talks to
marcelmtz Nov 14, 2026
d71abc5
docs(warden): say what a 404 on every URL actually means
marcelmtz Nov 14, 2026
afff188
fix(e2e): save the product the spec says it saved
marcelmtz Nov 14, 2026
9254c56
fix(e2e): let the first product save take as long as it takes
marcelmtz Nov 14, 2026
d53acbf
test(e2e): create a category and a customer in the admin
marcelmtz Nov 15, 2026
99d2791
test(e2e): fail a spec when the page logs an error nothing asserts on
marcelmtz Nov 15, 2026
aeb3c16
fix(warden): let Magento invalidate the Varnish in front of it
marcelmtz Nov 16, 2026
0b9b1b1
test(e2e): do not flake on an aborted view transition
marcelmtz Nov 16, 2026
418b2dd
test(e2e): reach the product grid through the admin's own link
marcelmtz Nov 16, 2026
68ec68b
ci(e2e): say which store config the gate needs, and why
marcelmtz Nov 16, 2026
3506626
fix(e2e): deploy the admin theme Mage-OS actually renders
marcelmtz Nov 16, 2026
98f2a35
test(e2e): buy from a product page, keep an account, take an order
marcelmtz Nov 16, 2026
96c9f08
docs(e2e): name the release gate example for what it covers
marcelmtz Nov 16, 2026
0357c71
docs(e2e): cut the comments down to what the code does not say
marcelmtz Nov 17, 2026
737f959
refactor(e2e): give the storefront specs a directory of its own
marcelmtz Nov 21, 2026
92ede22
fix(e2e): correct what the profile says about the admin settings
marcelmtz Nov 21, 2026
871b401
ci(e2e): keep what Magento logged, even when a retry saves the run
marcelmtz Nov 21, 2026
f9e17ec
ci(e2e): read system.log by severity, not by tail
marcelmtz Nov 21, 2026
c85005a
fix(e2e): do not put a double hyphen inside an XML comment
marcelmtz Nov 21, 2026
da44018
test(e2e): ask the search engine a question
marcelmtz Nov 21, 2026
3a2d339
test(e2e): buy something as a signed-in customer
marcelmtz Nov 21, 2026
42aa8c5
fix(e2e): wait for the two things a storefront page fills in late
marcelmtz Nov 21, 2026
8d56ab9
fix(e2e): raise the Redis session cap the admin burst exceeds
marcelmtz Nov 21, 2026
44115d6
fix(e2e): apply the order grid's sku filter with Enter
marcelmtz Nov 21, 2026
a46e92c
test(e2e): take the admin order through to shipped
marcelmtz Nov 21, 2026
326c0de
test(e2e): refund the admin order and close it
marcelmtz Nov 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
379 changes: 379 additions & 0 deletions .github/workflows/_internal-e2e.yaml

Large diffs are not rendered by default.

307 changes: 307 additions & 0 deletions .github/workflows/e2e-README.md

Large diffs are not rendered by default.

486 changes: 486 additions & 0 deletions .github/workflows/e2e.yaml

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion _test/demo-package/Test/e2e/.env

This file was deleted.

10 changes: 10 additions & 0 deletions _test/demo-package/Test/e2e/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# The store the suite opens. There is no default: a suite that silently tests
# someone else's demo store is worse than one that refuses to start.
PLAYWRIGHT_BASE_URL=https://app.mageos.test/

# The admin account warden/setup-environment creates, and the frontname
# setup:install was given. Defaults in admin/support.ts match the action, so
# these only need setting when pointing the suite at some other store.
MAGENTO_ADMIN_USER=admin
MAGENTO_ADMIN_PASSWORD=abcABC123
MAGENTO_ADMIN_FRONTNAME=admin
5 changes: 5 additions & 0 deletions _test/demo-package/Test/e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
playwright-report/
test-results/
.env
.auth/
962 changes: 957 additions & 5 deletions _test/demo-package/Test/e2e/README.md

Large diffs are not rendered by default.

220 changes: 220 additions & 0 deletions _test/demo-package/Test/e2e/admin/create-category.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
import { expect, test } from '../fixtures';
import { adminSelectors, adminUrl } from './support';
import { categoryUrl, luma } from '../storefront/luma';

/**
* A category is the other half of the catalog write path, and almost none of
* it is shared with the product form.
*
* The product form is a UI component form posting to a UI component data
* provider. The category page is a jstree sidebar driving a form whose product
* assignment is still a legacy grid widget, saving through a controller that
* writes the category tree, generates url rewrites for every store view and
* invalidates the catalog_category_product index. The storefront then has to
* resolve the new url, render a listing from that index and show the category
* in a navigation block that was cached before it existed.
*
* So this spec creates a subcategory of the root, assigns it a product, and
* then asks the storefront for a page that did not exist a moment ago and for
* a menu entry that was cached without it.
*/

const categoryForm = {
// catalog/category/ is the tree page, and it opens on the root category's
// own edit form -- so the body class on what looks like an index is
// -edit. The admin names the action, and the action is editing.
treeBodyClass: /catalog-category-edit/,
formBodyClass: /catalog-category-add/,
savedBodyClass: /catalog-category-edit/,
tree: '.tree-holder',
treeNode: 'li.jstree-node > a',
addSubcategory: '#add_subcategory_button',
name: 'input[name="name"]',
isActive: 'input[name="is_active"]',
// Underscores, deliberately not a typo: the product form's equivalent
// section is data-index="search-engine-optimization" with hyphens. Same
// label in the UI, different spelling in the DOM, and the two forms are
// maintained by different modules' ui_component XML.
seoSection: "div[data-index='search_engine_optimization'] .fieldset-wrapper-title",
urlKey: "input[name='url_key']",
productsSection: "div[data-index='assign_products'] .fieldset-wrapper-title",
// A legacy grid widget, not a UI component listing: its own table id, its
// own filter row that applies on Enter, and row checkboxes with no name
// attribute. adminGrid() does not apply here and should not be stretched
// to; this grid is a different thing that happens to look similar.
productsTable: '#catalog_category_products_table',
productSkuFilter: 'input[name="sku"]',
save: '#save',
// Not div[data-ui-id="messages-message-success"]: the category page
// renders the plain admin message block.
saved: '.page-content .message-success',
anyMessage: '.page-content .message-success, .page-content .message-error',
};

test.describe('Creating a category in the admin', () => {
// As with the product spec: a category save on a cold store pays for code
// generation and then for the category/product and url rewrite indexers.
test.setTimeout(300_000);

test('@admin creates a category and the storefront lists it', async ({ page }) => {
// Per attempt, not per module: a retry that collided with the url key
// its own first attempt saved would report "the url key already
// exists" instead of whatever actually went wrong.
const stamp = `${Date.now()}`;
const category = {
name: `Mage-OS E2E Category ${stamp}`,
urlKey: `mageos-e2e-category-${stamp}`,
};

await test.step('the admin offers a new subcategory form', async () => {
await page.goto(adminUrl('catalog/category/'));

await expect(page.locator('body')).toHaveClass(categoryForm.treeBodyClass);
// The tree is rendered by jstree from a JSON payload, so a visible
// node is already a statement that the sidebar bootstrapped.
await expect(page.locator(categoryForm.tree)).toBeVisible();
await expect(page.locator(categoryForm.treeNode).first()).toBeVisible();

// No id in the URL, so the page opens on the store's root
// category and Add Subcategory makes a child of it. That is the
// level the storefront navigation renders, which is what makes
// the menu assertion at the end of this spec possible.
await page.locator(categoryForm.addSubcategory).click();

await expect(page.locator('body')).toHaveClass(categoryForm.formBodyClass);
await expect(page).toHaveURL(/catalog\/category\/add\/store\/\d+\/parent\/\d+/);
await expect(page.locator(categoryForm.name)).toBeVisible();
// Asserted rather than set. The default is enabled, and a
// disabled category answers 404 on the storefront -- so if this
// default ever changes, the failure should be this line and not a
// mystifying 404 three steps later.
await expect(page.locator(categoryForm.isActive)).toBeChecked();
});

await test.step('the form accepts a name and a url key', async () => {
await page.locator(categoryForm.name).fill(category.name);
await expect(page.locator(categoryForm.name)).toHaveValue(category.name);

// Collapsed on load and rendered lazily, like every other
// collapsible in the admin: the url key input is not in the DOM
// until the section is opened.
await page.locator(categoryForm.seoSection).click();
await expect(page.locator(categoryForm.urlKey)).toBeVisible();
await page.locator(categoryForm.urlKey).fill(category.urlKey);
await expect(page.locator(categoryForm.urlKey)).toHaveValue(category.urlKey);
});

let assignedProduct = '';

await test.step('a product is assigned to the category', async () => {
await page.locator(categoryForm.productsSection).click();

const grid = page.locator(categoryForm.productsTable);
await expect(grid).toBeVisible();

// Filtered to the fixture's simple products rather than taking
// whatever sorts first. The fixture also generates a configurable
// and its variations, and a variation is Not Visible Individually
// -- it would save here and then be absent from the storefront
// listing, which would read as a broken category page.
await grid.locator(categoryForm.productSkuFilter).fill('product_dynamic');
await grid.locator(categoryForm.productSkuFilter).press('Enter');

// A legacy grid reloads over AJAX with no response this spec can
// reliably await, so the filtered state has to be polled for.
//
// Polling the row count is not enough, and getting that wrong is
// what this comment is for: the unfiltered grid already has rows,
// so "more than zero rows" is satisfied by the table that was on
// screen before Enter was pressed. The first attempt at this spec
// read a name off that stale table, then checked a box in the
// table that replaced it, and asserted on the storefront that the
// wrong product was listed. Poll for something only the filtered
// grid can satisfy instead.
const headers = (await grid.locator('thead th').allInnerTexts()).map((h) => h.trim());
const nameColumn = headers.indexOf('Name');
const skuColumn = headers.indexOf('SKU');
expect(nameColumn, `the grid should have a Name column; it has ${headers}`).toBeGreaterThan(-1);
expect(skuColumn, `the grid should have a SKU column; it has ${headers}`).toBeGreaterThan(-1);

await expect
.poll(
async () => {
const skus = await grid.locator(`tbody tr td:nth-child(${skuColumn + 1})`).allInnerTexts();
return skus.length > 0 && skus.every((sku) => sku.includes('product_dynamic'));
},
{
message: 'the grid should settle on the fixture products; seed the catalog first',
},
)
.toBe(true);

const row = grid.locator('tbody tr').first();
assignedProduct = (await row.locator('td').nth(nameColumn).innerText()).trim();
expect(assignedProduct, 'the grid row should carry a product name').not.toBe('');

// No name attribute on these checkboxes -- the value is the
// product id and the id is id_<product id>. Scoped to the row
// rather than selected by name, which there is none of.
await row.locator('input[type="checkbox"]').check();
await expect(row.locator('input[type="checkbox"]')).toBeChecked();
// The row that is checked is still the row that was read. If the
// grid re-rendered between the two, this is where that shows up
// rather than in a storefront assertion three steps later.
await expect(row.locator('td').nth(nameColumn)).toHaveText(assignedProduct);
});

await test.step('saving the category reports success', async () => {
await page.locator(categoryForm.save).click();

// Either message, with the same generous ceiling and the same
// reasoning as the product spec: a validation error should fail
// this in a second with its text on screen, and a slow first
// save on a cold runner should pass slowly rather than go red.
await expect(page.locator(categoryForm.anyMessage).first()).toBeVisible({ timeout: 240_000 });
await expect(page.locator(categoryForm.saved)).toContainText('You saved the category.');

// A persisted entity with an id, not the add form re-rendered
// with the values still in it.
await expect(page.locator('body')).toHaveClass(categoryForm.savedBodyClass);
await expect(page).toHaveURL(/catalog\/category\/edit\/id\/\d+/);
await expect(page.locator(adminSelectors.pageTitle)).toContainText(category.name);
// Read back off the saved form: what the store holds, not what
// the spec typed into a field.
await expect(page.locator(categoryForm.name)).toHaveValue(category.name);
});

await test.step('the storefront serves the category it has never seen', async () => {
// Straight to the url key. A url rewrite that was not generated
// for the new category is a 404 here, and that is the failure
// worth reporting rather than hiding behind navigation clicks.
const response = await page.goto(categoryUrl(category.urlKey));

expect(response?.status(), 'the url rewrite for a saved category should resolve').toBe(200);
await expect(page.locator('body')).toHaveClass(/catalog-category-view/);
await expect(page.locator(luma.pageTitle)).toContainText(category.name);

// The listing renders from catalog_category_product, which the
// save had to invalidate and reindex. An empty category page
// returns 200 and looks fine, so this is the assertion that the
// index actually ran.
// Exactly one product, and it is the one that was assigned. A
// count assertion as well as an identity one, because a category
// that lists the whole catalog is also broken -- and that is what
// a misconfigured anchor or display mode looks like.
const listing = page.locator(luma.productList);
await expect(listing.locator(luma.productItemLink)).toHaveCount(1);
await expect(listing.locator(luma.productItemLink)).toHaveText(assignedProduct);
});

await test.step('the navigation includes the category', async () => {
// The top menu is a cached block, and it was cached before this
// category existed. Saving a category has to invalidate it, which
// is a seam nothing else in this suite touches: a stale menu is a
// merchant-visible bug that no amount of product testing finds.
await expect(
page.locator(luma.navCategory).filter({ hasText: category.name }),
).toHaveCount(1);
});
});
});
Loading
Loading