Skip to content

ci: run the UI tests (client, server, integration) on pull requests - #1059

Open
ilayfalach wants to merge 1 commit into
masterfrom
issue1045
Open

ci: run the UI tests (client, server, integration) on pull requests#1059
ilayfalach wants to merge 1 commit into
masterfrom
issue1045

Conversation

@ilayfalach

Copy link
Copy Markdown
Collaborator

Closes #1045.

ci.yml only ran pytest hera/tests/. The client, server and integration suites ran by hand, so all three had drifted out of sync with the code — none of them passed when first run. This adds the three CI jobs and repairs what they found.

CI jobs (.github/workflows/ci.yml)

Job What it runs
ui-client Node 22, npm ci, tsc --noEmit, unit tests, production build — the ui/client/TEST_UI.md checklist, in order
ui-server pytest ui/server/tests with only the four packages the tests need (they install a fake hera, so no database)
ui-integration MongoDB service on 27018 + the full Python env, running the same vitest command the Docker image runs

No Docker image is built in CI: globalSetup.ts starts ui/server/server.py itself, so the integration job takes minutes instead of the ~25 a base-image build costs.

Server tests — 6 were failing

Integration tests — 5 of 6 files were failing

  • App owns its BrowserRouter, so wrapping it in MemoryRouter threw "cannot render a <Router> inside another <Router>". The path is set on the jsdom location instead.
  • jsdom reports every element as 0x0, so flexlayout rendered tab titles but never tab content — the project tree simply did not exist in the DOM. setupIntegDom.ts gives jsdom a viewport and a ResizeObserver.
  • The tests now follow the UI as it is today: Add document / Delete project live in the project Actions popover, the document kind is a toggle group (and switching kind resets the name), the central repo folder expands only from its chevron, and deleting a document happens in the details view.
  • globalSetup waits for /ready instead of /healthz, and takes a free port from the OS instead of assuming 8000 — server.py silently moves to the next free port, and nothing then answers where the tests look.
  • testTimeout 20s: jsdom + MUI renders trip the 5s default when workers compete for cores.

Docker chain — could not build from a clean checkout

  • fonttools==4.61.0 needs Python >= 3.10, so pip install failed on the image's 3.9.13. Pinned back to 4.60.2 — it is the only pin in requirements.txt that 3.9 cannot resolve, so python_requires=">=3.9" still holds and the image stays on 3.9.
  • ui/server/requirements.txt was referenced by Dockerfile-server but had never been committed. Added; argcomplete (imported by server.py) is now declared in the root requirements.txt too.
  • Dockerfile-server ran hera/scripts/run_mongo.sh + add_repo.sh at build time — both moved to hera/scripts/temp/, and mongod is not in the image anyway. Removed, with a note on registering the repository at runtime.
  • .dockerignore now skips heraenv/, .claude/ and cache/, which otherwise add gigabytes to the build context.

Verified locally

client        45 files / 389 tests   tsc 0 errors   vite build ok
server        23 tests
integration    6 files /  25 tests
docker        hera -> hera-server -> hera-integ-test built on Python 3.9.13
              run_tests_docker.sh 23 passed | npm run test:integ 25 passed

🤖 Generated with Claude Code

Closes #1045.

ci.yml only ran pytest hera/tests/; the client, server and integration
suites ran by hand, so all three had drifted out of sync with the code
and none of them passed. Adds three jobs and repairs what they found.

CI (.github/workflows/ci.yml)
  - ui-client: Node 22, npm ci, tsc --noEmit, unit tests, production
    build — the ui/client/TEST_UI.md checklist, in order. Node 22 because
    the client uses Set.prototype.difference, which Node 20 lacks.
  - ui-server: pytest ui/server/tests with only the four packages the
    tests need; they install a fake hera, so no database is involved.
  - ui-integration: MongoDB service on 27018 plus the full Python env,
    running the same vitest command the Docker image runs. No image is
    built: globalSetup.ts starts the server itself.

Server tests (6 were failing)
  - /exec has answered WARMING_UP since #1030 until the warmup thread
    imported hera, which unit tests never start: new `warmed_up` fixture,
    plus a test for the WARMING_UP answer itself.
  - Since #1033 the workflow runs in a forked child, so what the fake
    hera recorded in memory died with the child. It now records to a
    file the parent reads back.

Integration tests (5 of 6 files were failing)
  - App owns its BrowserRouter, so wrapping it in MemoryRouter threw
    "cannot render a <Router> inside another <Router>". Set the path on
    the jsdom location instead.
  - jsdom reports every element as 0x0, so flexlayout rendered tab titles
    but never tab content — the project tree did not exist in the DOM.
    setupIntegDom.ts gives jsdom a viewport and a ResizeObserver.
  - Follow the UI as it is today: Add document / Delete project live in
    the project "Actions" popover, the document kind is a toggle group
    (and switching kind resets the name), the central repo folder expands
    only from its chevron, and deleting a document happens in the details
    view.
  - globalSetup waits for /ready instead of /healthz (/exec answers
    WARMING_UP until hera is imported) and takes a free port from the OS
    instead of assuming 8000 — server.py silently moves to the next free
    port, and nothing then answers where the tests look.
  - testTimeout 20s: jsdom + MUI renders trip the 5s default when workers
    compete for cores.

Docker chain (could not build from a clean checkout)
  - fonttools 4.61.0 needs Python >= 3.10, so pip install failed on the
    image's 3.9.13 and the base image did not build. Pinned back to
    4.60.2, the last release supporting 3.9 — it is the only pin in
    requirements.txt that 3.9 cannot resolve, so the declared support
    (setup.py python_requires>=3.9, README "Python 3.9+") still holds.
  - ui/server/requirements.txt was referenced by Dockerfile-server but had
    never been committed. Added, and argcomplete (imported by server.py)
    is now declared in the root requirements.txt too.
  - Dockerfile-server ran hera/scripts/run_mongo.sh + add_repo.sh at build
    time; both moved to hera/scripts/temp/ and mongod is not in the image
    anyway. Removed, with a note on registering the repository at runtime.
  - .dockerignore: skip heraenv/, .claude/ and cache/, which otherwise add
    gigabytes to the build context.

Verified locally: client 389 tests, server 23 tests, integration 25 tests,
plus the full Docker path on Python 3.9.13 (hera -> hera-server ->
hera-integ-test, run_tests_docker.sh and npm run test:integ).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lior-antonov

Copy link
Copy Markdown
Collaborator

@erasta can you please take a look and confirm the changes to your code are LGTM?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run UI tests in CI

2 participants