Skip to content

Tax calculation by region (Cypress)

Example: Tax calculation by region: CA

### ✅ Tax calculation by region: CA
- **Given** the cart subtotal is 100.00
- **And** the shipping region is "CA"
- **When** taxes are calculated
- **Then** the tax should be 8.25
- **And** the total should be 108.25
import { story } from 'executable-stories-cypress';
const taxExamples = [
{ subtotal: "100.00", region: "CA", tax: "8.25", total: "108.25" },
{ subtotal: "100.00", region: "NY", tax: "8.00", total: "108.00" },
];
for (const row of taxExamples) {
it(`Tax calculation by region: ${row.region}`, () => {
story.init();
story.given(`the cart subtotal is ${row.subtotal}`);
story.given(`the shipping region is "${row.region}"`);
story.when("taxes are calculated");
story.then(`the tax should be ${row.tax}`);
story.then(`the total should be ${row.total}`);
});
}