Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✅ Add browser-level checks to the Docker smoke test (#2848)

Luke Vella0375299a8e70
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 04cef39d8..883b7b2e6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -70,12 +70,42 @@ jobs:
steps:
- uses: actions/checkout@v4
+ # Shell exports don't reach the container — compose only forwards
+ # DATABASE_URL. The env_file (apps/web/.env) is how the stack reads
+ # config, so write the documented-required variables there.
- name: Start services
run: |
- SECRET_PASSWORD=test-secret \
- NEXT_PUBLIC_BASE_URL=http://localhost:3000 \
+ cat > apps/web/.env <<'EOF'
+ SECRET_PASSWORD=0123456789abcdef0123456789abcdef
+ NEXT_PUBLIC_BASE_URL=http://localhost:3000
+ EOF
docker compose up -d --build --wait --wait-timeout 60
+ # The image healthcheck hits /api/status, but that endpoint returns
+ # 200 even when the database is unreachable and doesn't touch env
+ # validation — assert both explicitly so a booted-but-broken stack
+ # fails here.
+ - name: Check status endpoint and login page respond
+ run: |
+ status=$(curl -fsS --connect-timeout 5 --max-time 15 \
+ http://localhost:3000/api/status)
+ echo "$status"
+ echo "$status" | jq -e '.database == "connected"'
+ curl -fsSL --connect-timeout 5 --max-time 15 \
+ -o /dev/null http://localhost:3000/login
+
+ - uses: ./.github/actions/setup-node
+ - uses: ./.github/actions/pnpm-install
+
+ - name: Install Playwright browser
+ run: pnpm --filter @rallly/web exec playwright install --with-deps chromium
+
+ # A crashed client bundle still serves 200s; only a browser loading
+ # the page catches that class of failure.
+ - name: Run browser smoke test against the image
+ run: pnpm --filter @rallly/web exec playwright test --config playwright.smoke.config.ts
+
- name: Show logs on failure
if: failure()
run: docker compose logs
diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts
index ca56a568d..e0afec133 100644
--- a/apps/web/playwright.config.ts
+++ b/apps/web/playwright.config.ts
@@ -25,6 +25,9 @@ export default defineConfig({
trace: "retain-on-failure",
},
testDir: "./tests",
+ // Smoke specs run against the production Docker image via
+ // playwright.smoke.config.ts, not the dev/test server.
+ testIgnore: "**/smoke/**",
webServer: {
// Local runs clear .next first: Turbopack's persistent dev cache
// (default on since Next 16.1) is shared across dev sessions, and a
diff --git a/apps/web/playwright.smoke.config.ts b/apps/web/playwright.smoke.config.ts
new file mode 100644
index 000000000..371a85afd
--- /dev/null
+++ b/apps/web/playwright.smoke.config.ts
@@ -0,0 +1,20 @@
+import { defineConfig, devices } from "@playwright/test";
+
+// Runs the smoke specs against an already-running production image (the
+// docker compose stack in CI) — no webServer, no .env.test. The regular
+// integration suite covers app behavior; this config exists to verify the
+// artifact self-hosters actually run: standalone build output, runtime env
+// injection, and client hydration.
+const baseURL = process.env.SMOKE_BASE_URL ?? "http://localhost:3000";
+
+export default defineConfig({
+ outputDir: "test-results/",
+ projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
+ use: {
+ viewport: { width: 1280, height: 720 },
+ baseURL,
+ trace: "retain-on-failure",
+ },
+ testDir: "./tests/smoke",
+ reporter: [[process.env.CI === "true" ? "github" : "list"]],
+});
diff --git a/apps/web/tests/smoke/docker-smoke.spec.ts b/apps/web/tests/smoke/docker-smoke.spec.ts
new file mode 100644
index 000000000..14f7b8b6d
--- /dev/null
+++ b/apps/web/tests/smoke/docker-smoke.spec.ts
@@ -0,0 +1,31 @@
+import { expect, test } from "@playwright/test";
+
+// A crashed client bundle (e.g. env validation running in the browser)
+// still serves 200s — only a real browser catches it, by observing the
+// uncaught exception and the error boundary replacing the page.
+
+test("unauthenticated visitor gets a working, hydrated login page", async ({
+ page,
+}) => {
+ const clientErrors: Error[] = [];
+ page.on("pageerror", (error) => clientErrors.push(error));
+
+ // Straight to /login rather than asserting redirect behavior from "/" —
+ // what "/" serves depends on auth and instance state (fresh instances
+ // serve guests a page directly), and routing policy isn't what this
+ // spec guards.
+ await page.goto("/login");
+
+ await expect(page.getByText("Welcome")).toBeVisible();
+
+ // Filling the form proves client JS booted and hydrated — a crashed
+ // bundle leaves the error boundary in place of the form.
+ await page
+ .getByPlaceholder("[email protected]")
+ .fill("[email protected]");
+ await expect(
+ page.getByRole("button", { name: "Continue with email" }),
+ ).toBeEnabled();
+
+ expect(clientErrors).toEqual([]);
+});