[CRAFTING] Add mxcli tooling for editing and inspecting e2e test projects#2240
[CRAFTING] Add mxcli tooling for editing and inspecting e2e test projects#2240leonardomendix wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
AI Code Review
What was reviewed
Skipped (out of scope): CI checks were not retrievable in this session — verify CI is green before merging. Findings
|
|
|
||
| - Specs live at: `packages/pluggableWidgets/<widget>/e2e/*.spec.js` | ||
| - Playwright strict mode is ON | ||
| - Full rules: `docs/requirements/e2e-test-guidelines.md` |
There was a problem hiding this comment.
The instructions are different. One is a guardrail to avoid duplication when this file is edited by an agent, and the other defines the context for the command.
|
|
||
| ```bash | ||
| # Full overview: modules, pages, entities, navigation menu labels | ||
| bash automation/mxcli/mx-testproject.sh inspect <widget> |
There was a problem hiding this comment.
It's a helper for inspecting MPR file and describing pages, modules, widgets, etc.
|
|
||
| ```bash | ||
| # Full CI run (Docker): | ||
| pnpm --filter @mendix/<widget> run e2e |
There was a problem hiding this comment.
And here, they are likely different?
There was a problem hiding this comment.
Yeah, in a certain way. This is the way to pass some flags to skip rebuilding and redownloading test project, and then you have the test project files locally to be able to commit to the testProjects repository.
| ## Checklist | ||
|
|
||
| - [ ] Import from `@mendix/run-e2e/fixtures` — NOT `@playwright/test` | ||
| - [ ] No manual `afterEach` logout — fixture handles it | ||
| - [ ] No `waitForLoadState("networkidle")` — prohibited, see guidelines | ||
| - [ ] No locator matches multiple elements without `.first()` or a compound selector | ||
| - [ ] No assertions on Atlas design classes | ||
| - [ ] All tests pass in CI (`pnpm run e2e`) |
There was a problem hiding this comment.
[Part of it] is duplication from guidelines.
There was a problem hiding this comment.
It's a checklist based on the guidelines to make the command more precise.
| ## Prerequisites | ||
|
|
||
| - `automation/tools/mxcli` must exist. If missing, run: `bash automation/mxcli/setup.sh` | ||
| - The `.mpr` test project must be **closed in Studio Pro** before any mxcli edits |
There was a problem hiding this comment.
Maybe checking the lock file in the test project folder?
| For **brand-new empty pages** created by mxcli, direct URL works: | ||
|
|
||
| ```js | ||
| await page.goto("/p/my-new-page"); | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Is is passed in some way or auto generated, how to know the url?
There was a problem hiding this comment.
It's auto-generated. It knows when inspecting the mpr file using mxcli.
|
|
||
| ## Warnings | ||
|
|
||
| - `CREATE OR MODIFY PAGE ... {}` wipes all widget content — never use on existing pages |
There was a problem hiding this comment.
It is mentioned before in the document
There was a problem hiding this comment.
Indeed, I'll fix that.
| ## Warnings | ||
|
|
||
| - `CREATE OR MODIFY PAGE ... {}` wipes all widget content — never use on existing pages | ||
| - Do NOT run mxcli while Studio Pro has the project open |
There was a problem hiding this comment.
Maybe the lock file, I'll try to see if that's possible.
| await page.goto("/p/my-new-page"); | ||
| ``` | ||
|
|
||
| After edits: Studio Pro shows "Project was modified externally" — click **Reload**. |
There was a problem hiding this comment.
Not sure to which section it belongs. It mentions project should not be modified when project is open in it.
There was a problem hiding this comment.
Good one, I think I'll remove this part.
Pull request type
Test related change (New E2E test, test automation, etc.)
Description
This PR introduces automation/mxcli/ — a pair of scripts and Claude Code configuration that let AI agents (and developers) read and modify widget .mpr test projects using mxcli (https://github.com/mendixlabs/mxcli), a
CLI tool for Mendix projects. It also adds three Claude Code slash commands that chain these tools into a complete e2e development workflow.
What is mxcli?
mxcli reads and writes Mendix .mpr binary project files using MDL (Mendix Definition Language), a SQL-like syntax. This allows an AI agent to inspect page structure, discover widget names, create new pages, and validate changes — without opening Studio Pro.