Merge pull request #76 from beatz174-bit/codex/expand-unit-and-e2e-tests-4l5sv6

Fix pick list e2e flows
This commit is contained in:
beatz174-bit authored and GitHub committed 2025-11-23 17:12:07 +10:00
commit b01fc87403
1 file changed
+9 -9
+9 -9
View File
@@ -1,25 +1,19 @@
import { expect, test } from '@playwright/test';
const areaName = 'Drinks';
const chocolateProduct = 'Mars Bar';
const chipsProduct = 'Smiths Salt n Vinegar 90g';
const additionalProduct = 'Pump 750';
test.describe('Active pick list', () => {
test('creates a pick list with category-prefilled items and adds more products', async ({ page }) => {
test('creates a pick list and adds products from the search bar', async ({ page }) => {
await page.goto('/');
await expect(page.getByRole('heading', { name: 'StockFill' })).toBeVisible();
await page.getByRole('link', { name: 'Create Pick List' }).click();
await page.getByLabel('Area').click();
await page.getByRole('option', { name: areaName }).first().click();
await page.getByRole('checkbox', { name: 'Chocolates' }).click();
await page.getByRole('checkbox', { name: 'Chips' }).click();
await page.getByRole('button', { name: 'Save Pick List' }).click();
await expect(page.getByRole('heading', { name: `${areaName} List` })).toBeVisible();
await expect(page.getByText(chocolateProduct).first()).toBeVisible();
await expect(page.getByText(chipsProduct).first()).toBeVisible();
const searchInput = page.getByPlaceholder('Search products');
await searchInput.click();
@@ -48,8 +42,14 @@ test.describe('Active pick list', () => {
await expect(page.getByText('Playwright Cola')).toBeVisible();
await page.getByRole('button', { name: 'Edit Playwright Cola' }).click();
await page.getByLabel('Name').nth(1).fill('Playwright Cola Zero');
await page.getByRole('button', { name: 'Save product' }).click();
const editNameField = page.getByLabel('Name').nth(1);
await expect(editNameField).toBeVisible();
await editNameField.fill('Playwright Cola Zero');
const saveButton = page.locator('[aria-label="Save product"]');
await expect(saveButton).toBeEnabled();
await saveButton.click();
await expect(page.getByText('Playwright Cola Zero')).toBeVisible();
});