From a6bba144e72ebbcf25f4f3f66070a00b647b6efb Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 23 Oct 2024 14:33:42 +1100 Subject: [PATCH] Part pricing cleanup (#8340) * Part pricing cleanup - Improve / tweak rendering for PurchaseHistoryPanel * Adjust playwright tests --- .../src/pages/part/pricing/PurchaseHistoryPanel.tsx | 10 +++++++--- src/frontend/tests/pages/pui_stock.spec.ts | 3 +++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx b/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx index 99245bbc99..02c4ff05ae 100644 --- a/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx +++ b/src/frontend/src/pages/part/pricing/PurchaseHistoryPanel.tsx @@ -52,12 +52,15 @@ export default function PurchaseHistoryPanel({ currency: record.purchase_price_currency }); - let units = record.supplier_part_detail?.pack_quantity; + let packQuatity = record.supplier_part_detail?.pack_quantity; + let hasPackQuantity = + !!packQuatity && + record.supplier_part_detail?.pack_quantity_native != 1; return ( {price} - {units && [{units}]} + {hasPackQuantity && [{packQuatity}]} ); } @@ -74,11 +77,12 @@ export default function PurchaseHistoryPanel({ }); let units = record.part_detail?.units; + let hasUnits = !!units && units !== 1; return ( {price} - {units && [{units}]} + {hasUnits && [{units}]} ); } diff --git a/src/frontend/tests/pages/pui_stock.spec.ts b/src/frontend/tests/pages/pui_stock.spec.ts index 20290fb815..69ce860679 100644 --- a/src/frontend/tests/pages/pui_stock.spec.ts +++ b/src/frontend/tests/pages/pui_stock.spec.ts @@ -94,7 +94,10 @@ test('Stock - Serial Numbers', async ({ page }) => { // Now, with correct quantity await page.getByLabel('number-field-quantity').fill('51'); + await page.waitForTimeout(250); await page.getByRole('button', { name: 'Submit' }).click(); + await page.waitForTimeout(250); + await page .getByText( /The following serial numbers already exist or are invalid : 200,201,202,203,204/