2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-27 01:00:53 +00:00

Batch code fix (#9123)

* Fix batch code assignment when receiving items

* Add playwright tests

* Harden playwright tests

* Refactoring
This commit is contained in:
Oliver
2025-02-22 08:34:45 +11:00
committed by GitHub
parent 2521862b1a
commit 1f84f24514
4 changed files with 129 additions and 63 deletions

View File

@ -2,6 +2,7 @@ import { test } from '../baseFixtures.ts';
import {
clearTableFilters,
clickButtonIfVisible,
clickOnRowMenu,
navigate,
openFilterDrawer,
setTableChoiceFilter
@ -257,7 +258,6 @@ test('Purchase Orders - Receive Items', async ({ page }) => {
await page.getByRole('cell', { name: 'PO0014' }).click();
await page.getByRole('tab', { name: 'Order Details' }).click();
await page.getByText('0 / 3').waitFor();
// Select all line items to receive
await page.getByRole('tab', { name: 'Line Items' }).click();
@ -278,4 +278,42 @@ test('Purchase Orders - Receive Items', async ({ page }) => {
await page.getByText('Mechanical Lab').waitFor();
await page.getByRole('button', { name: 'Cancel' }).click();
// Let's actually receive an item (with custom values)
await navigate(page, 'purchasing/purchase-order/2/line-items');
const cell = await page.getByText('Red Paint', { exact: true });
await clickOnRowMenu(cell);
await page.getByRole('menuitem', { name: 'Receive line item' }).click();
// Select destination location
await page.getByLabel('related-field-location').click();
await page.getByRole('option', { name: 'Factory', exact: true }).click();
// Receive only a *single* item
await page.getByLabel('number-field-quantity').fill('1');
// Assign custom information
await page.getByLabel('action-button-assign-batch-').click();
await page.getByLabel('action-button-adjust-packaging').click();
await page.getByLabel('action-button-change-status').click();
await page.getByLabel('action-button-add-note').click();
await page.getByLabel('text-field-batch_code').fill('my-batch-code');
await page.getByLabel('text-field-packaging').fill('bucket');
await page.getByLabel('text-field-note').fill('The quick brown fox');
await page.getByLabel('choice-field-status').click();
await page.getByRole('option', { name: 'Destroyed' }).click();
// Short timeout to allow for debouncing
await page.waitForTimeout(200);
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Items received').waitFor();
await page.getByRole('tab', { name: 'Received Stock' }).click();
await clearTableFilters(page);
await page.getByRole('cell', { name: 'my-batch-code' }).first().waitFor();
await page.getByRole('cell', { name: 'bucket' }).first().waitFor();
});