Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBPIH-6915: Add removing stock movement in fieldValidation test #31

Merged
merged 6 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/pages/inbound/create/steps/SendStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class SendStep extends BasePageModel {
return this.page.getByRole('button', { name: 'Save and Exit' });
}

get acceptConfirmExitDialog() {
return this.page.getByRole('button', { name: 'Yes' });
}

async isLoaded() {
await expect(this.originField.textbox).toBeVisible();
await expect(this.destinationSelect.selectField).toBeVisible();
Expand Down
5 changes: 5 additions & 0 deletions src/pages/stockMovementShow/StockMovementShowPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class StockMovementShowPage extends BasePageModel {
get errorMessage() {
return this.page.locator('div.error');
}

async clickDeleteShipment() {
this.page.once('dialog', (dialog) => dialog.accept());
await this.deleteButton.click();
}
}

export default StockMovementShowPage;
10 changes: 10 additions & 0 deletions src/tests/inbound/createInbound/fieldValidation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ test.afterEach(async ({ stockMovementService }) => {

test('Create Inbound stock movement field validations', async ({
createInboundPage,
stockMovementShowPage,
}) => {
await test.step('Go to create inbound page', async () => {
await createInboundPage.goToPage();
Expand Down Expand Up @@ -227,4 +228,13 @@ test('Create Inbound stock movement field validations', async ({
'Please verify timeline. Delivery date cannot be before Ship date.'
);
});

await test.step('Save and exit and delete shipment', async () => {
await createInboundPage.sendStep.saveAndExitButton.click();
await createInboundPage.sendStep.validationPopup.assertPopupVisible();
await createInboundPage.sendStep.acceptConfirmExitDialog.click();
await stockMovementShowPage.waitForUrl();
await stockMovementShowPage.isLoaded();
await stockMovementShowPage.clickDeleteShipment();
});
});
2 changes: 1 addition & 1 deletion src/tests/inbound/listPage/updatedByFilter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test.describe('Use "Updated By" filter', () => {
await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id);
});

test.skip('Only show stock movements updated by filtered user', async ({
test('Only show stock movements updated by filtered user', async ({
altUserContext,
inboundListPage,
mainProductService,
Expand Down
5 changes: 5 additions & 0 deletions src/tests/receiving/validationsOnEditAndReceive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ test.describe('Validations on edit and receive inbound stock movement', () => {
'Cannot edit received shipment'
);
});

await test.step('Rollback shipment received in 2 receipts', async () => {
await stockMovementShowPage.isLoaded();
await stockMovementShowPage.rollbackLastReceiptButton.click();
});
});

test('Assert unable to receive already received inbounds', async ({
Expand Down
Loading