clerk-testing
E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.
- License 许可
- MIT
- 所属仓库
- baisharg/ASTN
- 最近更新
- 2026-11-15
- Stars
- ★ 2
- Forks
- 2
01 前言 Front Matter
- name
- clerk-testing
- license
- MIT
- metadata
- { "author": "clerk", "version": "1.0.0" }
- description
- E2E testing for Clerk apps. Use with Playwright or Cypress for auth flow tests.
- allowed-tools
- WebFetch
02 资源文件 1
- 参考文档.claude-plugin/plugin.json427 B
03 SKILL.md 正文
Testing
Decision Tree
| Framework | Documentation |
|---|---|
| Overview | https://clerk.com/docs/guides/development/testing/overview |
| Playwright | https://clerk.com/docs/guides/development/testing/playwright/overview |
| Cypress | https://clerk.com/docs/guides/development/testing/cypress/overview |
Mental Model
Test auth = isolated session state. Each test needs fresh auth context.
clerkSetup()initializes test environmentsetupClerkTestingToken()bypasses bot detectionstorageStatepersists auth between tests for speed
Workflow
- Identify test framework (Playwright or Cypress)
- WebFetch the appropriate URL from decision tree above
- Follow official setup instructions
- Use
pk_test_*andsk_test_*keys only
Best Practices
- Use
setupClerkTestingToken()before navigating to auth pages - Use test API keys:
pk_test_xxx,sk_test_xxx - Save auth state with
storageStatefor faster tests - Use
page.waitForSelector('[data-clerk-component]')for Clerk UI
Anti-Patterns
| Pattern | Problem | Fix |
|---|---|---|
| Production keys in tests | Security risk | Use pk_test_* keys |
No setupClerkTestingToken() |
Auth fails | Call before navigation |
| UI-based sign-in every test | Slow tests | Use storageState |
Framework-Specific
Playwright: Use globalSetup for auth state
Cypress: Add addClerkCommands({ Cypress, cy }) to support file
See Also
04 同仓库更多 Skills
schema-builder
Design and generate Convex database schemas with proper validation, indexes, and relationships. Use when creating schema.ts or modifying table definitions.
integration-tanstack-start
PostHog integration for TanStack Start full-stack applications
migration-helper
Plan and execute Convex schema migrations safely, including adding fields, creating tables, and data transformations. Use when schema changes affect existing data.
gsd:sprint
Autonomous phase execution with Codex validation. Runs plan/execute/verify cycles in a bash loop until done or halted.
gsd:second-opinion
Get a second opinion from OpenAI Codex (GPT-5.2-codex) on code, architecture, or implementation decisions. Use when you want independent verification or an alternative perspective.
gsd:milestone-sprint
Run entire milestone autonomously with Codex validation. Auto-detects current milestone, executes all phases, and runs audit.