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 CLIE-commerce

Test an exchange offer and the cart arithmetic behind it

Apply a trade-in valuation to a phone in the cart, then check every line of the price breakdown adds up.

Published on:

Exchange offers put a second pricing engine inside the cart. A device valuation, a condition grade and a deduction all have to agree with each other, and the shopper sees a single total that either makes sense or does not.

This use case applies a trade-in on the Flipkort cart and then checks the full price breakdown rather than the total alone. Five steps, 233 seconds, all passed.

The flow under test

The reason to assert every line, not just the payable amount, is that a wrong item price and a wrong exchange value can cancel out and produce a total that looks correct.

  • Item price - 48,999.00 for the Nexa 12 Pro 5G, unchanged by the exchange.
  • Exchange discount - a deduction of 9,500.00 tied to the selected device and its condition grade.
  • Delivery - free, which is a line that appears and disappears with cart value rules and is easy to leave unasserted.
  • Total payable - 39,499.00, which has to equal the item price minus the exchange value.

Four assertions on one page state, which is cheap. The run spends 28.7 seconds on that step because the page is already loaded by the time it checks.

Note

Note: Kane CLI handles dialogs, dropdowns and radio choices as plain English instructions, so a multi-control valuation flow does not need any special handling. Start on TestMu AI. Start for free

The test file

The valuation step combines a dropdown selection, a condition choice and a submit into one instruction, then asserts the deduction appears in the cart. The condition grade is quoted in full because a different grade produces a different number.

---
mode: testing
url: https://my-testing-repo-main.vercel.app/flipkart-clone-app?reset=true
max_steps: 45
tags: [flipkart, e-commerce, exchange]
---

# Flipkort 3.2: Cart with exchange offer

Catalog objective: add a phone with an exchange offer and verify the exchange discount in the cart.
Key assertion: cart maths include the exchange deduction correctly.

## Find a phone with an exchange offer
Type "phone" into the search box, click "Search", and verify the results list "Nexa 12 Pro 5G (256 GB)".

## Open the phone and add it to the cart
Click "Nexa 12 Pro 5G (256 GB)", click "Add to cart", and verify the cart shows "Nexa 12 Pro 5G (256 GB)" with a price of "₹48,999.00".

## Open the exchange offer
Click "Check exchange offer" and verify a dialog appears titled "Exchange your old phone" with a device dropdown.

## Apply the exchange valuation
Select "Nexa 10 (128 GB)" as the device, click the "Good - no cracks, all functions work" option, click the Apply button, and verify the cart shows an exchange value of "−₹9,500.00".

## Confirm the cart arithmetic
Verify the price details show "₹48,999.00" for the item, an exchange discount of "−₹9,500.00", Delivery "Free", and a total payable of "₹39,499.00".

Run it with:

kane-cli testmd run tests/flipkart/cart-exchange-offer_test.md

The run

Five passes. Adding the phone to the cart was the slowest step at 72.2 seconds, because it opens a product page and then performs the add, with the assertion landing on the cart.

---
test: ../cart-exchange-offer_test.md
status: passed
started: 2026-09-15T09:42:15.328Z
duration_s: 233
session_id: 837d68e8-4441-4a32-b0bc-06722bc264c1
---

# Flipkort 3.2: Cart with exchange offer - Result

## Find a phone with an exchange offer ✓ passed (43.2s)
md5: bb81f5b6f1c8f91df6d192c9e842a031
Type "phone" into the search box, click "Search", and verify the results list "Nexa 12 Pro 5G (256 GB)".

## Open the phone and add it to the cart ✓ passed (72.2s)
md5: 8089250181ae6ba5a273d504d35dc34d
Click "Nexa 12 Pro 5G (256 GB)", click "Add to cart", and verify the cart shows "Nexa 12 Pro 5G (256 GB)" with a price of "₹48,999.00".

## Open the exchange offer ✓ passed (30.2s)
md5: 3ffa60077ac259762f98543eda46886b
Click "Check exchange offer" and verify a dialog appears titled "Exchange your old phone" with a device dropdown.

## Apply the exchange valuation ✓ passed (55.6s)
md5: daf24c7b5031361f811046474c62e349
Select "Nexa 10 (128 GB)" as the device, click the "Good - no cracks, all functions work" option, click the Apply button, and verify the cart shows an exchange value of "−₹9,500.00".

## Confirm the cart arithmetic ✓ passed (28.7s)
md5: 4d1ad0cbf19f5fb4fec9e5c80a773bd0
Verify the price details show "₹48,999.00" for the item, an exchange discount of "−₹9,500.00", Delivery "Free", and a total payable of "₹39,499.00".
StepResultDuration
Find a phone with an exchange offerPassed43.2s
Open the phone and add it to the cartPassed72.2s
Open the exchange offerPassed30.2s
Apply the exchange valuationPassed55.6s
Confirm the cart arithmeticPassed28.7s
Next-generation test execution with TestMu AI

Reading the evidence

What you have is a pricing test that reads like a finance check, because that is what it is. Every number the shopper is shown is named in the file, which makes the file useful to anyone reviewing the offer as well as to the pipeline running it.

The same pattern covers any cart-level deduction: coupons, loyalty burn, bundle pricing. Kane CLI as a QA agent sets out the broader approach, and calling APIs alongside a browser flow covers checking the valuation service behind the dialog.

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

Exchange Offer 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