Skip to content

chore(e2e): Add test cases for billing buttons #6573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Aug 19, 2025

Description

While we already have unit tests to cover most cases of the billing buttons, we should have a few simple ones that make sure the buttons function properly and display their respective drawers.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added example pages for Checkout, Plan details, and Subscription details in the Next.js App Router template.
  • UI

    • Plan Details drawer includes a new CSS hook (cl-planDetails-root) for easier customization.
  • Tests

    • Added UI integration tests covering plan details display, checkout flow, and subscription details.
  • Chores

    • Published patch releases via changesets.
  • Tests (Tooling)

    • Testing tooling now includes a Plan Details page object and a planDetails field in the PageDetails API.

Copy link

changeset-bot bot commented Aug 19, 2025

🦋 Changeset detected

Latest commit: e00dea4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@clerk/clerk-js Patch
@clerk/testing Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 19, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Aug 19, 2025 6:51pm

Copy link

pkg-pr-new bot commented Aug 19, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6573

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6573

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6573

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6573

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6573

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6573

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6573

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6573

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6573

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6573

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6573

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6573

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6573

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6573

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6573

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6573

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6573

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6573

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6573

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6573

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6573

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6573

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6573

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6573

commit: e00dea4

Copy link
Contributor

coderabbitai bot commented Aug 19, 2025

📝 Walkthrough

Walkthrough

Adds changesets for @clerk/clerk-js and @clerk/testing (the latter adds a planDetails field to PageDetails). Documents a UI class addition: cl-planDetails-root on the plan details root element. Adds three Next.js App Router pages demonstrating CheckoutButton, PlanDetailsButton, and SubscriptionDetailsButton. Wraps PlanDetails rendering in Flow.Root/Flow.Part (flow='planDetails'). Adds Playwright page object for Plan Details (root selector .cl-planDetails-root) and registers it in the page-objects index. Extends FlowMetadata union with a duplicate 'subscriptionDetails' literal. Adds integration tests for pricing/checkout/subscription flows (one duplicated test block). Changes tsconfig moduleResolution to "bundler".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1)

117-119: Guard against optional/undefined plan.features to avoid runtime errors

If plan.features is undefined, features.length will throw. Default to an empty array.

Apply this diff:

-  const features = plan.features;
-  const hasFeatures = features.length > 0;
+  const features = plan.features ?? [];
+  const hasFeatures = features.length > 0;
🧹 Nitpick comments (8)
.changeset/little-seals-hang.md (1)

5-5: Clarify the public API impact in the changeset

Make it explicit that this augments the public PageDetails API.

Apply this diff:

-Add `planDetails` to the page details object.
+Add `planDetails` to the public `PageDetails` API (testing).
packages/testing/src/playwright/unstable/page-objects/planDetails.ts (1)

4-14: Export an explicit return type and centralize the root selector; prefer waiting for visibility

  • Testing package APIs should have explicit return types.
  • Deduplicate the selector string via a constant.
  • In e2e flows, waiting for 'visible' is typically more robust than 'attached'.

Apply this diff:

+import type { Locator } from '@playwright/test';
 import type { EnhancedPage } from './app';
 import { common } from './common';
 
