[haxcms-nodejs] Expand E2E UI tests (edit/export/page-mgmt) + document QA process - #17
Merged
Conversation
…t QA process Adds three new E2E workflows to the suite established in PR #16, covering the remaining core user tasks from issue #2939, and documents the E2E suite in AGENTS.md so future agents run it as part of their QA workflow. New E2E tests (all reuse the existing 5-layer harness + helpers, all on the fixed site HAXSITEAUTOMATEDTESTING): - edit-content: open the HAX site editor, type content via importContent, save, assert PATCH /x/api/v1/content/:idOrSlug 200 + typed content present in the page HTML file on disk. Uses a recursive shadow-DOM walk to reach hax-body (haxcms-site-editor renders inside the active theme at a variable depth). - export-site: trigger download via the site card more-vert menu, assert POST /sites/:siteName/download 200 + data.link ends .zip + zip exists at _published/haxsiteautomatedtesting.zip with PK magic bytes. - page-management: add a page via the haxcms-create-node global event (POST /x/api/v1/items 200 + data.id + title), delete it via haxcms-delete-node (DELETE /x/api/v1/items/:id 200), and verify the page is removed from the site.json manifest + items list. (Note: the backend intentionally leaves the page directory on disk after delete — the test asserts the truthful manifest/items behavior, not a directory-removal that doesn't happen.) Selector map extended (test/e2e/helpers/selectors.cjs) with editor, export, and outline selector groups + saveNode/createNode/deleteNode/saveOutline/downloadSite API paths, verified by a headless discovery pass (.discovery-editor.cjs). QA process documentation (AGENTS.md): - Rewrote Testing Instructions to document all three test tiers (test:e2e, test:api-conformance, npm test) with prerequisites. - Updated Pre-commit checks to require test:e2e before/after dashboard/editor/ route changes and test:api-conformance after API route changes. - Added a 'QA process for agents' subsection with the 5-step workflow future agents should follow (establish green baseline, re-run after changes, review visual warnings, reuse helpers for new tests, run both suites for full coverage) plus the key gotchas (light-DOM login, HAXCMS_ROOT trailing slash, variable-depth editor shadow DOM). Full suite: 33 tests, 32 pass, 0 fail, 1 skipped. Tracks: haxtheweb/issues#2939 Co-Authored-By: Oz <oz-agent@warp.dev>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
There was a problem hiding this comment.
Pull request overview
Expands the existing test/e2e puppeteer-driven workflow suite to cover additional core HAXcms UI tasks (edit/save content, export/download site, add/delete page) and updates contributor/agent documentation to standardize QA expectations.
Changes:
- Added 3 new E2E UI workflow tests for editor save, site export, and page management.
- Extended the centralized selector/API-path map and added an editor-focused discovery script.
- Updated
AGENTS.mdandtest/e2e/README.mdto document the full QA/test workflow and new test coverage.
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
AGENTS.md |
Documents the 3-tier testing strategy and a concrete QA workflow for agents/contributors. |
test/e2e/README.md |
Updates E2E documentation to include the new workflows and discovery script. |
test/e2e/helpers/selectors.cjs |
Adds selector groups + API path constants for editor/export/outline flows. |
test/e2e/helpers/.discovery-editor.cjs |
Adds a discovery script to validate editor/export/outline DOM and request shapes. |
test/e2e/edit-content.e2e.test.cjs |
New workflow test for editing and saving content via the site editor. |
test/e2e/export-site.e2e.test.cjs |
New workflow test for downloading a site zip via the dashboard UI. |
test/e2e/page-management.e2e.test.cjs |
New workflow test for creating and deleting a page, plus outline-dialog a11y/visual capture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| (outlineDiff.diffPercent * 100).toFixed(3) + '% (WARN only, non-fatal)', | ||
| ) | ||
| } | ||
| }, { timeout: 360000 }) |
Comment on lines
+8
to
+11
| // /x/api/v1/items cross-check that the page is present -> DELETE the page via the | ||
| // VERIFIED global `haxcms-delete-node` event (DELETE /x/api/v1/items/:id) -> | ||
| // disk cross-check (page directory removed) -> open the outline editor dialog -> | ||
| // a11y scan scoped to the outline dialog -> visual baseline 'page-management-outline'. |
Comment on lines
+65
to
+74
| // --- HAXCMS_ROOT harness workaround --------------------------------------- | ||
| // The E2E harness sets process.env.HAXCMS_ROOT to runtimeRoot WITHOUT a | ||
| // trailing slash. HAXCMS.js captures a module-level const HAXCMS_ROOT at load | ||
| // time, and createSite() uses STRING concatenation (HAXCMS_ROOT + sitesDirectory) | ||
| // which yields "runtimeRoot_sites" (missing path separator) instead of | ||
| // "runtimeRoot/_sites". loadSite() and downloadSite() use the INSTANCE property | ||
| // HAXCMS.HAXCMS_ROOT, so patching the instance property fixes those routes. | ||
| // We cannot patch the module-level const, so after create we relocate the site | ||
| // dir from "runtimeRoot_sites" into "runtimeRoot/_sites" so the patched | ||
| // load/download routes find it. Same workaround as archive-site test. |
Comment on lines
+82
to
+84
| // Relocate the just-created site from the module-const write path | ||
| // (runtimeRoot + "_sites" = "runtimeRoot_sites") into the path.join path | ||
| // (runtimeRoot/_sites) so the patched load/download routes find it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Expands the E2E UI test suite (established in PR #16) with three new workflows covering the remaining core user tasks from issue #2939, and documents the suite in
AGENTS.mdso future agents run it as part of their QA workflow.Tracks: haxtheweb/issues#2939
New E2E tests
All reuse the existing 5-layer harness + helpers, all on the fixed site
HAXSITEAUTOMATEDTESTING:edit-content.e2e.test.cjsPATCH /x/api/v1/content/:idOrSlug(saveNode) → 200; typed content present in the page HTML file on disk; a11y scan of editor chrome; visual baseline (editor in edit mode)export-site.e2e.test.cjsPOST /sites/:siteName/download→ 200 +data.linkends.zip+data.name; zip exists at_published/haxsiteautomatedtesting.zipwith PK magic bytes; a11y + visual baselinespage-management.e2e.test.cjsPOST /x/api/v1/items(createNode) → 200 +data.id+data.title;DELETE /x/api/v1/items/:id→ 200; page removed from site.json manifest + items list; a11y + visual baselinesSelector map extended
test/e2e/helpers/selectors.cjsnow includeseditor,export, andoutlineselector groups plussaveNode/createNode/deleteNode/saveOutline/downloadSiteAPI paths, verified by a headless discovery pass (test/e2e/helpers/.discovery-editor.cjs).QA process documentation (AGENTS.md)
test:e2e(UI workflow tests via headless Chrome),test:api-conformance(API contract tests), andnpm test(generic), with prerequisites and a pointer totest/e2e/README.md.npm run test:e2ebefore/after changes that touch the app-hax dashboard, site editor, or system/site API routes, andnpm run test:api-conformanceafter API route changes.HAXCMS_ROOTtrailing slash, variable-depth editor shadow DOM).Test results
Full suite (all 6 E2E tests):
(The 1 skip is the optional login negative-path subtest from PR #16.)
How to run
Prerequisites: Chrome/Chromium on the host (auto-detected; override with
PUPPETEER_EXECUTABLE_PATH). Full docs intest/e2e/README.md.Notable findings during implementation
haxcms-site-editorrenders inside the active theme at a variable shadow-DOM depth, sodeepQuerycan't reach it. The edit-content test uses a recursive shadow-DOM walk to findhax-bodyand calls itsimportContent(html)method to type.simple-toolbar-buttonhost for "Download" doesn't fire the click — the handler lives on the inner<button>in its shadowRoot. The export test clicks the inner button (same escalation pattern as the archive test).HAXCMSSite.deleteNode()only splices the item out ofmanifest.items+ savessite.json— it does NOT delete thepages/item-<uuid>/directory (left orphaned by design). The page-management test asserts the truthful behavior (page removed from manifest + items list), not a directory-removal that doesn't happen.createNode/deleteNodeis dispatchinghaxcms-create-node/haxcms-delete-nodeglobal events (which the site-editor listens for), rather than driving the outline designer UI directly.Co-Authored-By: Oz oz-agent@warp.dev