Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed E2E dashboard tests (#14137)

Damian Legawiec3a8765d540ab
diff --git a/packages/dashboard/e2e/products-new.spec.ts b/packages/dashboard/e2e/products-new.spec.ts
index 5d7dcfaff9..5eecb4ee75 100644
--- a/packages/dashboard/e2e/products-new.spec.ts
+++ b/packages/dashboard/e2e/products-new.spec.ts
@@ -87,8 +87,8 @@ test.describe('new product — multi-variant', () => {
// 4. Set prices via the inline Prices card.
const prices = pricesCard(page)
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bred$/i }), '20.00')
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bblue$/i }), '22.50')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bred$/i }), '20.00')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bblue$/i }), '22.50')
await page.getByRole('button', { name: /^create product$/i }).click()
// Lands on the edit page.
@@ -112,10 +112,10 @@ test.describe('new product — multi-variant', () => {
await expect(reloadedOnHand.nth(0)).toHaveValue('3')
await expect(reloadedOnHand.nth(cellsPerVariant)).toHaveValue('7')
- await expect(prices.getByRole('textbox', { name: /price for .*\bred$/i })).toHaveValue(
+ await expect(prices.getByRole('textbox', { name: /^price for .*\bred$/i })).toHaveValue(
/^20([.,]0+)?$/,
)
- await expect(prices.getByRole('textbox', { name: /price for .*\bblue$/i })).toHaveValue(
+ await expect(prices.getByRole('textbox', { name: /^price for .*\bblue$/i })).toHaveValue(
/^22[.,]5/,
)
})
diff --git a/packages/dashboard/e2e/products-prices-inventory.spec.ts b/packages/dashboard/e2e/products-prices-inventory.spec.ts
index dedf411f29..b63632bcd2 100644
--- a/packages/dashboard/e2e/products-prices-inventory.spec.ts
+++ b/packages/dashboard/e2e/products-prices-inventory.spec.ts
@@ -64,8 +64,8 @@ test.describe('product prices — multi-variant', () => {
// `label` comes from `composeOptionsText` ("<Type>: <Value>"), so we
// anchor on the trailing value label.
const prices = pricesCard(page)
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bred$/i }), '19.99')
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bblue$/i }), '29.99')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bred$/i }), '19.99')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bblue$/i }), '29.99')
// Save the product via the page-level Save button — prices ride the same
// PATCH as everything else.
@@ -77,10 +77,10 @@ test.describe('product prices — multi-variant', () => {
// Reload and re-check the inline cells — both prices must round-trip.
await page.reload()
await expect(
- pricesCard(page).getByRole('textbox', { name: /price for .*\bred$/i }),
+ pricesCard(page).getByRole('textbox', { name: /^price for .*\bred$/i }),
).toHaveValue(/^19[.,]99$/)
await expect(
- pricesCard(page).getByRole('textbox', { name: /price for .*\bblue$/i }),
+ pricesCard(page).getByRole('textbox', { name: /^price for .*\bblue$/i }),
).toHaveValue(/^29[.,]99$/)
})
})
@@ -271,8 +271,8 @@ test.describe('product variants × prices × inventory', () => {
// product-level Save persists everything (SKUs, inventory, prices)
// in one PATCH.
const prices = pricesCard(page)
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bred$/i }), '15.00')
- await fillGridCell(prices.getByRole('textbox', { name: /price for .*\bblue$/i }), '17.50')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bred$/i }), '15.00')
+ await fillGridCell(prices.getByRole('textbox', { name: /^price for .*\bblue$/i }), '17.50')
await page.getByRole('button', { name: /save product/i }).click()
await expect(page.getByRole('button', { name: /save product/i })).toBeDisabled({
timeout: 30_000,
@@ -287,10 +287,10 @@ test.describe('product variants × prices × inventory', () => {
await expect(reloadedOnHand.nth(cellsPerVariant)).toHaveValue('10')
await expect(
- pricesCard(page).getByRole('textbox', { name: /price for .*\bred$/i }),
+ pricesCard(page).getByRole('textbox', { name: /^price for .*\bred$/i }),
).toHaveValue(/^15([.,]0+)?$/)
await expect(
- pricesCard(page).getByRole('textbox', { name: /price for .*\bblue$/i }),
+ pricesCard(page).getByRole('textbox', { name: /^price for .*\bblue$/i }),
).toHaveValue(/^17[.,]5/)
})
})