clerk-testing

Set up Clerk authentication for Playwright and Cypress test suites.

66|4|Updated Jan 6, 2026
One-click install
npx skills add https://github.com/clerk/skills --skill clerk-testing-clerk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-testing
Source: https://github.com/clerk/skills/tree/main/skills/features/clerk-testing
Command: npx skills add https://github.com/clerk/skills --skill clerk-testing-clerk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a repeatable and isolated end-to-end testing workflow for authentication flows in Clerk-enabled applications so tests reliably authenticate users without flaky UI interactions or bot detection issues.

Core Features & Use Cases

  • Framework support: Playwright and Cypress integrations for browser-based auth testing and session persistence.
  • Test utilities: Guidance to use setupClerkTestingToken(), clerkSetup(), and storageState to initialize test environments and speed up test runs.
  • Use Case: Automate user sign-in and session reuse across multiple tests in a Playwright suite using test API keys and persisted storageState to avoid UI-based sign-ins on every test.

Quick Start

Use the clerk-testing skill to set up Playwright or Cypress auth state with CLERK_TESTING_TOKEN and generate a reusable storageState for subsequent tests.

Frequently Asked Questions about clerk-testing

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

FAQPage Schema
How do I automate Clerk authentication in Playwright tests?

Automate Clerk authentication in Playwright by using the setupClerkTestingToken utility to initialize the test environment, then persist the authenticated session across tests using storageState. This requires your CLERK_TESTING_TOKEN and pk_test API keys to bypass UI-based sign-ins reliably.

Can I reuse Clerk session state across multiple Cypress tests?

Yes, you can reuse Clerk session state across multiple Cypress tests by applying the clerkSetup utility and persisting the authenticated session state. This setup uses your CLERK_TESTING_TOKEN and sk_test API keys to prevent flaky UI sign-in interactions during test runs.

How does end-to-end auth testing handle Clerk bot detection?

End-to-end auth testing bypasses Clerk bot detection by using the setupClerkTestingToken function alongside test API keys. This mechanism programmatically authenticates test sessions without triggering UI-based bot detection issues.

What API keys do I need for Clerk e2e test setup?

You need a CLERK_TESTING_TOKEN, a pk_test publishable key, and an sk_test secret key for Clerk e2e test setup. These credentials allow the testing framework to initialize isolated authentication flows and verify session persistence safely.

Does Clerk testing work with both Playwright and Cypress?

Yes, Clerk testing provides dedicated integration support for both Playwright and Cypress browser test suites. It applies specific utilities to initialize test environments, verify auth flows, and manage session persistence across both frameworks.

Why are my Clerk authenticated tests failing with flaky UI sign-ins?

Clerk authenticated tests fail with flaky UI sign-ins when test environments lack proper token initialization. Apply setupClerkTestingToken and storageState persistence with your test API keys to isolate authentication flows and avoid unreliable UI interactions.