Skip to content

Conversation

@panteliselef
Copy link
Member

@panteliselef panteliselef commented Aug 28, 2025

Description

Before

image

After

image

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
    • PricingTable now displays a “Free trial” badge in the plan card header when a subscription includes a free trial.
  • Bug Fixes
    • Improved badge rendering to ensure the correct subscription status is shown when a status row is present.
  • Tests
    • Updated test expectations to assert the free trial badge and added a test helper to wait for a “Free trial” badge.
  • Chores
    • Bumped @clerk/clerk-js with a patch update.

@panteliselef panteliselef requested a review from a team August 28, 2025 14:37
@panteliselef panteliselef self-assigned this Aug 28, 2025
@changeset-bot
Copy link

changeset-bot bot commented Aug 28, 2025

🦋 Changeset detected

Latest commit: e70f5cb

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js 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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 28, 2025

Walkthrough

Reworks PricingTable badge input to normalize free-trial subscriptions to { status: 'free_trial' } when a status row is shown; otherwise passes the original subscription or undefined. Adds a patch changeset and test/page-object updates to wait for a "Free trial" badge.

Changes

Cohort / File(s) Summary
Release notes / changeset
\.changeset/eighty-bananas-listen.md
Adds a patch changeset for @clerk/clerk-js documenting that PricingTable displays a free trial badge.
PricingTable badge prop logic
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
When showStatusRow is true and the subscription is a free trial, passes a normalized { status: 'free_trial' } to SubscriptionBadge; otherwise passes the full subscription or undefined as before.
Tests
integration/tests/pricing-table.test.ts
Replaces waitToBeActive call with waitToBeFreeTrial for the trial plan assertion.
Playwright page object
packages/testing/src/playwright/unstable/page-objects/pricingTable.ts
Adds waitToBeFreeTrial({ planSlug }) to wait for the "Free trial" badge to become visible (mirrors existing active-badge waiter).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant PT as PricingTableDefault
  participant CH as CardHeader
  participant SB as SubscriptionBadge
  Note over PT: Render pricing table row
  PT->>CH: render(props: subscription, showStatusRow)
  alt showStatusRow && subscription indicates free trial
    Note right of CH #DFF4DD: normalize to `{ status: 'free_trial' }`
    CH->>SB: subscription = { status: 'free_trial' }
  else showStatusRow && not free trial
    CH->>SB: subscription = subscription (full object)
  else !showStatusRow
    CH->>SB: subscription = undefined
  end
Loading
sequenceDiagram
  autonumber
  participant Test as integration test
  participant PO as PricingTablePageObject
  participant UI as Browser/UI

  Test->>PO: waitToBeFreeTrial(planSlug)
  PO->>UI: wait for "Free trial" badge selector for planSlug
  alt badge appears
    UI-->>PO: badge visible
    PO-->>Test: resolved
  else timeout/error
    UI-->>PO: not found / timeout
    PO-->>Test: rejected
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my whiskers at a tiny tweak,
A little badge for trials to proudly peek.
Props tidied up, the table dons its veil,
I hop in joy and leave a carrot trail. 🥕🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch elef/bill-1220-inconsistent-active-badge-for-free-trial-subscription

🪧 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 @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit 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:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit 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 @coderabbit help to get the list of available commands.

Other keywords and placeholders

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

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.

@vercel
Copy link

vercel bot commented Aug 28, 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 28, 2025 3:03pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 28, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: e70f5cb

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 (2)
.changeset/eighty-bananas-listen.md (1)

5-5: Polish the changeset summary for clarity.

Prefer a clear, grammatical sentence.

-Display free trial badge `<PricingTable/>`.
+Display a “Free trial” badge in <PricingTable/>.
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)

187-191: Avoid recreating the free-trial object on every render.

Minor optimization: reuse a module-level constant to reduce prop churn and help memoized children.

-            <SubscriptionBadge subscription={subscription.isFreeTrial ? { status: 'free_trial' } : subscription} />
+            <SubscriptionBadge subscription={subscription.isFreeTrial ? FREE_TRIAL_SUBSCRIPTION : subscription} />

