Skip to content

Run the webapp Cypress suite in CI #276

Description

@HMarzban

Problem

No CI job runs the webapp Cypress suite. A broken chatroom spec cannot fail a CI job, so nobody sees it.

A code trace on 14ab7f9c1 shows:

  • prod.docs.plus.yml and stage.docs.plus.yml run bash scripts/run-tests.sh --extensions (.github/workflows/prod.docs.plus.yml:298, .github/workflows/stage.docs.plus.yml:127). That mode runs extension gates only, never a webapp spec. Stage runs all five. Prod runs one gate per changed extension.
  • Both also run webapp Jest with bun run --filter @docs.plus/webapp test (.github/workflows/prod.docs.plus.yml:337, .github/workflows/stage.docs.plus.yml:145).
  • scripts/run-tests.sh has an --e2e mode (scripts/run-tests.sh:43). No workflow calls it.
  • backend-ci.yml runs backend suites only: unit, integration, and real-infra E2E. Only the prod pipeline calls it, never stage or a pull request (.github/workflows/backend-ci.yml:3-6).

One chatroom spec fails today, and no job reports it. apps/webapp/cypress/e2e/chatroom/send-and-retry.cy.ts asserts a [data-status] attribute that the feed never renders. #263 fixes that spec. Without a CI job, the next spec failure goes unreported too.

The suite needs preconditions that CI does not provide yet:

  • NEXT_PUBLIC_E2E=true on the webapp dev server. Without it, /c/[channelId] renders nothing on the dev server, so all nine chatroom specs fail at their first visit (apps/webapp/src/pages/c/[channelId].tsx:53-59).
  • A Supabase URL and anon key, so the client starts. The specs stub the reads they assert with cy.intercept, and no seed creates test-channel. Four specs (jump-to-present, long-press-reaction, reply-jump-in-window, scroll-and-prepend) stub no messages, so they can fail even with the flag.
  • apps/webapp/cypress/e2e/document/draft-first-edit-anchor.cy.ts hardcodes http://localhost:3001 (:8). Its cy.task calls (:22, :32) run psql in the docsy-postgres-local container, not in Supabase (apps/webapp/cypress.config.ts:7-37). It needs the whole local stack. Without the container, one of its tests passes with no database (apps/webapp/cypress.config.ts:34-36).
  • The runner counts every webapp spec, which is 54 today (scripts/run-tests.sh:443-460). It also prompts when the webapp does not answer (:87-98). A chatroom-only job needs a spec scope.

Acceptance criteria

  • Before the workflow lands, a local run of the nine chatroom specs with NEXT_PUBLIC_E2E=true is posted on this issue, with the result for each spec.
  • A workflow runs the nine chatroom specs on pushes to main, and on pull requests to main that change chatroom code or chatroom specs.
  • The job serves the webapp with NEXT_PUBLIC_E2E=true, a Supabase URL, and an anon key. It starts every service that the local run needed.
  • A failing chatroom spec fails the job.
  • The spec-count check counts the job's scope, so a chatroom spec that does not run fails the job.
  • Every other webapp spec either joins the job or is listed on this issue with the reason it stays out.

Agent Brief

Category: enhancement
Summary: Add a CI job that runs the webapp chatroom Cypress specs against the webapp dev server with the E2E flag.

Current behavior:
CI runs the extension Cypress gates, webapp Jest, and the backend test suites. The webapp Cypress suite runs only by hand, on a laptop.

Desired behavior:
The chatroom specs run in CI and fail the job when they fail. The job provides every precondition the specs need.

Key interfaces:

  • The webapp E2E mode of the shared test runner, root script test:e2e. It runs every webapp spec and fails when fewer specs ran than exist. A chatroom-only job needs a spec scope, and the count check must use the same scope.
  • NEXT_PUBLIC_E2E — gates the chatroom test page at /c/<channelId>.
  • The shared Cypress binary setup action. The extension gates already use it; reuse it for the webapp job.

Out of scope

  • The extension gates and the backend jobs.
  • Making the new job block deploys. Decide that once the job is stable.
  • Fixing individual specs, unless a spec cannot run in CI at all.

Notes

Reuse scripts/run-tests.sh. Do not write a second runner. Add a spec scope to --e2e, and scope the count check to match. Start the webapp and wait for it first, because the runner prompts when the server is down.

Land this job after #263. Until then, two send-and-retry tests fail, so the job starts red.

No spec covers the phone composer. The specs only call cy.viewport, the /c test page renders the desktop variant (apps/webapp/src/pages/c/[channelId].tsx:65), and the phone shell is chosen by user agent.

Activity

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

    ChatRelated to chat featuresDevOpsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions