Skip to content

scaffold installs the e2e harness but not its dependencies: a fresh project has no package.json or playwright, and the cached browser can be the wrong revision #675

Open

Description

@MendixMau

Summary

bin/init-project.sh / bin/install-tests.sh copy tests/e2e/*.js into a project but write no package.json and run no npm install. The first verify-module.sh therefore cannot run journeys, monkey or the rendered design audit. HEAD now reports this as one clear row ("e2e harness dependency", verify-module.sh:645-672, from #446/#501), which is a real improvement, but the fix is still "run this command by hand", and on a machine whose cached Chromium is an older revision than the newest playwright the plain fix command still ends in a browser launch failure. The follow-up that #502 left open ("install the e2e harness from init-project.sh / sync-project.sh") is listed there as not done, and #502 is closed.

Repro

mkdir -p /tmp/r9/tests/e2e && cd /tmp/r9
cp <toolkit>/project-tests/e2e/helpers.js tests/e2e/
ls                                  # no package.json, no node_modules
node -e 'try{require.resolve("playwright",{paths:["tests/e2e"]})}catch(e){console.log("missing:",e.code)}'

With a real scaffold: bin/init-project.sh <dir> (or sync-project.sh), then bin/verify-module.sh MyModule.

Observed

missing: MODULE_NOT_FOUND

and, from a fresh scaffold, the summary starts with the FAULT row "e2e harness dependency: not installed: playwright axe-core" plus the instruction (cd "$ROOT" && npm install playwright axe-core && npx playwright install chromium). Nothing in the scaffold ran that command. In the field run the only cached Chromium was revision 1217 (older than any playwright the project could install), so after npm install the harness still needed a matching playwright plus npx playwright install chromium-headless-shell, done by hand in a scratch directory.

Expected

The scaffold (or doctor.sh --fix, or test-stack-up.sh as a first-use step) creates a pinned package.json for the harness, runs npm ci, installs the matching browser, and exports the module path so the harness scripts find it wherever the project keeps them. doctor.sh should say whether the browser revision on the machine matches the installed playwright.

Root cause

  • bin/install-tests.sh has no npm/package.json step (grep returns nothing); bin/init-project.sh:387-399 and bin/sync-project.sh:1334-1394 copy and refresh the engine files only.
  • bin/doctor.sh:1689 merely prints a note: "e2e additionally needs a Playwright browser in the project: npx playwright install chromium".
  • project-tests/e2e/helpers.js:21-32 degrades to a clear INSTRUMENT FAULT (good), and its FALLBACK_CHROMIUM (:46-51) points at /opt/pw-browsers/chromium, a container path, so a workstation with an older cached browser gets no fallback at all.

Workaround

cd <project> && npm install playwright axe-core && npx playwright install chromium

If a browser launch still fails with a revision error, install the headless shell for the same playwright version (npx playwright install chromium-headless-shell) or pin playwright to the revision already cached.

Suggested fix

Provide project-tests/e2e/package.json with exact versions, copy it with the engine, run npm ci and the browser install from install-tests.sh (idempotent, skipped when node_modules/playwright already resolves), and add the revision check to doctor.sh. Keep the existing verify-module probe as the safety net.

Related

Closed: #446 and PR #501 (probe and one-row report, done), #502 (follow-ups, the install item still open in substance). Open, related scope: #525 (local lane: what runs where).

Versions

  • mxcli: nightly-20261105-f3c4d531d (not involved)
  • Mendix: 11.15.0
  • Toolkit: 97c1139c (field run used c9dedb11; every file:line above was re-read at 97c1139c)

🤖 Generated with Claude Code

Activity

  1. MendixMau commented on Nov 6, 2026

    @MendixMau
    OwnerAuthor

    Triage: DISCUSS track. instrument gap / portability, verified by inspection
    Root cause / Problem:

    • bin/install-tests.sh has no npm or package.json step (grep finds nothing).
    • bin/init-project.sh:386-402 and bin/sync-project.sh:1334ff copy engine files only.
    • bin/doctor.sh:1689 is only a note.
    • project-bin/verify-module.sh:645-667 reports the one FAULT row with the manual fix.
    • project-tests/e2e/helpers.js:46-60 falls back only to the container path /opt/pw-browsers/chromium.

    PW_EXECUTABLE (helpers.js:53) already lets a workstation point at its cached browser. That is today's best workaround, but the FAULT text doesn't mention it. The issue's line numbers are current. #502 is closed; #525 (local lane) is related.
    Value: M. Every fresh project's first verify-module FAULTs on the e2e rungs, and the browser-revision case costs a manual round trip.
    Risk of fixing: M. A network install at scaffold or sync can fail offline or behind a proxy (it must be non-fatal) and adds hundreds of MB. On Git Bash, npx/npm are .cmd shims (field-proof rule 3).
    Rigidity check: n/a (DISCUSS: new artifact and a new scaffold step)
    Process cost (#687): per project (scaffold/sync) or per machine (doctor). Option 2 is est. +30–120 s and ~150–300 MB once per project. Nothing per build row. Today: one FAULT and a manual fix per new project.
    Needs clarification: no
    Learning value: learned rule in the test/doctor skill docs: the harness ships its own pinned manifest, and the browser revision must match the installed playwright.
    Proposed fix / Options:

    1. Ship a pinned project-tests/e2e/package.json (plus lockfile), copied by install-tests.sh. The FAULT text becomes npm ci + npx playwright install chromium and mentions PW_EXECUTABLE. All entry modes that run e2e. Risk L, no scaffold cost.
    2. Option 1, plus install-tests.sh runs npm ci and the browser install when node is present and playwright does not resolve (opt-out env var, non-fatal). Risk M, cost above.
    3. Option 1, plus doctor.sh checks the cached browser revision against the installed playwright, and doctor.sh --fix installs on demand. Risk L, cost per machine, on request only.
      Proof: a scoped fixture that runs install-tests.sh into a temp project and asserts tests/e2e/package.json exists. Fails on master.
      Effort: M. Recommendation: DISCUSS: options 1 + 3. Decision needed: may init/sync run a network npm ci and browser download, or should they only ship the pinned manifest and leave the install to one command or doctor.sh --fix?
      Labels: kind/bug, size/m (kind/process proposed, not synced)

    Reply go (FIX) or go option N (DISCUSS). Fix PRs still get independent review and your merge.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions