From 8a2f7925415db106e3ba0d932201a0d2f482fb73 Mon Sep 17 00:00:00 2001 From: abhi1693 Date: Sat, 7 Feb 2026 19:06:47 +0000 Subject: [PATCH] E2E: add /sign-in redirect; use it in Clerk Cypress login helper --- frontend/cypress/support/commands.ts | 5 +++-- frontend/src/app/sign-in/page.tsx | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 frontend/src/app/sign-in/page.tsx diff --git a/frontend/cypress/support/commands.ts b/frontend/cypress/support/commands.ts index 43e0a070..1e83ec74 100644 --- a/frontend/cypress/support/commands.ts +++ b/frontend/cypress/support/commands.ts @@ -34,8 +34,9 @@ Cypress.Commands.add("loginWithClerkOtp", () => { const opts: ClerkOtpLoginOptions = { clerkOrigin, email, otp }; - // Trigger the modal from the app first. - cy.get('[data-testid="activity-signin"]').click({ force: true }); + // Navigate to a dedicated sign-in route that performs a top-level redirect + // to Clerk hosted sign-in (avoids modal/iframe limitations in Cypress). + cy.visit("/sign-in"); // The Clerk UI is typically hosted on a different origin (clerk.accounts.dev / clerk.com). // Use cy.origin to drive the UI in Chrome. diff --git a/frontend/src/app/sign-in/page.tsx b/frontend/src/app/sign-in/page.tsx new file mode 100644 index 00000000..0f47f3a9 --- /dev/null +++ b/frontend/src/app/sign-in/page.tsx @@ -0,0 +1,14 @@ +import { redirect } from "next/navigation"; +import { auth } from "@clerk/nextjs/server"; + +export default function SignInPage() { + const { userId, redirectToSignIn } = auth(); + + if (userId) { + redirect("/activity"); + } + + // Top-level redirect to Clerk hosted sign-in. + // Cypress E2E cannot reliably drive Clerk modal/iframe login. + return redirectToSignIn({ returnBackUrl: "/activity" }); +}