Power Your Software Testing with AI Agents and Cloud
The Native AI-Agentic Cloud Platform to Supercharge Quality Engineering. Test Intelligently and Ship Faster.
- TestMu AI (Formerly LambdaTest)
- /
- Use Cases
- /
- Test add to cart with a product variant
Test add to cart with a product variant
Switch colour, switch connection type, then confirm the cart holds the exact variant and the price that went with it.
Published on:
Variant bugs are expensive in a way most UI bugs are not. The page looks right, the shopper buys, and the wrong colour or the wrong connector arrives. The cost shows up weeks later as a return, not as a bug report.
This use case pins the variant contract down on a product detail page: two variant switches, a price change after each, and a cart confirmation naming the exact combination. The run passed in 131 seconds.
The checks that matter
The interesting part of a variant flow is not that the buttons click. It is that the price and the selection label stay in step with each other, and that the value carried into the cart is the one on screen when the shopper pressed the button.
| Variant state | Price the page must show |
|---|---|
| Arctic White, Wireless | $84.99 |
| Arctic White, Wired | $69.99 |
| In the cart after Add to Cart | $69.99, Arctic White, Wired |
Each row is asserted on the live page rather than planned in advance, so a price that updates late or not at all is caught at the point it happens instead of surfacing as a confusing cart total three steps later.
Note: Every Kane CLI run writes a shareable evidence link with video and a step trace, which is the fastest way to settle a variant bug argument in a pull request. TestMu AI gives you the first runs free. Start for free
The same flow as a test file
The test names the variant buttons and the exact strings the page has to show after each click. The price is part of the assertion, not an afterthought.
---
mode: testing
url: https://my-testing-repo-main.vercel.app/shop-clone-app/dp/sku_headset?reset=true
max_steps: 40
tags: [amazon, e-commerce, variant]
---
# ShopKart 1.2: Add to cart with variant
Catalog objective: pick a size and colour variant and add to cart.
Key assertion: cart shows the exact variant chosen.
## Switch colour to Arctic White
Click "Arctic White" and verify the price reads "$84.99" and the selection reads "Selected: Arctic White · Wireless".
## Switch connection to Wired
Click "Wired" and verify the price reads "$69.99" and the selection reads "Selected: Arctic White · Wired".
## Add the chosen variant to the cart
Click "Add to Cart" and verify a confirmation appears reading "Added to Cart: 1 × Wireless Gaming Headset 7.1 (Arctic White · Wired) at $69.99".The third step is the one that matters most. It asserts the confirmation text in full, including quantity, product name, both variant values and the price, so a cart that silently keeps the default variant fails here. Run it with:
kane-cli testmd run tests/amazon/add-to-cart-variant_test.mdRun output
All three steps passed. The per step timings show the variant switches costing roughly the same as each other, which is the shape you want: no single interaction hanging on a slow re-render.
---
test: ../add-to-cart-variant_test.md
status: passed
started: 2026-09-21T11:51:14.315Z
duration_s: 131
session_id: 4e2af577-f9f4-424b-b536-42a170ce0285
---
# ShopKart 1.2: Add to cart with variant - Result
## Switch colour to Arctic White ✓ passed (48.7s)
md5: c82629842aeec906c00ef35e80ff23e6
Click "Arctic White" and verify the price reads "$84.99" and the selection reads "Selected: Arctic White · Wireless".
## Switch connection to Wired ✓ passed (41s)
md5: 9ad19623124282193fa9719b9a6c372d
Click "Wired" and verify the price reads "$69.99" and the selection reads "Selected: Arctic White · Wired".
## Add the chosen variant to the cart ✓ passed (36s)
md5: 6c78f257511b11a41b538b28bd4225ec
Click "Add to Cart" and verify a confirmation appears reading "Added to Cart: 1 × Wireless Gaming Headset 7.1 (Arctic White · Wired) at $69.99".| Step | Result | Duration |
|---|---|---|
| Switch colour to Arctic White | Passed | 48.7s |
| Switch connection to Wired | Passed | 41s |
| Add the chosen variant to the cart | Passed | 36s |
Taking it further
The output is a variant check that a product manager can read and a pipeline can run. Because the assertions quote the real on screen strings, the file doubles as a specification of what the variant widget is supposed to say.
Pair it with a checkout test so the variant is followed all the way to the order record. Assertions in Kane CLI goes deeper on how live page checks are decided, and the pre-PR UI check workflow shows where this fits in a review cycle.
Author
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.
Variant Selection Testing 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




