Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Oct 10, 2025

Description

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

  • Tests
    • Added coverage for billing: verifies adding multiple payment methods and setting the default card in the pricing table flow.
  • Chores
    • Added a placeholder changeset file with no user-facing impact.

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: e4b92cb

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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 Oct 10, 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 Oct 10, 2025 10:02pm

Copy link
Contributor

coderabbitai bot commented Oct 10, 2025

Walkthrough

Adds a new changeset metadata file and extends the pricing table integration test with a case that adds two payment methods and sets the second as default, verifying the default indicator and cleaning up the test user.

Changes

Cohort / File(s) Summary of Changes
Changeset metadata
`.changeset/empty-bushes-tell.md`
Added a placeholder changeset file with two lines of `---`. No code or behavior changes.
Pricing table integration test
`integration/tests/pricing-table.test.ts`
Added test case: signs in, navigates to billing, adds Visa and Mastercard, sets Mastercard as default, asserts default state, and cleans up user.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Tester
  participant App as Web App (Pricing/Billing)
  participant Billing as Billing UI
  participant PM as Payment Methods List

  Note over Tester,App: New test: Add two methods and set the second as default
  Tester->>App: Sign in as test user
  Tester->>Billing: Navigate to /billing
  Tester->>PM: Add payment method (Visa)
  Tester->>PM: Add payment method (Mastercard)
  Tester->>PM: Open action menu (Mastercard)
  Tester->>PM: Set as default
  PM-->>Tester: UI shows Mastercard as default (Visa not default)
  Tester->>App: Cleanup test user
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I hop through tests with earnest cheer,
Two cards appear, then one stands clear.
Visa bows, while Master’s crowned,
Default set—no bugs are found.
Thump-thump! My paws approve the show,
Green checks bloom—onwards we go. 🐇✅

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly indicates that the pull request adds an end-to-end test for changing the default payment method, which directly reflects the main change introduced by the integration test files. It is concise, specific, and follows conventional commit style without any irrelevant details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch elef/payment-default-card-e2e

Comment @coderabbitai help to get the list of available commands and usage tips.

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/tests/pricing-table.test.ts (1)

705-706: Consider a more robust selector for the menu button.

Using .last() on the menu button selector assumes that DOM order matches the visual/logical order of payment methods. This could break if the DOM structure changes or if additional menu buttons are added elsewhere on the page.

Consider a more specific approach:

-      // Open menu for the last payment method and make it default
-      await u.po.page.locator('.cl-userProfile-root .cl-menuButtonEllipsis').last().click();
+      // Open menu for the Mastercard payment method and make it default
+      await u.po.page
+        .getByText(/mastercard/i)
+        .locator('xpath=..')
+        .locator('.cl-menuButtonEllipsis')
+        .click();

This ensures you're clicking the menu button specifically associated with the Mastercard entry.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • 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 0835ee7 and e4b92cb.

📒 Files selected for processing (2)
  • .changeset/empty-bushes-tell.md (1 hunks)
  • integration/tests/pricing-table.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/empty-bushes-tell.md
🧬 Code graph analysis (1)
integration/tests/pricing-table.test.ts (1)
integration/testUtils/index.ts (1)
  • createTestUtils (24-86)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Static analysis
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
.changeset/empty-bushes-tell.md (1)

1-2: Verify if this empty changeset is intentional.

This changeset file contains only the YAML frontmatter delimiters with no content. Typically, a changeset should include package names with bump types and a description of changes. An empty changeset might be intentional if no packages require version bumps, but this is unusual.

If content is missing, a typical changeset should look like:

---
"@clerk/package-name": patch
---

Brief description of the changes

If this is intentional (e.g., for test-only changes), consider adding a comment to clarify.

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

659-723: LGTM! Test structure follows established patterns.

The test correctly:

  • Creates and cleans up a fake user
  • Follows the standard sign-in and navigation flow
  • Verifies both the addition and default status of payment methods
  • Uses appropriate assertions

709-714: Note the extended timeout for default status verification.

The 15-second timeout on line 714 suggests that the default status update might be slow or potentially flaky. While this makes the test more resilient, it's worth investigating whether the UI update can be optimized or if there's a more reliable way to wait for the state change.

Consider monitoring this test for flakiness, as the extended timeout might indicate underlying timing issues.

Copy link

pkg-pr-new bot commented Oct 10, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: e4b92cb

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.

2 participants