+const rootSelector = '.cl-planDetails-root';
+
+export type PlanDetailsPageObject = ReturnType<typeof common> & {
+  waitForMounted: (selector?: string) => Promise<void>;
+  root: Locator;
+};
+
-export const createPlanDetailsPageObject = (testArgs: { page: EnhancedPage }) => {
+export const createPlanDetailsPageObject = (testArgs: { page: EnhancedPage }): PlanDetailsPageObject => {
   const { page } = testArgs;
   const self = {
     ...common(testArgs),
-    waitForMounted: (selector = '.cl-planDetails-root') => {
-      return page.waitForSelector(selector, { state: 'attached' });
+    waitForMounted: (selector = rootSelector) => {
+      return page.waitForSelector(selector, { state: 'visible' });
     },
-    root: page.locator('.cl-planDetails-root'),
+    root: page.locator(rootSelector),
   };
   return self;
 };
integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (1)

4-17: Add explicit return type for the page component

Aligns with our TypeScript guideline to define explicit return types for functions.

-export default function Home() {
+export default function Home(): JSX.Element {
integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (2)

3-9: Add explicit return type for the page component

Keeps TS return types explicit per guidelines.

-export default function Home() {
+export default function Home(): JSX.Element {

1-7: Gate the button behind SignedIn for consistency with checkout page

Not strictly required, but makes visibility consistent across billing examples and avoids rendering an action that requires auth to signed-out users.

-import { SubscriptionDetailsButton } from '@clerk/nextjs/experimental';
+import { SubscriptionDetailsButton } from '@clerk/nextjs/experimental';
+import { SignedIn } from '@clerk/nextjs';
@@
   return (
     <main>
-      <SubscriptionDetailsButton>Subscription details</SubscriptionDetailsButton>
+      <SignedIn>
+        <SubscriptionDetailsButton>Subscription details</SubscriptionDetailsButton>
+      </SignedIn>
     </main>
   );
packages/clerk-js/src/ui/elements/contexts/index.tsx (1)

102-104: Remove duplicate 'subscriptionDetails' literal from FlowMetadata

Duplicate union members are harmless but noisy and can mask merge mistakes.

     | 'oauthConsent'
-    | 'subscriptionDetails'
-    | 'subscriptionDetails'
+    | 'subscriptionDetails'
     | 'taskChooseOrganization';
integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (1)

3-9: Add explicit return type for the page component

Keeps TS return types explicit per guidelines.

-export default function Home() {
+export default function Home(): JSX.Element {
integration/tests/pricing-table.test.ts (1)

86-96: Tighten the test title and locator for “Checkout” selection

  • Minor grammar tweak in the title (“opens”).
  • Consider a role-based locator scoped to the checkout root (e.g., a radio or button) to make the click more robust than getByText on a bare string.
-  test('when signed in, clicking checkout button open checkout drawer', async ({ page, context }) => {
+  test('when signed in, clicking checkout button opens checkout drawer', async ({ page, context }) => {
@@
-    await u.po.page.getByText(/^Checkout$/).click();
+    // Prefer a role-based locator scoped to the checkout drawer for stability, e.g.:
+    // await u.po.checkout.root.getByRole('radio', { name: /^Checkout$/ }).click();
+    // or, if it's a button:
+    // await u.po.checkout.root.getByRole('button', { name: /^Checkout$/ }).click();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6a1fb13 and 5ea2e24.

📒 Files selected for processing (10)
  • .changeset/legal-ants-flow.md (1 hunks)
  • .changeset/little-seals-hang.md (1 hunks)
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (1 hunks)
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (1 hunks)
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (1 hunks)
  • integration/tests/pricing-table.test.ts (3 hunks)
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (2 hunks)
  • packages/clerk-js/src/ui/elements/contexts/index.tsx (1 hunks)
  • packages/testing/src/playwright/unstable/page-objects/index.ts (2 hunks)
  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
  • integration/tests/pricing-table.test.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
  • integration/tests/pricing-table.test.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
  • integration/tests/pricing-table.test.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
  • integration/tests/pricing-table.test.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • packages/testing/src/playwright/unstable/page-objects/index.ts
  • integration/tests/pricing-table.test.ts
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/legal-ants-flow.md
  • .changeset/little-seals-hang.md
**/*.{jsx,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components: UserProfile, NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...

Files:

  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
integration/**

📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)

Framework integration templates and E2E tests should be placed under the integration/ directory

Files:

  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • integration/tests/pricing-table.test.ts
integration/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

End-to-end tests and integration templates must be located in the 'integration/' directory.

Files:

  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • integration/tests/pricing-table.test.ts
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)

**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering

Files:

  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
packages/clerk-js/src/ui/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)

packages/clerk-js/src/ui/**/*.{ts,tsx}: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure

Files:

  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
packages/**/index.{js,ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use tree-shaking friendly exports

Files:

  • packages/testing/src/playwright/unstable/page-objects/index.ts
**/index.ts

📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)

Use index.ts files for clean imports but avoid deep barrel exports

Avoid barrel files (index.ts re-exports) as they can cause circular dependencies

Files:

  • packages/testing/src/playwright/unstable/page-objects/index.ts
integration/**/*.{test,spec}.{js,ts}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Integration tests should use Playwright.

Files:

  • integration/tests/pricing-table.test.ts
🧬 Code Graph Analysis (6)
integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (2)
integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (1)
  • Home (4-17)
integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (1)
  • Home (3-9)
packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (2)
packages/clerk-js/src/ui/customizables/Flow.tsx (1)
  • Flow (41-44)
packages/clerk-js/src/ui/elements/Drawer.tsx (1)
  • Drawer (555-564)
integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (2)
integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (1)
  • Home (4-17)
integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (1)
  • Home (3-9)
integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (2)
integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (1)
  • Home (3-9)
integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (1)
  • Home (3-9)
packages/testing/src/playwright/unstable/page-objects/index.ts (1)
packages/testing/src/playwright/unstable/page-objects/planDetails.ts (1)
  • createPlanDetailsPageObject (4-14)
integration/tests/pricing-table.test.ts (1)
integration/testUtils/index.ts (1)
  • createTestUtils (24-86)
🪛 LanguageTool
.changeset/legal-ants-flow.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... that containes the plan details drawer.

(QB_NEW_EN)

🔇 Additional comments (4)
packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (1)

23-23: Good move: wrap PlanDetails in Flow to expose a stable root class

Using Flow.Root flow='planDetails' (+ Flow.Part) aligns with the theming system and provides the stable .cl-planDetails-root hook used by tests and customizers. Import looks correct.

Also applies to: 34-41

packages/testing/src/playwright/unstable/page-objects/index.ts (1)

11-11: Wiring looks correct; ensure typings surface the new planDetails object

Import and return-surface additions are correct and consistent with other page objects. If you export a typed public surface for these page objects elsewhere, make sure it now includes planDetails.

Can you confirm whether the public types for the unstable page-objects bundle already include planDetails? If not, I can draft the type updates.

Also applies to: 54-55

integration/tests/pricing-table.test.ts (2)

31-48: Plan details flow test looks solid

Good use of the page object to wait for mount and assert all key content nodes.


120-134: Subscription details drawer assertions are appropriate

Covers key content areas and waits for mount via the page object. Looks good.

'@clerk/clerk-js': patch
---

Add class `cl-planDetails-root` to the parent div element that containes the plan details drawer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo and tighten wording in changeset entry

Correct “containes” → “contains” and simplify phrasing.

Apply this diff:

-Add class `cl-planDetails-root` to the parent div element that containes the plan details drawer.
+Add CSS class `cl-planDetails-root` to the parent div that contains the plan details drawer.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Add class `cl-planDetails-root` to the parent div element that containes the plan details drawer.
Add CSS class `cl-planDetails-root` to the parent div that contains the plan details drawer.
🧰 Tools
🪛 LanguageTool

[grammar] ~5-~5: There might be a mistake here.
Context: ... that containes the plan details drawer.

(QB_NEW_EN)

🤖 Prompt for AI Agents
In .changeset/legal-ants-flow.md around line 5, the changeset entry has a typo
and awkward phrasing: replace “containes” with “contains” and simplify the
sentence to read something like: "Add class `cl-planDetails-root` to the parent
div that contains the plan details drawer." Update the line accordingly to fix
the spelling and tighten the wording.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
.changeset/legal-ants-flow.md (1)

5-5: Fix typo and tighten wording in changeset entry

Apply this diff to correct the spelling and clarify the sentence.

-Add class `cl-planDetails-root` to the parent div element that containes the plan details drawer.
+Add CSS class `cl-planDetails-root` to the parent div that contains the plan details drawer.
🧹 Nitpick comments (2)
integration/tests/pricing-table.test.ts (2)

31-52: Good coverage of plan details UX; consider stabilizing price/description selectors

This is a solid flow and uses the new page object root. To reduce flakiness due to formatting/localization, prefer role-based or test-id selectors via the page object for price/description/features instead of raw text matches.

Example (adjust page object accordingly):

  • plan title: role heading is good
  • plan price: expose a getter like getPrice() under .cl-planDetails-root
  • features: expose getFeature(name) or query within a features section

I can send a follow-up patch to extend createPlanDetailsPageObject with stable getters if you want.


94-107: Rename test for grammar and trim unnecessary actions for speed/stability

  • Grammar: “open” → “opens”.
  • This test only needs to assert that the drawer opened. Clicking the heading and filling a card is unnecessary and adds time/flake surface.

Apply this diff:

-  test('when signed in, clicking checkout button open checkout drawer', async ({ page, context }) => {
+  test('when signed in, clicking checkout button opens checkout drawer', async ({ page, context }) => {
@@
-    await u.po.page.getByRole('button', { name: 'Checkout Now' }).click();
-    await u.po.checkout.waitForMounted();
-    await u.po.page.getByText(/^Checkout$/).click();
-    await u.po.checkout.fillTestCard();
+    await u.po.page.getByRole('button', { name: 'Checkout Now' }).click();
+    await u.po.checkout.waitForMounted();
+    await expect(u.po.page.getByText(/^Checkout$/)).toBeVisible();
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea2e24 and eb5db28.

📒 Files selected for processing (10)
  • .changeset/legal-ants-flow.md (1 hunks)
  • .changeset/little-seals-hang.md (1 hunks)
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx (1 hunks)
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx (1 hunks)
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx (1 hunks)
  • integration/tests/pricing-table.test.ts (4 hunks)
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx (2 hunks)
  • packages/clerk-js/src/ui/elements/contexts/index.tsx (1 hunks)
  • packages/testing/src/playwright/unstable/page-objects/index.ts (2 hunks)
  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • integration/templates/next-app-router/src/app/billing/plan-details-btn/page.tsx
  • .changeset/little-seals-hang.md
  • packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx
  • integration/templates/next-app-router/src/app/billing/checkout-btn/page.tsx
  • integration/templates/next-app-router/src/app/billing/subscription-details-btn/page.tsx
  • packages/clerk-js/src/ui/elements/contexts/index.tsx
  • packages/testing/src/playwright/unstable/page-objects/planDetails.ts
  • packages/testing/src/playwright/unstable/page-objects/index.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • integration/tests/pricing-table.test.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • integration/tests/pricing-table.test.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • integration/tests/pricing-table.test.ts
integration/**

📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)

Framework integration templates and E2E tests should be placed under the integration/ directory

Files:

  • integration/tests/pricing-table.test.ts
integration/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

End-to-end tests and integration templates must be located in the 'integration/' directory.

Files:

  • integration/tests/pricing-table.test.ts
integration/**/*.{test,spec}.{js,ts}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Integration tests should use Playwright.

Files:

  • integration/tests/pricing-table.test.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • integration/tests/pricing-table.test.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • integration/tests/pricing-table.test.ts
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/legal-ants-flow.md
🪛 LanguageTool
.changeset/legal-ants-flow.md

[grammar] ~5-~5: There might be a mistake here.
Context: ... that containes the plan details drawer.

(QB_NEW_EN)

🔇 Additional comments (4)
.changeset/legal-ants-flow.md (2)

1-4: Valid changeset frontmatter; scope and release type look correct.

Frontmatter syntax is correct and a patch bump for '@clerk/clerk-js' makes sense for adding a non-breaking CSS hook.


1-3: Add or confirm a changeset entry for ‘@clerk/testing’

I didn’t find any .changeset/*.md entry bumping @clerk/testing. If this PR extends testing surfaces (e.g. new page-objects, types, helpers), please add a corresponding changeset. Otherwise, update the AI summary to remove the reference to @clerk/testing.

• File needing update:
.changeset/legal-ants-flow.md

• Example snippet to add:

---  
'@clerk/testing': patch  
---  
integration/tests/pricing-table.test.ts (2)

131-149: Subscription details drawer assertions look good

Nice end-to-end coverage for the subscription details drawer. The mounted wait + specific content assertions make the intent clear.


32-34: No inline early-return conditionals detected — suggestion not needed

I ran a search for the pattern if (!app.name.includes('next')) { return; } across integration/tests/** and found no occurrences, indicating the tests already gate by app variant (e.g., with test.skip) or never included such inline returns. This recommendation appears outdated and can be dropped.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
integration/templates/next-app-router/tsconfig.json (1)

22-24: Add baseUrl to activate your paths mapping.

TypeScript ignores "paths" without "baseUrl". Add baseUrl so "@/..." resolves in the editor and type-checker (Next will also mirror it to the bundler).

Apply this diff:

     "plugins": [
       {
         "name": "next"
       }
     ],
+    "baseUrl": ".",
     "paths": {
       "@/*": ["./src/*"]
     }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between eb5db28 and e00dea4.

📒 Files selected for processing (1)
  • integration/templates/next-app-router/tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • integration/templates/next-app-router/tsconfig.json
integration/**

📄 CodeRabbit Inference Engine (.cursor/rules/global.mdc)

Framework integration templates and E2E tests should be placed under the integration/ directory

Files:

  • integration/templates/next-app-router/tsconfig.json
integration/**/*

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

End-to-end tests and integration templates must be located in the 'integration/' directory.

Files:

  • integration/templates/next-app-router/tsconfig.json
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • integration/templates/next-app-router/tsconfig.json
🔇 Additional comments (1)
integration/templates/next-app-router/tsconfig.json (1)

12-12: moduleResolution: "bundler" is valid; TS version verified

The Next.js App Router template specifies TypeScript ^5.7.3 (parsed: 5.7.3), satisfying the ≥5.0 requirement for "bundler" resolution. This aligns with Next.js’ modern tooling and package export maps. Approved.

Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks legit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants