2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 12:35:46 +00:00

[PUI] Fix Build Output Forms (#8184)

* Enhancements for stock item form

* Edit stock item from "build output" table

* Rearrange menu items

* Fix build order line complete action

* Fix for other modals

* Cleanup dead code

* Reload build details after output state change

* Logic fix for plugin table

* Bump API version

* Adds hook for generating placeholder serial numbers

* Add playwright tests

* Remove unused imports

* Cleanup playwright tests
This commit is contained in:
Oliver
2024-09-27 00:35:30 +10:00
committed by GitHub
parent 194640f55a
commit 4f06918c36
29 changed files with 354 additions and 228 deletions

View File

@ -81,3 +81,79 @@ test('PUI - Pages - Build Order', async ({ page }) => {
.getByText('Making a high level assembly')
.waitFor();
});
test('PUI - Pages - Build Order - Build Outputs', async ({ page }) => {
await doQuickLogin(page);
await page.goto(`${baseUrl}/part/`);
// Navigate to the correct build order
await page.getByRole('tab', { name: 'Build', exact: true }).click();
// We have now loaded the "Build Order" table. Check for some expected texts
await page.getByText('On Hold').first().waitFor();
await page.getByText('Pending').first().waitFor();
await page.getByRole('cell', { name: 'BO0011' }).click();
await page.getByRole('tab', { name: 'Incomplete Outputs' }).click();
// Create a new build output
await page.getByLabel('action-button-add-build-output').click();
await page.getByLabel('number-field-quantity').fill('5');
const placeholder = await page
.getByLabel('text-field-serial_numbers')
.getAttribute('placeholder');
let sn = 1;
if (!!placeholder && placeholder.includes('Next serial number')) {
sn = parseInt(placeholder.split(':')[1].trim());
}
// Generate some new serial numbers
await page.getByLabel('text-field-serial_numbers').fill(`${sn}, ${sn + 1}`);
await page.getByLabel('text-field-batch_code').fill('BATCH12345');
await page.getByLabel('related-field-location').click();
await page.getByText('Reel Storage').click();
await page.getByRole('button', { name: 'Submit' }).click();
// Should be an error as the number of serial numbers doesn't match the quantity
await page.getByText('Errors exist for one or more').waitFor();
await page.getByText('Number of unique serial').waitFor();
// Fix the quantity
await page.getByLabel('number-field-quantity').fill('2');
await page.waitForTimeout(250);
await page.getByRole('button', { name: 'Submit' }).click();
// Check that new serial numbers have been created
await page
.getByRole('cell', { name: `# ${sn}` })
.first()
.waitFor();
await page
.getByRole('cell', { name: `# ${sn + 1}` })
.first()
.waitFor();
// Cancel one of the newly created outputs
const cell = await page.getByRole('cell', { name: `# ${sn}` });
const row = await cell.locator('xpath=ancestor::tr').first();
await row.getByLabel(/row-action-menu-/i).click();
await page.getByRole('menuitem', { name: 'Cancel' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Build outputs have been cancelled').waitFor();
// Complete the other output
const cell2 = await page.getByRole('cell', { name: `# ${sn + 1}` });
const row2 = await cell2.locator('xpath=ancestor::tr').first();
await row2.getByLabel(/row-action-menu-/i).click();
await page.getByRole('menuitem', { name: 'Complete' }).click();
await page.getByLabel('related-field-location').click();
await page.getByText('Mechanical Lab').click();
await page.waitForTimeout(250);
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Build outputs have been completed').waitFor();
});