clerk-testing

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

Updated Aug 7, 2026
One-click install
npx skills add https://github.com/Ramadan-Elgamal/Autobees --skill clerk-testing-ramadan-elgamal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-testing
Source: https://github.com/Ramadan-Elgamal/Autobees/tree/main/.agents/skills/clerk-testing
Command: npx skills add https://github.com/Ramadan-Elgamal/Autobees --skill clerk-testing-ramadan-elgamal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? End-to-end tests for Clerk-authenticated apps often fail due to bot detection, shared session state, and slow UI-based sign-in flows, making auth testing unreliable and time-consuming. ## Core Features & Use Cases - Framework Guidance: Provides decision-tree documentation links and setup workflows for both Playwright and Cypress test frameworks. - Auth Session Management: Explains how to use clerkSetup(), setupClerkTestingToken(), and storageState to bypass bot detection and persist auth between tests. - Best Practices & Anti-Patterns: Lists common mistakes like using production keys in tests or signing in via UI for every test, with concrete fixes. - Use Case: When adding E2E tests to a Next.js app protected by Clerk, follow the workflow to configure a testing token, save authenticated state once, and reuse it across the test suite for fast, stable runs. ## Quick Start Set up Playwright end-to-end tests for my Clerk-authenticated Next.js app using test API keys and a testing token.

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 call setupClerkTestingToken() before navigating to auth pages to bypass bot detection. Save authenticated 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. Follow the official Clerk Cypress testing guide and use test API keys with a testing token for authentication flows.

Why do my Clerk E2E tests fail with bot detection?

Clerk's bot detection blocks automated browsers by default. Call setupClerkTestingToken() before navigating to auth pages, which requires a CLERK_TESTING_TOKEN from the Clerk dashboard to bypass detection.

Can I use production Clerk keys in end-to-end tests?

No, using production keys in tests is a security risk. Always use test API keys in the pk_test_* and sk_test_* formats, which are designed for development and testing environments.

How do I speed up Clerk authentication tests?

Avoid UI-based sign-in for every test by saving the authenticated session with Playwright's storageState after one login. Subsequent tests load the saved state, skipping the sign-in flow entirely.