clerk-testing

Configures end-to-end authentication flow tests for Clerk apps using Playwright or Cypress.

Updated Apr 19, 2026
One-click install
npx skills add https://github.com/divinaarmuela/Content --skill clerk-testing-divinaarmuela
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-testing
Source: https://github.com/divinaarmuela/Content/tree/main/.claude/skills/clerk-testing
Command: npx skills add https://github.com/divinaarmuela/Content --skill clerk-testing-divinaarmuela

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing E2E tests for Clerk-authenticated apps is tricky because bot detection blocks automated sign-ins and repeating UI logins makes test suites slow. This Skill guides you through the official Clerk testing setup so auth flows can be tested reliably. ## Core Features & Use Cases - Framework Decision Tree: Routes you to the correct official Clerk documentation for Playwright or Cypress. - Testing Token Setup: Explains clerkSetup() and setupClerkTestingToken() to bypass bot detection during automated tests. - Auth State Reuse: Shows how to persist sessions with storageState so tests skip repetitive UI sign-ins. - Use Case: You are adding E2E coverage to a Next.js app protected by Clerk. Use this Skill to configure Playwright with a testing token, save authenticated state once, and run fast auth-flow tests with test API keys. ## Quick Start Set up Clerk E2E testing with Playwright in my project, including the testing token and saved auth state.

Frequently Asked Questions about clerk-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Clerk authentication with Playwright?

Use clerkSetup() to initialize the test environment and setupClerkTestingToken() before navigating to auth pages. Save the authenticated session with storageState so subsequent tests skip the UI sign-in flow.

How do I set up Clerk testing in Cypress?

Add addClerkCommands({ Cypress, cy }) to your Cypress support file to register Clerk-specific commands. Then use setupClerkTestingToken() to bypass bot detection before visiting protected pages.

Why do my Clerk E2E tests fail with bot detection errors?

Clerk's bot detection blocks automated browsers by default. Calling setupClerkTestingToken() with a CLERK_TESTING_TOKEN from the Clerk dashboard disables this check for your test environment.

Can I use production Clerk API keys in tests?

No, production keys in tests are a security risk. Always use test keys in the pk_test_* and sk_test_* formats, which are scoped to Clerk's development environment.

How do I speed up Clerk authentication tests?

Avoid UI-based sign-in in every test by saving the authenticated session with Playwright's storageState or an equivalent mechanism. Tests then load the saved state instead of repeating the login flow.