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");
}
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() {
cy.waitForAppLoaded();
cy.contains(/live feed/i).should("be.visible");
@@ -75,9 +49,7 @@ describe("/activity feed", () => {
});
it("happy path: renders task comment cards", () => {
stubBoardBootstrap();
cy.intercept("GET", `${apiBase}/activity*`, {
cy.intercept("GET", "**/api/v1/activity**", {
statusCode: 200,
body: {
items: [
@@ -104,7 +76,7 @@ describe("/activity feed", () => {
cy.visit("/activity");
assertSignedInAndLanded();
cy.wait("@activityList");
cy.wait("@activityList", { timeout: 20_000 });
// 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".
@@ -113,9 +85,7 @@ describe("/activity feed", () => {
});
it("empty state: shows waiting message when no items", () => {
stubBoardBootstrap();
cy.intercept("GET", `${apiBase}/activity*`, {
cy.intercept("GET", "**/api/v1/activity**", {
statusCode: 200,
body: { items: [] },
}).as("activityList");
@@ -128,15 +98,13 @@ describe("/activity feed", () => {
cy.visit("/activity");
assertSignedInAndLanded();
cy.wait("@activityList");
cy.wait("@activityList", { timeout: 20_000 });
cy.contains(/waiting for new activity/i).should("be.visible");
});
it("error state: shows failure UI when API errors", () => {
stubBoardBootstrap();
cy.intercept("GET", `${apiBase}/activity*`, {
cy.intercept("GET", "**/api/v1/activity**", {
statusCode: 500,
body: { detail: "boom" },
}).as("activityList");
@@ -149,7 +117,7 @@ describe("/activity feed", () => {
cy.visit("/activity");
assertSignedInAndLanded();
cy.wait("@activityList");
cy.wait("@activityList", { timeout: 20_000 });
cy.contains(/unable to load activity feed/i).should("be.visible");
});