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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
import { readFileSync } from 'node:fs'
import { expect, type Page, test } from '@playwright/test'
import {
addQuantityBreak,
csvFile,
deleteCatalogPickerProducts,
FIXTURE_PROMO_PRODUCT,
FIXTURE_PROMO_SKU,
gotoIndex,
login,
openRowMenu,
rowButton,
seedCatalogPickerProducts,
} from './helpers'
const PRICE_LISTS_PATH = (storeId: string) => `/${storeId}/products/price-lists`
const PRODUCTS_PATH = (storeId: string) => `/${storeId}/products`
const CTA = /new price list/i
async function startNewPriceList(page: Page, storeId: string, name: string) {
await page.getByRole('button', { name: CTA }).click()
await expect(page).toHaveURL(new RegExp(`/${storeId}/products/price-lists/new`), {
timeout: 15_000,
})
await expect(page.getByRole('heading', { name: /create price list/i })).toBeVisible({
timeout: 15_000,
})
await page.locator('#name').fill(name)
}
async function submitCreate(page: Page, name: string) {
await page.getByRole('button', { name: /^create$/i }).click()
// On success the route navigates to the edit page whose header title
// is the list's name.
await expect(page.getByRole('heading', { name })).toBeVisible({ timeout: 15_000 })
}
async function pickRule(page: Page, ruleLabel: RegExp) {
await page.getByRole('button', { name: /^add rule$/i }).click()
await expect(page.getByRole('heading', { name: /^add rule$/i })).toBeVisible()
// Scope to the picker dialog — page already has rule rows with the same
// label after a list has rules.
await page.getByRole('dialog').getByRole('button', { name: ruleLabel }).click()
}
// Mirrors the helper in `promotions.spec.ts`: fills the autocomplete/combobox
// inside the rule editor sheet, then clicks the first matching option. Base
// UI's Combobox closes the dropdown on select; don't press Escape because
// the keydown bubbles up to the Sheet and dismisses the editor.
async function pickAutocompleteOption(page: Page, placeholderRegex: RegExp, optionLabel: string) {
const input = page.getByRole('dialog').getByPlaceholder(placeholderRegex)
await input.fill(optionLabel)
await page
.getByRole('option', { name: new RegExp(optionLabel, 'i') })
.first()
.click()
}
async function saveEditor(page: Page) {
await page
.getByRole('dialog')
.getByRole('button', { name: /^save$/i })
.click()
}
async function saveForm(page: Page) {
// Top-of-page Save (the one in the PageHeader, which renders inside
// <main>). Scope to <main> so we don't hit a Save button inside a
// dialog or footer.
await page
.getByRole('main')
.getByRole('button', { name: /^save$/i })
.first()
.click()
}
// Add a product through the Products card's picker sheet (the same shared
// membership panel categories/collections/catalogs use). Membership lives in
// form state, so the row appears immediately but persists only on Save.
async function pickProductOnPage(page: Page, optionLabel: string) {
await page
.locator('main')
.getByRole('button', { name: /^add products$/i })
.click()
const picker = page.getByRole('dialog')
await expect(picker.getByRole('heading', { name: /add products to price list/i })).toBeVisible()
// Search is debounced + async; wait for the matching option to render
// before selecting it.
await picker.getByRole('searchbox').fill(optionLabel)
const option = picker.getByRole('button', { name: new RegExp(optionLabel, 'i') }).first()
await expect(option).toBeVisible({ timeout: 15_000 })
await option.click()
const confirm = picker.getByRole('button', { name: /^add 1$/i })
await expect(confirm).toBeEnabled({ timeout: 15_000 })
await confirm.click()
await expect(picker).toBeHidden({ timeout: 15_000 })
// The staged product renders as a row in the membership table.
await expect(page.getByRole('row', { name: new RegExp(optionLabel, 'i') }).first()).toBeVisible({
timeout: 15_000,
})
}
async function openBulkPriceEditor(page: Page) {
// Single "Edit prices" button on both surfaces — the price list's page
// header and the product PageHeader.
await page.getByRole('button', { name: /^edit prices$/i }).click()
await expect(page.getByRole('dialog')).toBeVisible({ timeout: 15_000 })
await expect(page.getByRole('heading', { name: /^edit prices —/i })).toBeVisible()
}
test.describe('price lists', () => {
test('lists price lists', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
})
test('creates a price list', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await page.goto(PRICE_LISTS_PATH(creds.store_id))
await expect(rowButton(page, name)).toBeVisible({ timeout: 15_000 })
})
test('row click opens the edit page', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Edit ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await page.goto(PRICE_LISTS_PATH(creds.store_id))
await rowButton(page, name).click()
await expect(page).toHaveURL(/\/products\/price-lists\/pl_/, { timeout: 15_000 })
await expect(page.getByRole('heading', { name })).toBeVisible({ timeout: 15_000 })
await expect(page.locator('#name')).toHaveValue(name)
})
test('adds a Volume Rule via the rule editor', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Rule ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
// Rule-picker buttons include name + description; match by name only.
await pickRule(page, /^volume pricing\b/i)
await expect(page.getByRole('heading', { name: /^volume pricing$/i })).toBeVisible({
timeout: 5_000,
})
await page
.getByRole('dialog')
.getByLabel(/minimum quantity/i)
.fill('10')
await saveEditor(page)
await expect(page.getByText(/min quantity: 10/i)).toBeVisible({ timeout: 5_000 })
await saveForm(page)
await expect(page.getByText(/volume pricing/i).first()).toBeVisible({ timeout: 15_000 })
})
// The audience rules (customer group / customer) are superseded by catalog
// assignment (docs/plans/6.0-catalog-agreement-rework.md). Existing rules
// keep working and rendering; the picker stops offering them.
test('does not offer the superseded audience rules in the picker', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL No Audience Rules ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await page.getByRole('button', { name: /^add rule$/i }).click()
await expect(page.getByRole('heading', { name: /^add rule$/i })).toBeVisible()
const picker = page.getByRole('dialog')
// The context rules stay first-class…
await expect(picker.getByRole('button', { name: /^volume pricing\b/i })).toBeVisible()
await expect(picker.getByRole('button', { name: /^market\b/i })).toBeVisible()
// …the audience rules are gone. Both are named "Customer…", and the
// picker button's accessible name continues into the description, so one
// prefix match covers the pair — an exact `/^customer$/i` would match
// neither and pass however many audience rules the picker offered.
await expect(picker.getByRole('button', { name: /^customer\b/i })).toHaveCount(0)
})
test('adds a Market Rule with the seeded default market', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Market Rule ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await pickRule(page, /^market\b/i)
await expect(page.getByRole('heading', { name: /^market$/i })).toBeVisible({
timeout: 5_000,
})
// `Spree::Store#ensure_default_market` seeds a default market named
// after the store's default country. The e2e setup defaults to US, so
// the seeded market is "United States".
const seededMarket = 'United States'
await pickAutocompleteOption(page, /search markets/i, seededMarket)
await saveEditor(page)
await expect(page.getByText(seededMarket).first()).toBeVisible({ timeout: 5_000 })
await saveForm(page)
await page.reload()
await expect(page.getByText(seededMarket).first()).toBeVisible({ timeout: 15_000 })
})
test('removes a rule while editing', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Remove Rule ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
// Stage a Volume Rule so we have a row to remove. Picker opens the
// editor sheet automatically on the new row; submit it with valid
// defaults so it gets persisted on save below.
await pickRule(page, /^volume pricing\b/i)
await page
.getByRole('dialog')
.getByLabel(/minimum quantity/i)
.fill('5')
await saveEditor(page)
await saveForm(page)
await expect(page.getByText(/min quantity: 5/i)).toBeVisible({ timeout: 15_000 })
// Click the trash button on the Volume Rule row, confirm the dialog,
// and verify the row disappears. The rule list and the picker share
// a single `<RuleRow>` div with `items-stretch`; scope to it so we
// don't pick up unrelated buttons.
const ruleRow = page.locator('div.items-stretch').filter({ hasText: 'Volume pricing' }).first()
await ruleRow.getByRole('button').last().click()
await expect(page.getByRole('heading', { name: /remove rule\?/i })).toBeVisible()
await page
.getByRole('dialog')
.getByRole('button', { name: /^remove$/i })
.click()
await expect(page.getByText(/volume pricing/i)).toHaveCount(0, { timeout: 5_000 })
// Save the form so the omission is persisted (the backend reconciles
// "row omitted from payload" as a destroy).
await saveForm(page)
// Reload and prove the row is actually gone, not just hidden client-side.
await page.reload()
await expect(page.getByText(/volume pricing/i)).toHaveCount(0, { timeout: 15_000 })
})
test('bulk-edits a price-list override via the dialog', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Prices ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
// Attach a seeded product so the bulk editor has a row to edit.
// Saving creates a placeholder price the editor can fill in.
await pickProductOnPage(page, FIXTURE_PROMO_PRODUCT)
await saveForm(page)
// The Products card's description picks up the price count once
// placeholder prices exist. A multi-currency store creates one
// placeholder per currency, so the copy is singular or plural depending
// on the store — match either form.
await expect(page.getByText(/\d+ price(s)? (is|are) configured/i)).toBeVisible({
timeout: 15_000,
})
await openBulkPriceEditor(page)
// MoneyCell's editable input carries `aria-label="Price for <label>"`.
// The fixture is a master variant with empty `options_text`, so the
// suffix may be empty or "Default" depending on null-vs-empty handling.
const priceInput = page
.getByRole('dialog')
.getByLabel(/^price for/i)
.first()
await expect(priceInput).toBeVisible({ timeout: 15_000 })
// MoneyCell is a spreadsheet cell — readonly until you double-click
// (or focus + press Enter) to enter edit mode.
await priceInput.dblclick()
await priceInput.fill('33.33')
await priceInput.press('Enter')
// Header surfaces the unsaved-change summary as soon as the cell commits.
await expect(page.getByRole('dialog').getByText(/1 unsaved change/i)).toBeVisible()
await page
.getByRole('dialog')
.getByRole('button', { name: /^save prices$/i })
.click()
// The dirty-summary chip disappears once the upsert resolves and the
// editor flushes its in-memory edits map. The Sonner save-success
// toast auto-dismisses too quickly to be a reliable signal.
await expect(page.getByRole('dialog').getByText(/unsaved change/i)).toBeHidden({
timeout: 15_000,
})
await expect(
page
.getByRole('dialog')
.getByLabel(/^price for/i)
.first(),
).toHaveValue('33.33')
})
// Paging the products card must not write anything. The pagination control
// lives inside the price list's own form, so a button without an explicit
// type submits it — the page-2 click used to PATCH the whole list
// (docs/plans/6.0-volume-pricing.md).
test('paging the products card does not save the price list', async ({ page }) => {
const creds = await login(page)
const prefix = `E2E PL Paging Product ${Date.now()}`
// The card holds 25 rows a page, so a second page needs more than that.
const seeded = await seedCatalogPickerProducts(
page,
creds.store_id,
prefix,
creds.accessToken,
30,
)
try {
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Paging ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
// Attach them through the API: the picker would take 30 clicks, and the
// subject here is paging, not membership.
const priceListId = page.url().split('/price-lists/')[1]?.split(/[/?]/)[0] ?? ''
expect(priceListId).toMatch(/^pl_/)
await page.request.post(`/api/v3/admin/price_lists/${priceListId}/products`, {
headers: {
'X-Spree-Store-Id': creds.store_id,
Authorization: `Bearer ${creds.accessToken}`,
},
data: { product_ids: seeded },
})
await page.reload()
const writes: string[] = []
page.on('request', (request) => {
if (request.method() === 'PATCH' && /\/price_lists\//.test(request.url())) {
writes.push(request.url())
}
})
// Unconditional: if there is no second page the seeding is wrong and the
// test must say so rather than skip the click it exists to make.
const next = page.getByRole('button', { name: /next page/i })
await expect(next).toBeVisible({ timeout: 15_000 })
await next.click()
// The page changed, and nothing was written on the way.
await expect(page.getByText(/page 2 of/i)).toBeVisible({ timeout: 15_000 })
expect(writes).toEqual([])
await expect(
page
.getByRole('main')
.getByRole('button', { name: /^save$/i })
.first(),
).toBeDisabled()
} finally {
await deleteCatalogPickerProducts(page, creds.store_id, creds.accessToken, seeded).catch(
() => undefined,
)
}
})
// A ladder is edited in the same grid: a variant's row grows a rung per
// quantity break, and the rung is what the server holds once saved
// (docs/plans/6.0-volume-pricing.md).
test('adds a quantity break in the price spreadsheet', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Breaks ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await pickProductOnPage(page, FIXTURE_PROMO_PRODUCT)
await saveForm(page)
await expect(page.getByText(/\d+ price(s)? (is|are) configured/i)).toBeVisible({
timeout: 15_000,
})
await openBulkPriceEditor(page)
const grid = page.getByRole('dialog')
const priceInput = grid.getByLabel(/^price for/i).first()
await expect(priceInput).toBeVisible({ timeout: 15_000 })
await priceInput.dblclick()
await priceInput.fill('30.00')
await priceInput.press('Enter')
// A figure with cents: the grid drops trailing zeros when it reloads.
await addQuantityBreak(grid, '24', '25.25')
await grid.getByRole('button', { name: /^save prices$/i }).click()
await expect(grid.getByText(/unsaved change/i)).toBeHidden({ timeout: 15_000 })
// Reopened, the grid shows what was written rather than what was typed.
await grid.getByRole('button', { name: /^close$/i }).click()
await expect(grid).toBeHidden({ timeout: 15_000 })
await openBulkPriceEditor(page)
await expect(page.getByRole('dialog').getByLabel(/^price for from qty 24$/i)).toHaveValue(
'25.25',
{ timeout: 15_000 },
)
await page
.getByRole('dialog')
.getByRole('button', { name: /^close$/i })
.click()
// The products card reads the same ladder: the variant row shows the
// list's amount, its tier count, and the ladder with the fixed-tiers
// note on hover — the catalog's reading, on the list's own page.
await expect(page.getByText('$30.00')).toBeVisible({ timeout: 15_000 })
const badge = page.getByRole('button', { name: /\+1 tier$/i })
await expect(badge).toBeVisible()
await badge.hover()
await expect(page.getByText('$25.25')).toBeVisible({ timeout: 15_000 })
await expect(page.getByText(/percentage adjustment does not apply here/i)).toBeVisible()
})
// The list's prices travel as a CSV keyed by SKU, one rung per row: the
// import merges the file into the list and reports the rows it could not
// place, and the export hands the ladder back in the same shape.
test('imports a CSV of prices and exports the list', async ({ page }) => {
// Upload + background row processing legitimately take a while.
test.setTimeout(180_000)
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const suffix = Date.now()
const name = `E2E PL CSV ${suffix}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await page.getByRole('button', { name: /^import$/i }).click()
await expect(page.getByRole('heading', { name: /import from csv/i })).toBeVisible()
await page
.getByRole('dialog')
.locator('input[type="file"]')
.setInputFiles(
csvFile([
'sku,currency,min_quantity,price,compare_at_price',
`${FIXTURE_PROMO_SKU},USD,1,17.25,`,
`${FIXTURE_PROMO_SKU},USD,24,15.75,`,
// A SKU the store does not have is a row-level failure, not the
// import's.
`E2E-NOPE-${suffix},USD,1,1.00,`,
]),
)
await page.getByRole('button', { name: /^continue$/i }).click()
// The export writes the schema's own header names, so a file in that
// shape maps itself.
await expect(page.getByText('Map columns')).toBeVisible({ timeout: 15_000 })
await page.getByRole('button', { name: /start import/i }).click()
await expect(page.getByText(/import completed/i)).toBeVisible({ timeout: 120_000 })
await expect(page.getByText(/1 failed/i).first()).toBeVisible()
await page
.getByRole('dialog')
.getByRole('button', { name: /^close$/i })
.click()
// The rows landed on the list: the spreadsheet opens on them.
await openBulkPriceEditor(page)
const grid = page.getByRole('dialog')
await expect(grid.getByLabel(/^price for/i).first()).toHaveValue('17.25', { timeout: 15_000 })
await expect(grid.getByLabel(/^price for from qty 24$/i)).toHaveValue('15.75')
await grid.getByRole('button', { name: /^close$/i }).click()
await expect(grid).toBeHidden({ timeout: 15_000 })
// One click exports this list — no filtered-or-all dialog, the page
// already says which list — and the file carries the ladder.
const download = page.waitForEvent('download', { timeout: 60_000 })
await page.getByRole('button', { name: /^export$/i }).click()
const file = await download
expect(file.suggestedFilename()).toMatch(/price_list_prices/)
const body = readFileSync((await file.path()) as string, 'utf8')
expect(body).toContain(`${FIXTURE_PROMO_SKU},`)
expect(body).toContain(',USD,24,15.75,')
expect(body).not.toContain(`E2E-NOPE-${suffix}`)
})
// Multi-currency: the bulk editor scopes its grid to one currency at a time
// via the header currency selector. Edit + save a USD price, switch to EUR,
// edit + save again, then confirm each currency kept its own value. The e2e
// store seeds a EUR market alongside USD (see global-setup.ts).
test('bulk-edits price-list overrides in two currencies', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Multi-Cur ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await pickProductOnPage(page, FIXTURE_PROMO_PRODUCT)
await saveForm(page)
await expect(page.getByText(/\d+ price(s)? (is|are) configured/i)).toBeVisible({
timeout: 15_000,
})
await openBulkPriceEditor(page)
const dialog = page.getByRole('dialog')
// The editor opens on the store default currency (USD).
const currencyTrigger = dialog.getByRole('combobox').first()
await expect(currencyTrigger).toContainText('USD')
const priceCell = () => dialog.getByLabel(/^price for/i).first()
await expect(priceCell()).toBeVisible({ timeout: 15_000 })
await priceCell().dblclick()
await priceCell().fill('40.00')
await priceCell().press('Enter')
await dialog.getByRole('button', { name: /^save prices$/i }).click()
await expect(dialog.getByText(/unsaved change/i)).toBeHidden({ timeout: 15_000 })
// Switch to EUR — the grid reloads with that currency's (empty) prices,
// still in the admin's own (English) number format: `19.50` saves as
// 19.50, never 1950.
await currencyTrigger.click()
await page.getByRole('option', { name: 'EUR' }).click()
await expect(currencyTrigger).toContainText('EUR')
await priceCell().dblclick()
await priceCell().fill('19.50')
await priceCell().press('Enter')
await expect(priceCell()).toHaveValue('19.50')
await dialog.getByRole('button', { name: /^save prices$/i }).click()
await expect(dialog.getByText(/unsaved change/i)).toBeHidden({ timeout: 15_000 })
// Reload EUR from the server, then enter `55,55`: a comma before two digits
// cannot be grouping, so it is read as the decimal and persists as 55.55,
// not 5555.
await currencyTrigger.click()
await page.getByRole('option', { name: 'USD' }).click()
await expect(currencyTrigger).toContainText('USD')
await currencyTrigger.click()
await page.getByRole('option', { name: 'EUR' }).click()
await expect(currencyTrigger).toContainText('EUR')
await expect(priceCell()).toHaveValue(/^19\.50?$/, { timeout: 15_000 })
await priceCell().dblclick()
await priceCell().fill('55,55')
await priceCell().press('Enter')
await dialog.getByRole('button', { name: /^save prices$/i }).click()
await expect(dialog.getByText(/unsaved change/i)).toBeHidden({ timeout: 15_000 })
await expect(priceCell()).toHaveValue('55.55')
// Switch back to USD — its value is independent of the EUR edit and shown
// period-decimal.
await currencyTrigger.click()
await page.getByRole('option', { name: 'USD' }).click()
await expect(currencyTrigger).toContainText('USD')
// Period-decimal; the grid trims trailing zeros (40.00 → 40.0).
await expect(priceCell()).toHaveValue(/^40[.,]0+$/)
})
// Skip on CI: the dblclick→fill→blur pattern flakes against the fixture
// product's seeded `33.33` price. The same code path (PricesCard inline
// editing + product-form Save round-trip) is exercised on a fresh product
// by products-prices-inventory.spec.ts, which uses the same fillGridCell
// helper but never hits this flake. Tracked as a follow-up.
test.skip('bulk-edits a product base price from the product page', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRODUCTS_PATH(creds.store_id), /add product/i)
// Land on the seeded product's edit page via the index row click.
// Product table renders the name cell as a `<Link>` (not a button).
await page
.getByRole('link', { name: new RegExp(FIXTURE_PROMO_PRODUCT, 'i') })
.first()
.click()
await expect(page).toHaveURL(/\/products\/prod_/, { timeout: 15_000 })
await expect(page.getByRole('heading', { name: FIXTURE_PROMO_PRODUCT })).toBeVisible({
timeout: 15_000,
})
// Base product prices now live in an inline PricesCard on the product
// page — the modal "Edit prices" flow only applies to price-list pages.
// Use the DataGrid textbox role + commit-by-blur pattern that the rest
// of the product e2e suite uses.
const pricesCard = page
.locator('[data-slot="card"]')
.filter({ has: page.locator('[data-slot="card-title"]', { hasText: /^Prices$/ }) })
const priceCell = pricesCard.getByRole('textbox', { name: /^price for/i }).first()
await expect(priceCell).toBeVisible({ timeout: 15_000 })
await priceCell.dblclick()
await priceCell.fill('29.95')
await priceCell.blur()
// Save via the product-level Save button. Prices ride the product PATCH.
await page.getByRole('button', { name: /save product/i }).click()
await expect(page.getByRole('button', { name: /save product/i })).toBeDisabled({
timeout: 30_000,
})
// Reload and confirm the price persisted in the inline card.
await page.reload()
await expect(pricesCard.getByRole('textbox', { name: /^price for/i }).first()).toHaveValue(
/^29[.,]95$/,
{ timeout: 15_000 },
)
})
test('deletes a price list', async ({ page }) => {
const creds = await login(page)
await gotoIndex(page, PRICE_LISTS_PATH(creds.store_id), CTA)
const name = `E2E PL Delete ${Date.now()}`
await startNewPriceList(page, creds.store_id, name)
await submitCreate(page, name)
await page.goto(PRICE_LISTS_PATH(creds.store_id))
await expect(rowButton(page, name)).toBeVisible({ timeout: 15_000 })
await openRowMenu(page, name)
await page.getByRole('menuitem', { name: /^delete$/i }).click()
await expect(page.getByRole('heading', { name: /delete price list\?/i })).toBeVisible()
await page
.getByRole('dialog')
.getByRole('button', { name: /^delete$/i })
.click()
await expect(rowButton(page, name)).toHaveCount(0, { timeout: 15_000 })
})
})