2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-07 12:22:11 +00:00

Fix glitch in <RelatedModelField /> (#10113)

* Fix glitch in <RelatedModelField />

- Prevent search reset until debounced value changes
-

* Robustify playwright tests

* Further playwright tweaks

* Further playwright tweaks
This commit is contained in:
Oliver
2025-08-03 12:31:02 +10:00
committed by GitHub
parent bc382cd883
commit bdc8525aec
3 changed files with 32 additions and 11 deletions

View File

@@ -365,7 +365,6 @@ export function RelatedModelField({
filterOption={null} filterOption={null}
onInputChange={(value: any) => { onInputChange={(value: any) => {
setValue(value); setValue(value);
resetSearch();
}} }}
onChange={onChange} onChange={onChange}
onMenuScrollToBottom={() => setOffset(offset + limit)} onMenuScrollToBottom={() => setOffset(offset + limit)}

View File

@@ -331,6 +331,22 @@ test('Build Order - Tracked Outputs', async ({ browser }) => {
url: 'manufacturing/build-order/10/incomplete-outputs' url: 'manufacturing/build-order/10/incomplete-outputs'
}); });
const cancelBuildOutput = async (cell) => {
await clickOnRowMenu(cell);
await page.getByRole('menuitem', { name: 'Cancel' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Build outputs have been cancelled').waitFor();
};
// Ensure table has loaded
await page.getByRole('cell', { name: '# 13' }).waitFor();
// Check if the build output "#15" exists. If so, remove it.
const existingCell = await page.getByRole('cell', { name: '# 15' });
if (await existingCell.isVisible()) {
await cancelBuildOutput(existingCell);
}
// Create a new build output, serial number 15 // Create a new build output, serial number 15
await page await page
.getByRole('button', { name: 'action-button-add-build-output' }) .getByRole('button', { name: 'action-button-add-build-output' })
@@ -362,9 +378,12 @@ test('Build Order - Tracked Outputs', async ({ browser }) => {
.waitFor(); .waitFor();
// The stock item should be pre-filled based on serial number // The stock item should be pre-filled based on serial number
await page.getByRole('cell', { name: 'Thumbnail 002.01-PCBA |' }).waitFor();
await page.getByRole('button', { name: 'Submit' }).isEnabled(); await page.getByRole('button', { name: 'Submit' }).isEnabled();
await page.getByRole('button', { name: 'Submit' }).click(); await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Stock items allocated').waitFor();
await allocationRow.getByText('1 / 1').waitFor(); await allocationRow.getByText('1 / 1').waitFor();
// Close the allocation wizard // Close the allocation wizard
@@ -375,12 +394,15 @@ test('Build Order - Tracked Outputs', async ({ browser }) => {
await row.getByText('0 / 2').waitFor(); await row.getByText('0 / 2').waitFor();
// Cancel the build output to return to the original state // Cancel the build output to return to the original state
await clickOnRowMenu(cell); await cancelBuildOutput(cell);
await page.getByRole('menuitem', { name: 'Cancel' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Build outputs have been cancelled').waitFor();
// Next, complete a new output and auto-allocate items based on serial number // Next, complete a new output and auto-allocate items based on serial number
// Cancel build output "#16" if it exists
const existingCell16 = await page.getByRole('cell', { name: '# 16' });
if (await existingCell16.isVisible()) {
await cancelBuildOutput(existingCell16);
}
await page await page
.getByRole('button', { name: 'action-button-add-build-output' }) .getByRole('button', { name: 'action-button-add-build-output' })
.click(); .click();
@@ -401,10 +423,7 @@ test('Build Order - Tracked Outputs', async ({ browser }) => {
await newRow.getByText('0 / 2').waitFor(); await newRow.getByText('0 / 2').waitFor();
// Cancel this output too // Cancel this output too
await clickOnRowMenu(newCell); await cancelBuildOutput(newCell);
await page.getByRole('menuitem', { name: 'Cancel' }).click();
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByText('Build outputs have been cancelled').waitFor();
}); });
test('Build Order - Filters', async ({ browser }) => { test('Build Order - Filters', async ({ browser }) => {

View File

@@ -199,12 +199,15 @@ test('Parts - Details', async ({ browser }) => {
await page.getByText('Can Build').waitFor(); await page.getByText('Can Build').waitFor();
await page.getByText('0 / 10').waitFor(); await page.getByText('0 / 10').waitFor();
await page.getByText('4 / 49').waitFor();
// Depending on the state of other tests, the "In Production" value may vary
// This could be either 4 / 49, or 5 / 49
await page.getByText(/[4|5] \/ 49/).waitFor();
// Badges // Badges
await page.getByText('Required: 10').waitFor(); await page.getByText('Required: 10').waitFor();
await page.getByText('No Stock').waitFor(); await page.getByText('No Stock').waitFor();
await page.getByText('In Production: 4').waitFor(); await page.getByText(/In Production: [4|5]/).waitFor();
await page.getByText('Creation Date').waitFor(); await page.getByText('Creation Date').waitFor();
await page.getByText('2022-04-29').waitFor(); await page.getByText('2022-04-29').waitFor();