-
Notifications
You must be signed in to change notification settings - Fork 376
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: e00dea4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
📝 WalkthroughWalkthroughAdds 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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/undefinedplan.features
to avoid runtime errorsIf
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 changesetMake 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 componentAligns 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 componentKeeps 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 pageNot 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 FlowMetadataDuplicate 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 componentKeeps 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.
📒 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
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
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
Useconst assertions
for literal types:as const
Usesatisfies
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 ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
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 classUsing 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 newplanDetails
objectImport 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 solidGood use of the page object to wait for mount and assert all key content nodes.
120-134
: Subscription details drawer assertions are appropriateCovers 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
5ea2e24
to
eb5db28
Compare
There was a problem hiding this 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 entryApply 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 selectorsThis 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 afeatures
sectionI 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.
📒 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
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
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
Useconst assertions
for literal types:as const
Usesatisfies
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 ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
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 goodNice 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 neededI ran a search for the pattern
if (!app.name.includes('next')) { return; }
acrossintegration/tests/**
and found no occurrences, indicating the tests already gate by app variant (e.g., withtest.skip
) or never included such inline returns. This recommendation appears outdated and can be dropped.Likely an incorrect or invalid review comment.
There was a problem hiding this 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.
📒 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 verifiedThe 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks legit
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.Type of change
Summary by CodeRabbit
New Features
UI
Tests
Chores
Tests (Tooling)