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.

Added end-to-end tests for list search, filters and sorting

Damian Legawiec7be9b825e622
diff --git a/packages/dashboard/e2e/customers-list.spec.ts b/packages/dashboard/e2e/customers-list.spec.ts
new file mode 100644
index 0000000000..f2bd97b81e
--- /dev/null
+++ b/packages/dashboard/e2e/customers-list.spec.ts
@@ -0,0 +1,100 @@
+import { expect, type Page, test } from '@playwright/test'
+import {
+ addListFilter,
+ addTextFilter,
+ adminRequest,
+ type E2ELoginSession,
+ gotoIndex,
+ login,
+ searchList,
+ sortList,
+} from './helpers'
+
+const CUSTOMERS_PATH = (storeId: string) => `/${storeId}/customers`
+const CTA = /new customer/i
+const SEARCH = /search by email or name/i
+
+/**
+ * Two customers only this test owns, sharing a stamped last name: one
+ * subscribed to the newsletter with a phone number, one neither.
+ */
+async function seedCustomers(page: Page, session: E2ELoginSession) {
+ const stamp = `${Date.now()}`
+ const lastName = `Listtest${stamp}`
+ const subscriber = {
+ email: `a-list-${stamp}@example.com`,
+ first_name: 'Ada',
+ last_name: lastName,
+ phone: `555${stamp.slice(-7)}`,
+ accepts_email_marketing: true,
+ }
+ const other = {
+ email: `b-list-${stamp}@example.com`,
+ first_name: 'Ben',
+ last_name: lastName,
+ accepts_email_marketing: false,
+ }
+ await adminRequest(page, session, 'post', '/customers', subscriber)
+ await adminRequest(page, session, 'post', '/customers', other)
+
+ return { lastName, subscriber, other }
+}
+
+const row = (page: Page, email: string) => page.getByRole('row').filter({ hasText: email })
+
+test.describe('customers list', () => {
+ test('searches by name and by email', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, subscriber, other } = await seedCustomers(page, session)
+ await gotoIndex(page, CUSTOMERS_PATH(session.store_id), CTA)
+
+ await searchList(page, SEARCH, lastName)
+ await expect(row(page, subscriber.email)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, other.email)).toBeVisible()
+
+ await searchList(page, SEARCH, other.email)
+ await expect(row(page, other.email)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, subscriber.email)).toBeHidden()
+ })
+
+ test('filters by newsletter subscription', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, subscriber, other } = await seedCustomers(page, session)
+ await gotoIndex(page, CUSTOMERS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, lastName)
+ await expect(row(page, other.email)).toBeVisible({ timeout: 15_000 })
+
+ await addListFilter(page, /^newsletter$/i, /^yes$/i)
+
+ await expect(row(page, subscriber.email)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, other.email)).toBeHidden()
+ })
+
+ test('filters by phone', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, subscriber, other } = await seedCustomers(page, session)
+ await gotoIndex(page, CUSTOMERS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, lastName)
+ await expect(row(page, other.email)).toBeVisible({ timeout: 15_000 })
+
+ await addTextFilter(page, /^phone$/i, /^contains$/i, subscriber.phone.slice(-7))
+
+ await expect(row(page, subscriber.email)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, other.email)).toBeHidden()
+ })
+
+ test('sorts by email', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, subscriber, other } = await seedCustomers(page, session)
+ await gotoIndex(page, CUSTOMERS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, lastName)
+ await expect(row(page, other.email)).toBeVisible({ timeout: 15_000 })
+
+ const firstRow = page.getByRole('row').nth(1)
+ await sortList(page, /^email$/i, 'descending')
+ await expect(firstRow).toContainText(other.email, { timeout: 15_000 })
+
+ await sortList(page, /^email$/i, 'ascending')
+ await expect(firstRow).toContainText(subscriber.email, { timeout: 15_000 })
+ })
+})
diff --git a/packages/dashboard/e2e/helpers.ts b/packages/dashboard/e2e/helpers.ts
index 4ffb1f7bca..7d7eec05bc 100644
--- a/packages/dashboard/e2e/helpers.ts
+++ b/packages/dashboard/e2e/helpers.ts
@@ -490,6 +490,19 @@ export async function invitationAcceptancePath(
* has; it also saves spec time over driving checkout.
*/
export async function createShippedOrder(page: Page, accessToken: string, quantity = 2) {
+ return createPlacedOrder(page, accessToken, { quantity })
+}
+
+/**
+ * Places an order for the promo customer, paid by store credit, and ships it
+ * unless `ship` is false. `firstName` / `lastName` set the billing name, so a
+ * list test can tell its own orders apart from everyone else's.
+ */
+export async function createPlacedOrder(
+ page: Page,
+ accessToken: string,
+ { quantity = 2, ship = true, firstName = 'Promo', lastName = 'Customer' } = {},
+) {
const headers = { Authorization: `Bearer ${accessToken}` }
const request = async (method: 'get' | 'post' | 'patch', path: string, data?: object) => {
const res = await page.request[method](path, { headers, data })
@@ -504,8 +517,8 @@ export async function createShippedOrder(page: Page, accessToken: string, quanti
const customerId = customers.data[0].id
const variants = await request('get', `/api/v3/admin/variants?q[sku_eq]=${FIXTURE_PROMO_SKU}`)
const address = {
- first_name: 'Promo',
- last_name: 'Customer',
+ first_name: firstName,
+ last_name: lastName,
address1: '1 Main St',
city: 'Los Angeles',
country_code: 'US',
@@ -529,14 +542,101 @@ export async function createShippedOrder(page: Page, accessToken: string, quanti
await request('patch', `/api/v3/admin/orders/${order.id}/complete`)
const fulfillments = await request('get', `/api/v3/admin/orders/${order.id}/fulfillments`)
- for (const fulfillment of fulfillments.data) {
+ for (const fulfillment of ship ? fulfillments.data : []) {
await request(
'patch',
`/api/v3/admin/orders/${order.id}/fulfillments/${fulfillment.id}/fulfill`,
)
}
- return order as { id: string; number: string }
+ return order as { id: string; number: string; total: string }
+}
+
+/**
+ * An Admin API call as the signed-in admin, for seeding the records a list
+ * test filters. Fails the test with the response body when the call fails.
+ */
+export async function adminRequest<T = Record<string, unknown>>(
+ page: Page,
+ session: E2ELoginSession,
+ method: 'get' | 'post' | 'patch' | 'delete',
+ path: string,
+ data?: object,
+): Promise<T> {
+ const res = await page.request[method](`/api/v3/admin${path}`, {
+ headers: {
+ Authorization: `Bearer ${session.accessToken}`,
+ 'X-Spree-Store-Id': session.store_id,
+ },
+ data,
+ })
+ expect(res.ok(), `${method.toUpperCase()} ${path}: ${await res.text()}`).toBeTruthy()
+ return (res.status() === 204 ? {} : await res.json()) as T
+}
+
+/** Types into a list's search box. */
+export async function searchList(page: Page, placeholder: RegExp, text: string) {
+ await page.getByPlaceholder(placeholder).fill(text)
+}
+
+/**
+ * Adds a typed filter from the list's Add filter panel: a text, number or
+ * date field, an operator, then the value.
+ */
+export async function addTextFilter(page: Page, field: RegExp, operator: RegExp, value: string) {
+ await page.getByRole('button', { name: /add filter/i }).click()
+ await page.locator('[data-slot="filter-panel-item"]').getByText(field).click()
+ const controls = page.locator('[data-slot="filter-panel-controls"]')
+ await controls.getByRole('combobox').click()
+ await page.getByRole('option', { name: operator }).click()
+ await controls.getByPlaceholder(/filter…/i).fill(value)
+ await controls.getByRole('button', { name: /^apply$/i }).click()
+ await expect(controls).toBeHidden()
+}
+
+/** Adds a filter whose values are listed (a status, yes or no) by picking one. */
+export async function addListFilter(page: Page, field: RegExp, value: RegExp) {
+ await page.getByRole('button', { name: /add filter/i }).click()
+ const items = page.locator('[data-slot="filter-panel-item"]')
+ await items.getByText(field).click()
+ await items.getByText(value).click()
+}
+
+/** Adds a filter on related records (categories, tags) by searching for one and ticking it. */
+export async function addRecordFilter(page: Page, field: RegExp, value: string) {
+ await page.getByRole('button', { name: /add filter/i }).click()
+ await page.locator('[data-slot="filter-panel-item"]').getByText(field).click()
+ await page.getByPlaceholder(/filter to…/i).fill(value)
+ await page.getByRole('button', { name: value }).click()
+ await page.keyboard.press('Escape')
+}
+
+/**
+ * Narrows a quick filter in the toolbar to one value. Every value starts
+ * ticked, so narrowing means unticking the rest.
+ */
+export async function narrowQuickFilter(page: Page, trigger: RegExp, keep: RegExp) {
+ await page.getByRole('button', { name: trigger }).click()
+ const items = page.getByRole('menuitemcheckbox')
+ await expect(items.first()).toBeVisible()
+ for (const item of await items.all()) {
+ const name = (await item.textContent()) ?? ''
+ if (!keep.test(name.trim()) && (await item.getAttribute('aria-checked')) === 'true') {
+ await item.click()
+ }
+ }
+ await page.keyboard.press('Escape')
+}
+
+/** Sorts a list by one of its columns, through the toolbar's Sort menu. */
+export async function sortList(page: Page, field: RegExp, direction: 'ascending' | 'descending') {
+ const trigger = page.getByRole('button', { name: /^sort$/i })
+ await trigger.click()
+ await page.getByRole('menuitemradio', { name: field }).click()
+ const order = page.getByRole('menuitemradio', { name: new RegExp(`^${direction}$`, 'i') })
+ if (!(await order.isVisible())) await trigger.click()
+ await order.click()
+ await page.keyboard.press('Escape')
}
/**
diff --git a/packages/dashboard/e2e/list-filters.spec.ts b/packages/dashboard/e2e/list-filters.spec.ts
new file mode 100644
index 0000000000..79bd1f30eb
--- /dev/null
+++ b/packages/dashboard/e2e/list-filters.spec.ts
@@ -0,0 +1,130 @@
+import { expect, type Page, test } from '@playwright/test'
+import { addListFilter, adminRequest, login, narrowQuickFilter, searchList } from './helpers'
+
+// Searches and filters the API used to ignore, so each list came back whole
+// while the control said it was narrowed. Each test narrows a list of its own
+// records and checks that one leaves it.
+
+const stamp = () => `${Date.now()}`
+const row = (page: Page, text: string) => page.getByRole('row').filter({ hasText: text })
+
+async function openList(page: Page, path: string, search: RegExp) {
+ await page.goto(path)
+ await expect(page.getByPlaceholder(search)).toBeVisible({ timeout: 15_000 })
+}
+
+test.describe('list filters', () => {
+ test('searches allowed origins', async ({ page }) => {
+ const session = await login(page)
+ const id = stamp()
+ const kept = `https://shop-${id}.example.com`
+ const other = `https://admin-${id}.example.com`
+ for (const origin of [kept, other]) {
+ await adminRequest(page, session, 'post', '/allowed_origins', { origin })
+ }
+
+ await openList(page, `/${session.store_id}/settings/allowed-origins`, /search by origin/i)
+ await searchList(page, /search by origin/i, `shop-${id}`)
+
+ await expect(row(page, kept)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, other)).toBeHidden()
+ })
+
+ test('filters payment methods by status', async ({ page }) => {
+ const session = await login(page)
+ const id = stamp()
+ const active = `E2E Active ${id}`
+ const inactive = `E2E Inactive ${id}`
+ await adminRequest(page, session, 'post', '/payment_methods', {
+ type: 'check',
+ name: active,
+ active: true,
+ })
+ await adminRequest(page, session, 'post', '/payment_methods', {
+ type: 'check',
+ name: inactive,
+ active: false,
+ })
+
+ await openList(page, `/${session.store_id}/settings/payment-methods`, /search by name/i)
+ await searchList(page, /search by name/i, id)
+ await expect(row(page, active)).toBeVisible({ timeout: 15_000 })
+
+ await addListFilter(page, /^status$/i, /^no$/i)
+
+ await expect(row(page, inactive)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, active)).toBeHidden()
+ })
+
+ test('filters sellers by status', async ({ page }) => {
+ const session = await login(page)
+ const name = `E2E Filter Seller ${stamp()}`
+ await adminRequest(page, session, 'post', '/sellers', {
+ name,
+ contact_email: `filter-seller-${Date.now()}@example.com`,
+ })
+
+ await openList(page, `/${session.store_id}/sellers`, /search sellers/i)
+ await searchList(page, /search sellers/i, name)
+ await expect(row(page, name)).toBeVisible({ timeout: 15_000 })
+
+ // A new seller has not been approved, so narrowing to approved sellers drops it.
+ await narrowQuickFilter(page, /^status/i, /^approved$/i)
+
+ await expect(row(page, name)).toBeHidden({ timeout: 15_000 })
+ })
+
+ test('filters option types by kind', async ({ page }) => {
+ const session = await login(page)
+ const id = stamp()
+ const swatch = `e2e-swatch-${id}`
+ const buttons = `e2e-buttons-${id}`
+ await adminRequest(page, session, 'post', '/option_types', {
+ name: swatch,
+ label: swatch,
+ kind: 'color_swatch',
+ })
+ await adminRequest(page, session, 'post', '/option_types', {
+ name: buttons,
+ label: buttons,
+ kind: 'buttons',
+ })
+
+ await openList(page, `/${session.store_id}/products/options`, /search by name/i)
+ await searchList(page, /search by name/i, id)
+ await expect(row(page, buttons)).toBeVisible({ timeout: 15_000 })
+
+ await narrowQuickFilter(page, /^kind/i, /^color swatch$/i)
+
+ await expect(row(page, swatch)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, buttons)).toBeHidden()
+ })
+
+ test('filters custom field definitions by type', async ({ page }) => {
+ const session = await login(page)
+ const id = stamp()
+ const number = `weight_${id}`
+ const text = `fabric_${id}`
+ for (const [key, fieldType] of [
+ [number, 'number'],
+ [text, 'short_text'],
+ ]) {
+ await adminRequest(page, session, 'post', '/custom_field_definitions', {
+ namespace: 'e2e',
+ key,
+ field_type: fieldType,
+ resource_type: 'product',
+ })
+ }
+
+ const search = /search by label, namespace, or key/i
+ await openList(page, `/${session.store_id}/settings/custom-field-definitions`, search)
+ await searchList(page, search, id)
+ await expect(row(page, text)).toBeVisible({ timeout: 15_000 })
+
+ await addListFilter(page, /^type$/i, /^number$/i)
+
+ await expect(row(page, number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, text)).toBeHidden()
+ })
+})
diff --git a/packages/dashboard/e2e/orders-list.spec.ts b/packages/dashboard/e2e/orders-list.spec.ts
new file mode 100644
index 0000000000..06ea74ec3c
--- /dev/null
+++ b/packages/dashboard/e2e/orders-list.spec.ts
@@ -0,0 +1,135 @@
+import { expect, type Page, test } from '@playwright/test'
+import {
+ addTextFilter,
+ createPlacedOrder,
+ type E2ELoginSession,
+ FIXTURE_PROMO_SKU,
+ login,
+ narrowQuickFilter,
+ searchList,
+ sortList,
+} from './helpers'
+
+const ORDERS_PATH = (storeId: string) => `/${storeId}/orders`
+const SEARCH = /search by number/i
+
+/**
+ * Two placed orders only this test owns: a shipped single item and an
+ * unshipped three-item order, billed to names that carry a shared stamp.
+ */
+async function seedOrders(page: Page, session: E2ELoginSession) {
+ const stamp = `${Date.now()}`
+ const lastName = `Listtest${stamp}`
+ const small = {
+ firstName: `Alda${stamp}`,
+ ...(await createPlacedOrder(page, session.accessToken, {
+ quantity: 1,
+ firstName: `Alda${stamp}`,
+ lastName,
+ })),
+ }
+ const large = {
+ firstName: `Bruno${stamp}`,
+ ...(await createPlacedOrder(page, session.accessToken, {
+ quantity: 3,
+ ship: false,
+ firstName: `Bruno${stamp}`,
+ lastName,
+ })),
+ }
+
+ return { lastName, small, large }
+}
+
+async function openOrders(page: Page, storeId: string) {
+ await page.goto(ORDERS_PATH(storeId))
+ await expect(page.getByRole('heading', { name: /^orders$/i })).toBeVisible({ timeout: 15_000 })
+}
+
+const row = (page: Page, number: string) => page.getByRole('row').filter({ hasText: number })
+
+test.describe('orders list', () => {
+ test('searches by order number and by billing name', async ({ page }) => {
+ const session = await login(page)
+ const { small, large } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+
+ await searchList(page, SEARCH, small.number)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, large.number)).toBeHidden()
+
+ await searchList(page, SEARCH, large.firstName)
+ await expect(row(page, large.number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, small.number)).toBeHidden()
+ })
+
+ test('filters by billing first name', async ({ page }) => {
+ const session = await login(page)
+ const { small, large } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+
+ await addTextFilter(page, /^first name$/i, /^contains$/i, small.firstName)
+
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, large.number)).toBeHidden()
+ })
+
+ test('filters by fulfillment status', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, small, large } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+ await addTextFilter(page, /^last name$/i, /^contains$/i, lastName)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+
+ await narrowQuickFilter(page, /^fulfillment/i, /^unfulfilled$/i)
+
+ await expect(row(page, large.number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, small.number)).toBeHidden()
+ })
+
+ test('filters by total', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, small, large } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+ await addTextFilter(page, /^last name$/i, /^contains$/i, lastName)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+
+ await addTextFilter(page, /^total$/i, /^greater than$/i, small.total)
+
+ await expect(row(page, large.number)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, small.number)).toBeHidden()
+ })
+
+ test('filters by SKU', async ({ page }) => {
+ const session = await login(page)
+ const { small } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+ await addTextFilter(page, /^first name$/i, /^contains$/i, small.firstName)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+
+ await addTextFilter(page, /^sku$/i, /^contains$/i, 'NO-SUCH-SKU')
+ await expect(row(page, small.number)).toBeHidden({ timeout: 15_000 })
+
+ await page
+ .getByRole('button', { name: /remove filter/i })
+ .last()
+ .click()
+ await addTextFilter(page, /^sku$/i, /^contains$/i, FIXTURE_PROMO_SKU)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+ })
+
+ test('sorts by total', async ({ page }) => {
+ const session = await login(page)
+ const { lastName, small, large } = await seedOrders(page, session)
+ await openOrders(page, session.store_id)
+ await addTextFilter(page, /^last name$/i, /^contains$/i, lastName)
+ await expect(row(page, small.number)).toBeVisible({ timeout: 15_000 })
+
+ const firstRow = page.getByRole('row').nth(1)
+ await sortList(page, /^total$/i, 'descending')
+ await expect(firstRow).toContainText(large.number, { timeout: 15_000 })
+
+ await sortList(page, /^total$/i, 'ascending')
+ await expect(firstRow).toContainText(small.number, { timeout: 15_000 })
+ })
+})
diff --git a/packages/dashboard/e2e/products-list.spec.ts b/packages/dashboard/e2e/products-list.spec.ts
new file mode 100644
index 0000000000..e3e2ae7b60
--- /dev/null
+++ b/packages/dashboard/e2e/products-list.spec.ts
@@ -0,0 +1,128 @@
+import { expect, type Page, test } from '@playwright/test'
+import {
+ addRecordFilter,
+ addTextFilter,
+ adminRequest,
+ type E2ELoginSession,
+ FIXTURE_PROMO_TAXON,
+ gotoIndex,
+ login,
+ narrowQuickFilter,
+ searchList,
+ sortList,
+} from './helpers'
+
+const PRODUCTS_PATH = (storeId: string) => `/${storeId}/products`
+const CTA = /add product/i
+const SEARCH = /^search…$/i
+
+/**
+ * Three products only this test owns, told apart from the rest of the
+ * catalog by a shared stamp in their names.
+ */
+async function seedProducts(page: Page, session: E2ELoginSession) {
+ const stamp = `${Date.now()}`
+ const categories = await adminRequest<{ data: { id: string }[] }>(
+ page,
+ session,
+ 'get',
+ `/categories?q[name_eq]=${encodeURIComponent(FIXTURE_PROMO_TAXON)}`,
+ )
+ const create = (name: string, status: string, amount: number, extra: object = {}) =>
+ adminRequest<{ id: string; default_variant_id: string }>(page, session, 'post', '/products', {
+ name,
+ status,
+ prices: [{ amount, currency: 'USD' }],
+ ...extra,
+ })
+
+ const cheap = { name: `E2E List Cheap ${stamp}`, sku: `E2E-LIST-${stamp}` }
+ const pricey = { name: `E2E List Pricey ${stamp}` }
+ const draft = { name: `E2E List Draft ${stamp}` }
+
+ const created = await create(cheap.name, 'active', 5, { category_ids: [categories.data[0].id] })
+ await adminRequest(
+ page,
+ session,
+ 'patch',
+ `/products/${created.id}/variants/${created.default_variant_id}`,
+ { sku: cheap.sku },
+ )
+ await create(pricey.name, 'active', 500)
+ await create(draft.name, 'draft', 50)
+
+ return { stamp, cheap, pricey, draft }
+}
+
+const row = (page: Page, name: string) => page.getByRole('row').filter({ hasText: name })
+
+test.describe('products list', () => {
+ test('searches by name and by SKU', async ({ page }) => {
+ const session = await login(page)
+ const { stamp, cheap, pricey, draft } = await seedProducts(page, session)
+ await gotoIndex(page, PRODUCTS_PATH(session.store_id), CTA)
+
+ await searchList(page, SEARCH, stamp)
+ for (const product of [cheap, pricey, draft]) {
+ await expect(row(page, product.name)).toBeVisible({ timeout: 15_000 })
+ }
+
+ await searchList(page, SEARCH, cheap.sku)
+ await expect(row(page, cheap.name)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, pricey.name)).toBeHidden()
+ })
+
+ test('filters by status', async ({ page }) => {
+ const session = await login(page)
+ const { stamp, cheap, draft } = await seedProducts(page, session)
+ await gotoIndex(page, PRODUCTS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, stamp)
+ await expect(row(page, cheap.name)).toBeVisible({ timeout: 15_000 })
+
+ await narrowQuickFilter(page, /^status/i, /^draft$/i)
+
+ await expect(row(page, draft.name)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, cheap.name)).toBeHidden()
+ })
+
+ test('filters by price', async ({ page }) => {
+ const session = await login(page)
+ const { stamp, cheap, pricey } = await seedProducts(page, session)
+ await gotoIndex(page, PRODUCTS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, stamp)
+ await expect(row(page, cheap.name)).toBeVisible({ timeout: 15_000 })
+
+ await addTextFilter(page, /^price$/i, /^greater than$/i, '100')
+
+ await expect(row(page, pricey.name)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, cheap.name)).toBeHidden()
+ })
+
+ test('filters by category', async ({ page }) => {
+ const session = await login(page)
+ const { stamp, cheap, pricey } = await seedProducts(page, session)
+ await gotoIndex(page, PRODUCTS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, stamp)
+ await expect(row(page, pricey.name)).toBeVisible({ timeout: 15_000 })
+
+ await addRecordFilter(page, /^categories$/i, FIXTURE_PROMO_TAXON)
+
+ await expect(row(page, cheap.name)).toBeVisible({ timeout: 15_000 })
+ await expect(row(page, pricey.name)).toBeHidden()
+ })
+
+ test('sorts by price', async ({ page }) => {
+ const session = await login(page)
+ const { stamp, cheap, pricey } = await seedProducts(page, session)
+ await gotoIndex(page, PRODUCTS_PATH(session.store_id), CTA)
+ await searchList(page, SEARCH, stamp)
+ await expect(row(page, cheap.name)).toBeVisible({ timeout: 15_000 })
+
+ const firstRow = page.getByRole('row').nth(1)
+ await sortList(page, /^price$/i, 'descending')
+ await expect(firstRow).toContainText(pricey.name, { timeout: 15_000 })
+
+ await sortList(page, /^price$/i, 'ascending')
+ await expect(firstRow).toContainText(cheap.name, { timeout: 15_000 })
+ })
+})