Skip to content

Commit 3065167

Browse files
Adjust playwright test
1 parent 2c45965 commit 3065167

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/frontend/tests/pages/pui_purchase_order.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,22 @@ test('Purchase Orders - Receive Items', async ({ browser }) => {
442442
await navigate(page, 'purchasing/purchase-order/2/line-items');
443443

444444
const cell = await page.getByText('Red Paint', { exact: true });
445+
446+
// First, ensure that the row has sufficient quantity to receive
447+
// This is required to ensure the robustness of this test,
448+
// as the test data may be modified by other tests
449+
await clickOnRowMenu(cell);
450+
await page.getByRole('menuitem', { name: 'Edit' }).click();
451+
const quantityInput = await page.getByRole('textbox', {
452+
name: 'number-field-quantity'
453+
});
454+
const quantity = Number.parseInt(await quantityInput.inputValue());
455+
await quantityInput.fill((quantity + 100).toString());
456+
457+
await page.getByRole('button', { name: 'Submit' }).click();
458+
await page.getByText('Item Updated').waitFor();
459+
460+
// Now, receive the items
445461
await clickOnRowMenu(cell);
446462
await page.getByRole('menuitem', { name: 'Receive line item' }).click();
447463

@@ -451,6 +467,7 @@ test('Purchase Orders - Receive Items', async ({ browser }) => {
451467

452468
// Receive only a *single* item
453469
await page.getByLabel('number-field-quantity').fill('1');
470+
await page.waitForTimeout(500);
454471

455472
// Assign custom information
456473
await page.getByLabel('action-button-assign-batch-').click();
@@ -477,6 +494,9 @@ test('Purchase Orders - Receive Items', async ({ browser }) => {
477494
await loadTab(page, 'Received Stock');
478495
await clearTableFilters(page);
479496

497+
await page
498+
.getByRole('textbox', { name: 'table-search-input' })
499+
.fill('my-batch-code');
480500
await page.getByRole('cell', { name: 'my-batch-code' }).first().waitFor();
481501
});
482502

0 commit comments

Comments
 (0)