Merge pull request #93 from beatz174-bit/codex/add-e2e-scenario-for-pick-complete-action
Add pick completion e2e scenario
This commit is contained in:
@@ -86,6 +86,9 @@ test.describe('Active pick list', () => {
|
||||
await expect(page.getByText('Playwright Cola Zero')).toBeVisible();
|
||||
});
|
||||
|
||||
test('marks every item as picked when completing the pick list', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
test('toggles packaging type and persists the selection', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
|
||||
@@ -101,6 +104,36 @@ test.describe('Active pick list', () => {
|
||||
await page.getByRole('option', { name: areaName }).first().click();
|
||||
await page.getByRole('button', { name: 'Save Pick List' }).click();
|
||||
|
||||
const productsToAdd = ['Pump 750', 'Nutrient Water Focus', 'Mount Franklin 600ml'];
|
||||
const searchInput = page.getByPlaceholder('Search products');
|
||||
|
||||
for (const productName of productsToAdd) {
|
||||
await searchInput.click();
|
||||
await searchInput.fill(productName);
|
||||
await page
|
||||
.getByRole('option', { name: new RegExp(`${productName} \\(${areaName}\\)`, 'i') })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(page.getByText(productName).first()).toBeVisible();
|
||||
}
|
||||
|
||||
const pickStatusToggles = page.getByLabel('Toggle picked status');
|
||||
await expect(pickStatusToggles).toHaveCount(productsToAdd.length);
|
||||
|
||||
for (let index = 0; index < productsToAdd.length; index += 1) {
|
||||
await expect(pickStatusToggles.nth(index)).not.toBeChecked();
|
||||
}
|
||||
|
||||
await page.getByRole('button', { name: 'Pick Complete' }).click();
|
||||
|
||||
for (let index = 0; index < productsToAdd.length; index += 1) {
|
||||
await expect(pickStatusToggles.nth(index)).toBeChecked();
|
||||
}
|
||||
|
||||
const showPickedToggle = page.getByRole('checkbox', { name: 'Show picked' });
|
||||
await expect(showPickedToggle).toBeChecked();
|
||||
await expect(showPickedToggle).toBeDisabled();
|
||||
await expect(page.getByRole('heading', { name: `${areaName} List` })).toBeVisible();
|
||||
|
||||
const searchInput = page.getByPlaceholder('Search products');
|
||||
|
||||
Reference in New Issue
Block a user