e2e: activity feed tests login first to avoid cross-origin redirect flake

This commit is contained in:
Kunal
2026-02-08 14:11:14 +00:00
parent 6a3aae8a8c
commit cb7d09f330

View File

@@ -22,10 +22,8 @@ describe("/activity feed", () => {
} }
it("auth negative: wrong OTP keeps us on sign-in", () => { it("auth negative: wrong OTP keeps us on sign-in", () => {
cy.visit("/activity"); // Start from app-origin sign-in to avoid cross-origin confusion.
cy.visit("/sign-in");
// Protected route should redirect to Clerk sign-in.
cy.location("pathname", { timeout: 20_000 }).should("match", /\/sign-in/);
// Override OTP just for this test. // Override OTP just for this test.
Cypress.env("CLERK_TEST_OTP", "000000"); Cypress.env("CLERK_TEST_OTP", "000000");
@@ -59,10 +57,10 @@ describe("/activity feed", () => {
stubStreamEmpty(); stubStreamEmpty();
cy.visit("/activity"); // Story: user signs in, then visits /activity and sees the live feed.
cy.location("pathname", { timeout: 20_000 }).should("match", /\/sign-in/);
cy.loginWithClerkOtp(); cy.loginWithClerkOtp();
cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList");
@@ -78,10 +76,10 @@ describe("/activity feed", () => {
stubStreamEmpty(); stubStreamEmpty();
cy.visit("/activity"); // Story: user signs in, then visits /activity and sees an empty-state message.
cy.location("pathname", { timeout: 20_000 }).should("match", /\/sign-in/);
cy.loginWithClerkOtp(); cy.loginWithClerkOtp();
cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList");
@@ -96,10 +94,10 @@ describe("/activity feed", () => {
stubStreamEmpty(); stubStreamEmpty();
cy.visit("/activity"); // Story: user signs in, then visits /activity; API fails and user sees an error.
cy.location("pathname", { timeout: 20_000 }).should("match", /\/sign-in/);
cy.loginWithClerkOtp(); cy.loginWithClerkOtp();
cy.visit("/activity");
assertSignedInAndLanded(); assertSignedInAndLanded();
cy.wait("@activityList"); cy.wait("@activityList");