test(e2e): migrate Cypress auth to @clerk/testing commands
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
describe("Clerk login (OTP)", () => {
|
||||
it("can sign in via Clerk modal", () => {
|
||||
// Skip unless explicitly configured.
|
||||
const clerkOrigin = Cypress.env("CLERK_ORIGIN");
|
||||
const email = Cypress.env("CLERK_TEST_EMAIL");
|
||||
const otp = Cypress.env("CLERK_TEST_OTP");
|
||||
describe("Clerk login", () => {
|
||||
it("user can sign in via Clerk testing commands", () => {
|
||||
const email = Cypress.env("CLERK_TEST_EMAIL") || "jane+clerk_test@example.com";
|
||||
|
||||
if (!clerkOrigin || !email || !otp) {
|
||||
cy.log("Skipping: missing CYPRESS_CLERK_ORIGIN / CYPRESS_CLERK_TEST_EMAIL / CYPRESS_CLERK_TEST_OTP");
|
||||
return;
|
||||
}
|
||||
// Prereq per Clerk docs: visit a non-protected page that loads Clerk.
|
||||
cy.visit("/sign-in");
|
||||
cy.clerkLoaded();
|
||||
|
||||
cy.clerkSignIn({ strategy: "email_code", identifier: email });
|
||||
|
||||
// After login, user should be able to access protected route.
|
||||
cy.visit("/activity");
|
||||
cy.loginWithClerkOtp();
|
||||
|
||||
// After login, the SignedIn UI should render.
|
||||
cy.contains(/live feed/i, { timeout: 20_000 }).should("be.visible");
|
||||
cy.contains(/live feed/i, { timeout: 30_000 }).should("be.visible");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user