Skip to content

app: e2e-tests: Make the desktop suite runnable as documented - #6654

Merged
illume merged 1 commit into
kubernetes-sigs:mainfrom
unlikelyzero:fix-desktop-e2e-docs-and-script
Jul 27, 2026
Merged

illume merged 1 commit into
kubernetes-sigs:mainfrom
unlikelyzero:fix-desktop-e2e-docs-and-script

Conversation

@unlikelyzero

@unlikelyzero unlikelyzero commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Two problems stopped the desktop e2e suite from being runnable by following the documentation.

npm run app:test:e2e failed immediately with Missing script: "test". The root script delegated to a test script in app/e2e-tests that does not exist; that package only defines test-app and test-web.

Separately, the README omitted a required setup step. app/package.json declares "main": "build/main.js" and the specs launch the app with electron ., which resolves that field, but nothing in the README or the specs created it.

Related Issue

Fixes #6633
Fixes #6640

Changes

  • Root app:test:e2e now points at test-app, the mode these tests are written for. Adding a delegating test script to app/e2e-tests would also have fixed the error, but it puts another npm run in the chain and arguments are not forwarded across those, so flags would be silently dropped.
  • Added a pretest-app hook that runs compile-electron -- --dev, so the Electron entry point is built automatically and the suite cannot be run against a missing one. That seemed better than documenting one more manual step people can skip.
  • Rewrote app/e2e-tests/README.md around what the suite actually requires.

The README changes are based on getting the suite running rather than on reading the source. The previously undocumented requirements:

  • A minikube cluster named minikube. The name matters: clusterRename.spec.ts expects it, and clusterAutoConnect.spec.ts shells out to minikube directly to create and delete its own throwaway profile, so both minikube and kubectl must be on PATH.
  • The frontend and backend built, because app mode runs the app from source. With ELECTRON_DEV=true, app/electron/main.ts resolves ../frontend/build/index.html (main.ts:91) and ../backend/headlamp-server (main.ts:772).
  • Chromium installed, even though these are Electron tests. Every spec requests Playwright's page fixture before switching to the Electron window, and requesting it launches a browser. This one is easy to miss.

It also documents that flags cannot be passed through npm run app:test:e2e from the repository root, because that delegates to a second npm run; run the script from app/e2e-tests when you need flags.

Steps to Test

The script fix, which needs no cluster:

# Before: Missing script: "test"
# After: resolves and starts Playwright
node -p "require('./package.json').scripts['app:test:e2e']"
# -> cd app/e2e-tests && npm run test-app

The pre-hook, which is the point of the second fix:

rm -f app/build/main.js
cd app/e2e-tests && npm run pretest-app
ls -la ../build/main.js     # rebuilt

That the suite is discoverable, without running it:

cd app/e2e-tests
PLAYWRIGHT_TEST_MODE=app npx playwright test --list
# -> Total: 4 tests in 3 files

Then follow the README from a clean checkout and confirm you reach a running suite.

Screenshots (if applicable)

Not applicable, docs and npm scripts only.

Notes for the Reviewer

@kubernetes-prow
kubernetes-prow Bot requested review from gambtho and skoeva July 26, 2026 16:35
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jul 26, 2026
@unlikelyzero
unlikelyzero force-pushed the fix-desktop-e2e-docs-and-script branch from ff74ea8 to 034f197 Compare July 26, 2026 17:24
@illume illume added this to the v0.44.0 milestone Jul 27, 2026
@illume
illume requested a review from Copilot July 27, 2026 07:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the developer entry point for running the desktop (Electron) Playwright e2e suite and updates the accompanying README so the suite can be invoked by following the documented steps.

Changes:

  • Updated the root app:test:e2e script to call test-app (the script that actually exists in app/e2e-tests).
  • Added a pretest-app hook in app/e2e-tests to ensure the Electron entry point (app/build/main.js) is compiled before tests run.
  • Rewrote app/e2e-tests/README.md to document the real prerequisites and workflows for app vs web mode.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
package.json Fixes the root e2e script to invoke the correct desktop test script (test-app).
app/e2e-tests/package.json Adds pretest-app to build Electron dev output before running app-mode Playwright tests.
app/e2e-tests/README.md Updates documentation to reflect actual prerequisites and how to run app/web modes.

Comment thread app/e2e-tests/README.md Outdated
@illume illume self-assigned this Jul 27, 2026
@illume
illume requested a review from Copilot July 27, 2026 09:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

app/e2e-tests/README.md:77

  • This note says flags cannot be passed through npm run app:test:e2e, but they can be forwarded if you include an extra -- so the second npm run receives the arguments. As written, readers may conclude it’s impossible rather than just slightly awkward.
Note that flags cannot be passed through `npm run app:test:e2e` from the root,
because that delegates to a second `npm run` and the arguments are not
forwarded. Run the script from `app/e2e-tests` when you need flags.

Comment thread app/e2e-tests/README.md Outdated
Comment thread package.json Outdated
Two problems stopped the desktop e2e suite from being runnable by
following the documentation.

`npm run app:test:e2e` failed with `Missing script: "test"`. The root
script delegated to a `test` script in app/e2e-tests that does not exist;
that package only defines `test-app` and `test-web`. Point the root script
at `test-app`, which is the mode these tests are written for. Adding a
delegating `test` script would also have worked, but it puts another
`npm run` in the chain, and arguments are not forwarded across those.

The README was missing a required setup step. app/package.json declares
`main: build/main.js` and the specs launch the app with `electron .`, which
resolves that field, but nothing created it. Rather than document another
manual step, build it from a `pretest-app` hook so the suite cannot be run
against a missing entry point.

The README is rewritten around what the suite actually needs, verified by
running it: a minikube cluster named `minikube` (the name matters, and
`minikube` and `kubectl` must be on PATH), the frontend and backend built
because app mode runs from source, and Chromium installed even though these
are Electron tests, because the specs request Playwright's `page` fixture
before switching to the Electron window.

Also documents that flags cannot be passed through `npm run app:test:e2e`
from the root, since that delegates to a second `npm run`.

This does not make the suite pass; it currently fails for unrelated reasons
tracked in kubernetes-sigs#6648 and fixed in kubernetes-sigs#6641.
@illume
illume force-pushed the fix-desktop-e2e-docs-and-script branch from 034f197 to 7c78437 Compare July 27, 2026 10:39

@illume illume left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 🎉

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: illume, unlikelyzero

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2026
@illume
illume merged commit 24ddf1c into kubernetes-sigs:main Jul 27, 2026
11 of 12 checks passed
@illume illume added app e2e-tests End to end tests labels Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. e2e-tests End to end tests size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

app/e2e-tests README is missing the compile-electron step npm run app:test:e2e fails with Missing script: "test"

3 participants