Merge pull request #104 from beatz174-bit/codex/add-playwright-test-for-category-filter

Add Playwright test for product category filtering
This commit is contained in:
beatz174-bit
2025-11-24 08:23:59 +10:00
committed by GitHub
+19
View File
@@ -0,0 +1,19 @@
import { expect, test } from '@playwright/test';
test.describe('Product category filters', () => {
test('shows only products from the selected category', async ({ page }) => {
await page.goto('/');
await page.getByRole('link', { name: 'Manage Products' }).click();
const categoryFilter = page.getByLabel('Filter by category');
await expect(categoryFilter).toBeVisible();
await categoryFilter.click();
await page.getByRole('option', { name: 'Chips' }).click();
await expect(page.getByRole('button', { name: 'Edit Smiths Salt n Vinegar 90g' }).first()).toBeVisible();
await expect(page.getByRole('button', { name: 'Edit Pump 750' })).toHaveCount(0);
await expect(page.getByRole('button', { name: 'Edit Mars Bar' })).toHaveCount(0);
});
});