Add once (outside the component):

// at module scope
const FREE_TRIAL_SUBSCRIPTION = { status: 'free_trial' } as const;
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 977daa4 and 99f8a22.

📒 Files selected for processing (2)
  • .changeset/eighty-bananas-listen.md (1 hunks)
  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
.changeset/**

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

Automated releases must use Changesets.

Files:

  • .changeset/eighty-bananas-listen.md
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/PricingTable/PricingTableDefault.tsx
**/*.{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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
**/*.{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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
packages/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
packages/**/*.{ts,tsx,d.ts}

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

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
**/*.{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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
**/*.{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:

  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
**/*.{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/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
**/*.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:

  • packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx
🧬 Code graph analysis (1)
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (1)
packages/clerk-js/src/ui/components/Subscriptions/badge.tsx (1)
  • SubscriptionBadge (20-40)
🪛 LanguageTool
.changeset/eighty-bananas-listen.md

[grammar] ~4-~4: There might be a mistake here.
Context: --- '@clerk/clerk-js': patch --- Display free trial badge <PricingTable/>.

(QB_NEW_EN)


[grammar] ~5-~5: There might be a mistake here.
Context: ...play free trial badge <PricingTable/>.

(QB_NEW_EN)

⏰ 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). (4)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx (2)

187-191: Good normalization for free-trial badge input.

Passing { status: 'free_trial' } when subscription.isFreeTrial is true cleanly signals the badge state while preserving the original object for other cases.


187-191: SubscriptionBadge already supports free_trial
Both keys (mapping free_trial'badge__freeTrial') and colors (mapping free_trial'secondary') include the free_trial status—no changes required.

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 99f8a22 and e70f5cb.

📒 Files selected for processing (2)
  • integration/tests/pricing-table.test.ts (1 hunks)
  • packages/testing/src/playwright/unstable/page-objects/pricingTable.ts (1 hunks)
🧰 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:

  • packages/testing/src/playwright/unstable/page-objects/pricingTable.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/pricingTable.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/pricingTable.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/pricingTable.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/pricingTable.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/pricingTable.ts
  • 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
⏰ 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). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
integration/tests/pricing-table.test.ts (1)

302-302: Good API migration to the trial badge

Switching to waitToBeFreeTrial({ planSlug: 'trial' }) accurately targets the new badge semantics in the PricingTable flow.

Comment on lines +62 to +64
waitToBeFreeTrial: async ({ planSlug }: { planSlug: string }) => {
return locators.badge(planSlug).getByText('Free trial').waitFor({ state: 'visible' });
},
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Harden locator and add explicit return type per TS guidelines

Use case-insensitive match and declare an explicit return type to satisfy our **/*.ts,tsx rules for public APIs.

Apply this diff:

-    waitToBeFreeTrial: async ({ planSlug }: { planSlug: string }) => {
-      return locators.badge(planSlug).getByText('Free trial').waitFor({ state: 'visible' });
+    waitToBeFreeTrial: async ({ planSlug }: { planSlug: string }): Promise<void> => {
+      return locators.badge(planSlug).getByText(/free trial/i).waitFor({ state: 'visible' });
     },

Optionally add JSDoc above the method for public API clarity:

/**
 * Waits for the "Free trial" badge to be visible for the given plan.
 * Useful after starting a trial to assert the PricingTable reflects trial state.
 */
🤖 Prompt for AI Agents
In packages/testing/src/playwright/unstable/page-objects/pricingTable.ts around
lines 62-64, the waitToBeFreeTrial locator should be made case-insensitive and
the function must declare an explicit TypeScript return type; change the matcher
to a case-insensitive regex (e.g. getByText(/free trial/i)) and update the
signature to include the return type Promise<void> (async ({ planSlug }: {
planSlug: string }): Promise<void>), and optionally add the provided JSDoc above
the method for public API clarity.

@panteliselef panteliselef merged commit 30c8bca into main Aug 28, 2025
39 checks passed
@panteliselef panteliselef deleted the elef/bill-1220-inconsistent-active-badge-for-free-trial-subscription branch August 28, 2025 15:48
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.

4 participants