From 5e263945007b8b62c3eaec0d62a27a5fd15f093f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Apr 2025 09:04:15 +1100 Subject: [PATCH] Serialize stock fix (#9441) (#9443) * Fix bug which hid the "serialize stock" button * Add playwright tests * Adjust check (cherry picked from commit a18b18a3fd845593ce0a9dcd2a001b8c9c272dc3) Co-authored-by: Oliver --- src/frontend/src/pages/stock/StockDetail.tsx | 3 +-- src/frontend/tests/pages/pui_stock.spec.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/pages/stock/StockDetail.tsx b/src/frontend/src/pages/stock/StockDetail.tsx index c61302d9c1..5087743b96 100644 --- a/src/frontend/src/pages/stock/StockDetail.tsx +++ b/src/frontend/src/pages/stock/StockDetail.tsx @@ -743,10 +743,9 @@ export default function StockDetail() { name: t`Serialize`, tooltip: t`Serialize stock`, hidden: - !canTransfer || isBuilding || serialized || - stockitem?.quantity != 1 || + stockitem?.quantity < 1 || stockitem?.part_detail?.trackable != true, icon: , onClick: () => { diff --git a/src/frontend/tests/pages/pui_stock.spec.ts b/src/frontend/tests/pages/pui_stock.spec.ts index 33c5f551f9..f82a9b9c8f 100644 --- a/src/frontend/tests/pages/pui_stock.spec.ts +++ b/src/frontend/tests/pages/pui_stock.spec.ts @@ -152,6 +152,22 @@ test('Stock - Serial Numbers', async ({ page }) => { await page.getByRole('button', { name: 'Cancel' }).click(); }); +test('Stock - Serialize', async ({ browser }) => { + const page = await doCachedLogin(browser, { url: 'stock/item/232/details' }); + + // Fill out with faulty serial numbers to check buttons and forms + await page.getByLabel('action-menu-stock-operations').click(); + await page.getByLabel('action-menu-stock-operations-serialize').click(); + + await page.getByLabel('text-field-serial_numbers').fill('200-250'); + + await page.getByRole('button', { name: 'Submit' }).click(); + await page + .getByText('Group range 200-250 exceeds allowed quantity') + .waitFor(); + await page.getByRole('button', { name: 'Cancel' }).click(); +}); + /** * Test various 'actions' on the stock detail page */