clerk-testing

द्वारा clerk

Clerk ऐप्स के लिए E2E परीक्षण। प्रमाणीकरण प्रवाह परीक्षणों के लिए Playwright या Cypress के साथ उपयोग करें।

npx skills add https://github.com/clerk/skills --skill clerk-testing

Testing

Decision Tree

FrameworkDocumentation
Overviewhttps://clerk.com/docs/guides/development/testing/overview
Playwrighthttps://clerk.com/docs/guides/development/testing/playwright/overview
Cypresshttps://clerk.com/docs/guides/development/testing/cypress/overview

Mental Model

Test auth = isolated session state. Each test needs fresh auth context.

  • clerkSetup() initializes test environment
  • setupClerkTestingToken() bypasses bot detection
  • storageState persists auth between tests for speed

Workflow

  1. Identify test framework (Playwright or Cypress)
  2. WebFetch the appropriate URL from decision tree above
  3. Follow official setup instructions
  4. Use pk_test_* and sk_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 storageState for faster tests
  • Use page.waitForSelector('[data-clerk-component]') for Clerk UI

Anti-Patterns

PatternProblemFix
Production keys in testsSecurity riskUse pk_test_* keys
No setupClerkTestingToken()Auth failsCall before navigation
UI-based sign-in every testSlow testsUse storageState

Framework-Specific

Playwright: Use globalSetup for auth state Cypress: Add addClerkCommands({ Cypress, cy }) to support file

See Also

  • clerk-setup - Install Clerk before adding tests
  • clerk-nextjs-patterns - Next.js patterns being tested
  • Demo Repo

clerk की और Skills

clerk-monorepo
clerk
clerk/javascript SDK मोनोरेपो में प्रभावी ढंग से काम करें। रेपो सेट अप करते समय, पैकेज बनाने / परीक्षण करने / चलाने के लिए, और @clerk/* में से कौन सा चुनने का निर्णय लेते समय उपयोग करें...
official
mosaic
clerk
Work on Mosaic UI: styling a component with slot recipes (`defineSlotRecipe` / `useRecipe` / slots / variants), or building a flow — authoring a state machine…
official
mosaic-machine
clerk
मोज़ेक स्टेट मशीनों को लिखें और उपयोग करें। उपयोग तब करें जब उपयोगकर्ता createMachine के साथ स्टेट मशीन लिख रहा हो, बहु-चरणीय प्रवाह का मॉडल बना रहा हो, मशीन को React से जोड़ रहा हो…
official
clerk-android
clerk
Implement Clerk authentication for native Android apps using Kotlin and Jetpack Compose with clerk-android source-guided patterns. Use for prebuilt…
official
clerk-astro-patterns
clerk
Astro पैटर्न Clerk के साथ — middleware, SSR पेज, आइलैंड कंपोनेंट्स, API रूट्स, स्टैटिक बनाम SSR रेंडरिंग। ट्रिगर: astro clerk, clerk astro middleware,…
official
clerk-backend-api
clerk
Clerk बैकएंड REST API अन्वेषक और निष्पादक। टैग ब्राउज़ करें, एंडपॉइंट स्कीमा निरीक्षण करें, और प्रमाणित अनुरोध निष्पादित करें। उपयोग करें जब उपयोगकर्ताओं को सूचीबद्ध करना, प्रबंधित करना…
official
clerk-chrome-extension-patterns
clerk
Chrome एक्सटेंशन में @clerk/chrome-extension के साथ प्रमाणीकरण -- popup/sidepanel सेटअप, वेब ऐप के माध्यम से OAuth/SAML के लिए syncHost, सेवा कर्मियों के लिए createClerkClient और…
official
clerk-cli
clerk
Operate the Clerk CLI (`clerk` binary) for authentication, user/org/session management, impersonation, local webhook testing, deploy verification, instance…
official