clerk-testing

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

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/celeroncoder/skills --skill clerk-testing-celeroncoder
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: clerk-testing
Source: https://github.com/celeroncoder/skills/tree/main/clerk-testing
Command: npx skills add https://github.com/celeroncoder/skills --skill clerk-testing-celeroncoder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Testing authentication flows in Clerk-powered apps is tricky because bot detection blocks automated sign-ins and each test needs isolated session state. This Skill guides you through setting up reliable E2E auth tests without flaky failures. ## Core Features & Use Cases - Framework Decision Tree: Directs you to the official Clerk testing documentation for Playwright or Cypress based on your stack. - Auth Session Management: Explains how to use clerkSetup(), setupClerkTestingToken(), and storageState to bypass bot detection and persist auth between tests. - Anti-Pattern Detection: Flags common mistakes like using production keys in tests or performing UI-based sign-in for every test. - Use Case: You are adding E2E tests to a Next.js app with Clerk. The Skill walks you through fetching the right docs, configuring a testing token, and reusing auth state so your test suite runs fast and passes consistently. ## Quick Start Set up Playwright E2E tests for my Clerk app's sign-in flow using a 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 to bypass bot detection. Save auth state with storageState so subsequent tests reuse the session instead of signing in repeatedly.

How do I set up Clerk testing in Cypress?▼

Add addClerkCommands({ Cypress, cy }) to your Cypress support file to register Clerk-specific commands. Then call setupClerkTestingToken() before visiting pages with Clerk components, using only test API keys.

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

Clerk's bot detection blocks automated sign-in attempts by default. Calling setupClerkTestingToken() with a CLERK_TESTING_TOKEN from the Clerk dashboard before navigation bypasses this protection in test environments.

Can I use production Clerk keys in E2E tests?▼

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

How do I make Clerk auth tests run faster?▼

Persist authentication state with Playwright's storageState or a globalSetup file so tests reuse a signed-in session. This avoids slow UI-based sign-in flows in every test case.