Hero Background

Power Your Software Testing with AI Agents and Cloud

The Native AI-Agentic Cloud Platform to Supercharge Quality Engineering. Test Intelligently and Ship Faster.

Kane CLIBilling

Test a billing portal card update and the default that moves

Adding a card is easy to verify. The part that matters is whether the default moved to it and off the old one.

Published on:

Self-serve card updates exist to stop involuntary churn. A subscription fails when a card expires, and the customer who tries to fix it themselves is the one most worth keeping.

This use case adds a card in the Stripey billing portal and then checks the default actually moved, which is the operation that decides whether the next renewal succeeds.

The flow under test

Adding a card and making it the default are two operations, and a portal can perform the first while silently failing the second.

  • The old default is established first - Visa ending 4242 carries the default badge before anything changes.
  • The new card is added - through the dialog, with its own number and expiry.
  • The confirmation is explicit - a banner naming the card and stating it was set as default.
  • The old card gave up the default - the 4242 row now offers a "Make default" button instead of a badge.

That final assertion is the one that catches two cards both marked default, which is a state that renders fine and charges unpredictably. Checking only the new card would pass it.

Note

Note: Asserting the state a record left, not just the state it entered, is what catches a transition that half completed. Run flows like this on TestMu AI. Start for free

The test file

The test establishes the starting default before touching anything, which is what makes the change provable rather than assumed.

---
mode: testing
url: https://my-testing-repo-main.vercel.app/stripe-clone-app/portal?reset=true
max_steps: 45
tags: [stripe, payments, billing]
---

# Stripey 9.4: Billing portal

Catalog objective: open the customer portal, update the card and verify the new default.
Key assertion: the new payment method is shown as the default.

## Verify the current default
Verify the "Payment methods" card shows "Visa ending in 4242" carrying a "Default" badge and "Current default" reads "Visa ending in 4242".

## Add a new card
Click "Add payment method" and verify a dialog titled "Add a payment method" opens, then type "4000 0566 5566 5556" into "New card number", type "09 / 30" into "New card expiry", and click "Add card".

## Verify the confirmation
Verify a green banner reads "Card ending in 5556 added and set as default."

## Verify the default moved
Verify "Visa ending in 5556" now carries the "Default" badge, "Current default" reads "Visa ending in 5556", and the "Visa ending in 4242" row now offers a "Make default" button instead.

The confirmation banner is asserted by its full text, including the last four digits, so a banner that fires for the wrong card fails the step.

Step by step coverage

Each of the four steps carries a distinct assertion about the same underlying state, which is the right structure for testing a transition.

StepWhat it proves
Verify the current defaultThe starting state is known, so the change is provable
Add a new cardThe dialog accepts a card number and expiry and submits
Verify the confirmationThe banner names the correct card and states it became default
Verify the default movedThe new card holds the badge and the old card offers Make default

Testing a transition means asserting both ends of it. A test that checks only where the state arrived cannot distinguish a clean move from a duplicate.

Next-generation test execution with TestMu AI

Running it

kane-cli testmd run tests/stripe/billing-portal_test.md

Kane CLI drives the portal dialog, the card fields and the resulting badges from the labels a customer reads, so nothing in the file depends on the portal's internal markup.

Billing portals sit behind authentication, which is where saved browser profiles save the most time. The Kane CLI introduction covers profiles and variables, and checking the UI before a pull request covers running this at review time.

Author

...

Bhawana

Blogs: 77

  • Twitter
  • Linkedin

Bhawana is a Community Evangelist at TestMu AI with over 3 years of experience creating technically accurate, strategy-driven content in software testing. She has authored 50+ blogs on test automation, cross-browser testing, mobile testing, and real device testing. She also serves as Product Marketing Manager for Kane CLI, the command-line tool that runs browser automation from the terminal using natural-language flows in a real Chrome browser. Bhawana is certified in KaneAI, Selenium, Appium, Playwright, and Cypress, reflecting her hands-on knowledge of modern automation practices. On LinkedIn, she is followed by 6000+ QA engineers, testers, AI automation testers, and tech leaders.

Add to Google preferred sources

Summarise with AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Billing Portal FAQs

Did you find this page helpful?

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests