Skip to content

Conversation

@dstaley
Copy link
Member

@dstaley dstaley commented Apr 30, 2025

Description

This PR adds new page objects to the @clerk/testing/playwright/unstable package for <Checkout /> and <PricingTable />, in addition to adding a few new e2e tests for billing.

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:

@vercel
Copy link

vercel bot commented Apr 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 2, 2025 7:08pm

@changeset-bot
Copy link

changeset-bot bot commented Apr 30, 2025

🦋 Changeset detected

Latest commit: c852a00

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

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
Member

@alexcarpenter alexcarpenter left a comment

Choose a reason for hiding this comment

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

Looks good! Two small non-blocking questions.

await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
await u.po.page.goToRelative('/pricing-table');

await u.po.pricingTable.startCheckout({ planSlug: 'pro', shouldSwitch: true });
Copy link
Member

Choose a reason for hiding this comment

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

Not a super strong opinion, but shouldSwitch is not super obvious. switchPlans maybe? Again not super strong opinion here.

},
continueWithSavedCard: async () => {
await page
.locator('.cl-disclosureRoot')
Copy link
Member

Choose a reason for hiding this comment

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

do we need to select the disclosureRoot here vs just selecting the button trigger?

Copy link
Member Author

Choose a reason for hiding this comment

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

The button to pay with a saved card and the button to pay with a new card use the same labels, so we need to distinguish between them. This selector is "select the subscribe/pay button that's a child of a cl-disclosureRoot containing a button with the name Payment Methods" which distinguishes it from the Pay $x.xx button within the Add new payment method form (which is still in the DOM, but not visible). I wanted this method to work even if the Add new payment method disclosure was open.

Screen Shot 2025-05-01 at 10 49 26 AM

return {
page: app,
clerk: createClerkPageObject(testArgs),
checkout: createCheckoutPageObject(testArgs),
Copy link
Member

Choose a reason for hiding this comment

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

@dstaley since we only expose checkout as an internal component currently, shall we follow the pattern here as well ? We can drop the internal prefix later once, checkout is a standalone component.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think given that Checkout is intended to be a public component in the near future we're fine to leave this as just checkout. We're under an unstable import so I don't think we really need to double up on the warnings.

@dstaley dstaley merged commit 704c414 into main May 2, 2025
32 checks passed
@dstaley dstaley deleted the ds.feat/testing-billing branch May 2, 2025 19:18
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.

6 participants