e2e: activity feed tests login first to avoid cross-origin redirect flake
This commit is contained in:
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user