test(e2e): intercept absolute /api/v1/activity and wait longer

This commit is contained in:
Abhimanyu Saharan
2026-02-12 10:57:41 +00:00
parent 60c7024085
commit 494ab324ec

View File

@@ -37,32 +37,6 @@ describe("/activity feed", () => {
cy.intercept("GET", `${apiBase}/agents/stream*`, emptySse).as("agentsStream"); cy.intercept("GET", `${apiBase}/agents/stream*`, emptySse).as("agentsStream");
} }
function stubBoardBootstrap() {
// Some app bootstraps happen before we get to the /activity call.
// Keep these stable so the page always reaches the activity request.
cy.intercept("GET", `${apiBase}/organizations/me/member*`, {
statusCode: 200,
body: { organization_id: "org1", role: "owner" },
}).as("orgMeMember");
cy.intercept("GET", `${apiBase}/boards*`, {
statusCode: 200,
body: {
items: [{ id: "b1", name: "Testing", updated_at: "2026-02-07T00:00:00Z" }],
},
}).as("boardsList");
cy.intercept("GET", `${apiBase}/boards/b1/snapshot*`, {
statusCode: 200,
body: {
tasks: [{ id: "t1", title: "CI hardening" }],
agents: [],
approvals: [],
chat_messages: [],
},
}).as("boardSnapshot");
}
function assertSignedInAndLanded() { function assertSignedInAndLanded() {
cy.waitForAppLoaded(); cy.waitForAppLoaded();
cy.contains(/live feed/i).should("be.visible"); cy.contains(/live feed/i).should("be.visible");
@@ -75,9 +49,7 @@ describe("/activity feed", () => {
}); });
it("happy path: renders task comment cards", () => { it("happy path: renders task comment cards", () => {
stubBoardBootstrap(); cy.intercept("GET", "**/api/v1/activity**", {
cy.intercept("GET", `${apiBase}/activity*`, {
statusCode: 200, statusCode: 200,
body: { body: {
items: [ items: [
@@ -104,7 +76,7 @@ describe("/activity feed", () => {
cy.visit("/activity"); cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList", { timeout: 20_000 });
// The Activity page lists generic activity events; task title enrichment is best-effort. // The Activity page lists generic activity events; task title enrichment is best-effort.
// When the task metadata isn't available yet, it renders as "Unknown task". // When the task metadata isn't available yet, it renders as "Unknown task".
@@ -113,9 +85,7 @@ describe("/activity feed", () => {
}); });
it("empty state: shows waiting message when no items", () => { it("empty state: shows waiting message when no items", () => {
stubBoardBootstrap(); cy.intercept("GET", "**/api/v1/activity**", {
cy.intercept("GET", `${apiBase}/activity*`, {
statusCode: 200, statusCode: 200,
body: { items: [] }, body: { items: [] },
}).as("activityList"); }).as("activityList");
@@ -128,15 +98,13 @@ describe("/activity feed", () => {
cy.visit("/activity"); cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList", { timeout: 20_000 });
cy.contains(/waiting for new activity/i).should("be.visible"); cy.contains(/waiting for new activity/i).should("be.visible");
}); });
it("error state: shows failure UI when API errors", () => { it("error state: shows failure UI when API errors", () => {
stubBoardBootstrap(); cy.intercept("GET", "**/api/v1/activity**", {
cy.intercept("GET", `${apiBase}/activity*`, {
statusCode: 500, statusCode: 500,
body: { detail: "boom" }, body: { detail: "boom" },
}).as("activityList"); }).as("activityList");
@@ -149,7 +117,7 @@ describe("/activity feed", () => {
cy.visit("/activity"); cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList", { timeout: 20_000 });
cy.contains(/unable to load activity feed/i).should("be.visible"); cy.contains(/unable to load activity feed/i).should("be.visible");
}); });