Skip to content

Conversation

panteliselef
Copy link
Member

@panteliselef panteliselef commented Aug 29, 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

    • Expanded end-to-end coverage for free trial lifecycle: starting trials, checkout validation, billing status, cancellations, and transitions to paid plans. Includes user profile flows, payment failure handling, plan restriction checks (e.g., annual-only), and scenarios for both signed-in and signed-out users to improve reliability across entry points.
  • Chores

    • Added changeset metadata. No user-facing changes.

Copy link

changeset-bot bot commented Aug 29, 2025

🦋 Changeset detected

Latest commit: eaa922b

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 Aug 29, 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 29, 2025 6:24pm

Copy link
Contributor

coderabbitai bot commented Aug 29, 2025

✨ 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-1211-add-test-case-for-immediate-plan-changes-during-free-trial

🪧 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 or @coderabbit 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.

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.

@panteliselef panteliselef changed the title chore(e2e): Add e2e cases for downgrading/upgrading/resubscribing on free trial chore(e2e): Test for downgrading/upgrading/resubscribing on free trial Aug 29, 2025
Copy link

pkg-pr-new bot commented Aug 29, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: eaa922b

@panteliselef panteliselef self-assigned this Aug 29, 2025
@panteliselef panteliselef requested review from aeliox, mauricioabreu and a team August 29, 2025 18:30
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

🧹 Nitpick comments (3)
integration/tests/pricing-table.test.ts (3)

351-355: Harden text assertions to reduce brittleness.

Use case-insensitive regex and anchor where appropriate; product copy often changes subtly.

Apply:

-      await expect(u.po.checkout.root.getByText('Checkout')).toBeVisible();
-      await expect(u.po.checkout.root.getByText('Free trial')).toBeHidden();
-      await expect(u.po.checkout.root.getByText('Total Due after')).toBeHidden();
-      await expect(u.po.checkout.root.getByText('Total Due Today')).toBeVisible();
+      await expect(u.po.checkout.root.getByText(/^checkout$/i)).toBeVisible();
+      await expect(u.po.checkout.root.getByText(/free trial/i)).toBeHidden();
+      await expect(u.po.checkout.root.getByText(/total due after/i)).toBeHidden();
+      await expect(u.po.checkout.root.getByText(/total due today/i)).toBeVisible();

365-385: Avoid XPath parent hops; prefer structural selectors with :has for stability.

Climbing with "xpath=.." is fragile against DOM changes. Target the list item that contains the label and then assert on descendants.

Apply:

-      await expect(
-        u.po.page
-          .locator('.cl-profileSectionContent__subscriptionsList')
-          .getByText(/Trial/i)
-          .locator('xpath=..')
-          .getByText(/Free trial/i),
-      ).toBeHidden();
+      const trialItem = u.po.page
+        .locator('.cl-profileSectionContent__subscriptionsList')
+        .locator('[role="listitem"]', { hasText: /Trial/i });
+      await expect(trialItem.getByText(/Free trial/i)).toBeHidden();
 
-      // Verify the Free plan with Upcoming status exists
-      await expect(
-        u.po.page
-          .locator('.cl-profileSectionContent__subscriptionsList')
-          .getByText('Free')
-          .locator('xpath=..')
-          .getByText('Upcoming'),
-      ).toBeHidden();
+      // Verify the Free plan with Upcoming status is hidden
+      const freeItem = u.po.page
+        .locator('.cl-profileSectionContent__subscriptionsList')
+        .locator('[role="listitem"]', { hasText: /^Free$/i });
+      await expect(freeItem.getByText(/^Upcoming$/i)).toBeHidden();

441-444: Assert success and continue before navigating — increases determinism.

The previous flows assert the success toast and press Continue; mirror that here to avoid races.

Apply:

       await u.po.checkout.root.getByRole('button', { name: /^pay\s\$/i }).waitFor({ state: 'visible' });
       await u.po.checkout.clickPayOrSubscribe();
+      await expect(u.po.page.getByText(/Payment was successful!/i)).toBeVisible();
+      await u.po.checkout.confirmAndContinue();
📜 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 ba25a5b and eaa922b.

📒 Files selected for processing (2)
  • .changeset/silent-bees-wear.md (1 hunks)
  • integration/tests/pricing-table.test.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
.changeset/**

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

Automated releases must use Changesets.

Files:

  • .changeset/silent-bees-wear.md
**/*.{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
🧬 Code graph analysis (1)
integration/tests/pricing-table.test.ts (1)
integration/testUtils/index.ts (1)
  • createTestUtils (24-86)
🪛 LanguageTool
.changeset/silent-bees-wear.md

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

⏰ 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). (27)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Unit Tests (22, **)
  • 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: Static analysis
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)

Comment on lines +1 to +2
---
---
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Invalid Changeset frontmatter (empty) — will fail Changesets CI.

Frontmatter must list at least one package with a release type (or explicitly mark none). Also add a short summary body.

Proposed fix (replace file contents; adjust package name(s) as appropriate for this monorepo):

---- 
----
+---
+'@clerk/your-package-here': none
+---
+
+chore(e2e): Add E2E cases for downgrading/upgrading/resubscribing on free trial. No publishable changes.

Please run “pnpm changeset status” locally to verify the changeset parses and CI will pass.


🏁 Script executed:

#!/bin/bash
# Display the first 10 lines of the changeset to verify frontmatter
if [ -f .changeset/silent-bees-wear.md ]; then
  sed -n '1,10p' .changeset/silent-bees-wear.md
else
  echo "File not found: .changeset/silent-bees-wear.md"
fi

Length of output: 97


Add valid frontmatter and summary to the changeset
Frontmatter can’t be empty—must list at least one package with its release type (or none) and include a one-line summary.

--- .changeset/silent-bees-wear.md
---
----
----
+---
+'@clerk/your-package-here': none
+---
+
+chore(e2e): Add E2E cases for downgrading/upgrading/resubscribing on free trial. No publishable changes.

Run pnpm changeset status locally to confirm the changeset parses and CI will pass.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 LanguageTool

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

🤖 Prompt for AI Agents
In .changeset/silent-bees-wear.md around lines 1 to 2, the changeset frontmatter
is empty; add valid YAML frontmatter listing at least one package with its
release type (or `none`) and include a one-line summary beneath the frontmatter.
Edit the file to include e.g. a packages array with the package name and release
type, then a short summary sentence, save, and run `pnpm changeset status`
locally to verify parsing and CI will pass.

@panteliselef panteliselef merged commit 53dadcf into main Aug 29, 2025
89 of 92 checks passed
@panteliselef panteliselef deleted the elef/bill-1211-add-test-case-for-immediate-plan-changes-during-free-trial branch August 29, 2025 22:01
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