-
-
Notifications
You must be signed in to change notification settings - Fork 0
OBPIH-7532: Add test to change locations on putaway pages #68
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,6 +60,12 @@ class PutawayListPage extends BasePageModel { | |
| get clearFilteringButton() { | ||
| return this.filters.getByTestId('cancel-button'); | ||
| } | ||
|
|
||
| get emptyPutawayList() { | ||
| return this.page | ||
| .locator('.empty fade center') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't there a better selector than those coming from Bootstrap? |
||
| .getByText('No orders match the given criteria'); | ||
| } | ||
| } | ||
|
|
||
| export default PutawayListPage; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,17 @@ class PutawayListTable extends BasePageModel { | |
| .locator('.action-menu-item') | ||
| .getByRole('link', { name: 'View order details' }); | ||
| } | ||
|
|
||
| get deleteOrderButton() { | ||
| return this.page | ||
| .locator('.action-menu-item') | ||
| .getByRole('link', { name: 'Delete Order' }); | ||
| } | ||
|
|
||
| async clickDeleteOrderButton() { | ||
| this.page.once('dialog', (dialog) => dialog.accept()); | ||
| await this.deleteOrderButton.click(); | ||
| } | ||
| } | ||
|
|
||
| class Row extends BasePageModel { | ||
|
|
@@ -37,5 +48,9 @@ class Row extends BasePageModel { | |
| get statusTag() { | ||
| return this.row.getByTestId('status-0'); | ||
| } | ||
|
|
||
| get orderNumber() { | ||
| return this.row.getByTestId('order-number-0'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the -0 working? The idea of that was that the number at the end is the row number |
||
| } | ||
| } | ||
| export default PutawayListTable; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| import AppConfig from '@/config/AppConfig'; | ||
| import { ShipmentType } from '@/constants/ShipmentType'; | ||
| import { expect, test } from '@/fixtures/fixtures'; | ||
| import { StockMovementResponse } from '@/types'; | ||
| import { getShipmentId, getShipmentItemId } from '@/utils/shipmentUtils'; | ||
|
|
||
| test.describe('Change location on putaway create page and list pages', () => { | ||
| let STOCK_MOVEMENT: StockMovementResponse; | ||
|
|
||
| test.beforeEach( | ||
| async ({ | ||
| supplierLocationService, | ||
| stockMovementService, | ||
| fifthProductService, | ||
| receivingService, | ||
| }) => { | ||
| const supplierLocation = await supplierLocationService.getLocation(); | ||
| STOCK_MOVEMENT = await stockMovementService.createInbound({ | ||
| originId: supplierLocation.id, | ||
| }); | ||
|
|
||
| const product = await fifthProductService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT.id, | ||
| [{ productId: product.id, quantity: 10 }] | ||
| ); | ||
|
|
||
| await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, { | ||
| shipmentType: ShipmentType.AIR, | ||
| }); | ||
|
|
||
| const { data: stockMovement } = | ||
| await stockMovementService.getStockMovement(STOCK_MOVEMENT.id); | ||
| const shipmentId = getShipmentId(stockMovement); | ||
| const { data: receipt } = await receivingService.getReceipt(shipmentId); | ||
| const receivingBin = | ||
| AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; | ||
|
|
||
| await receivingService.createReceivingBin(shipmentId, receipt); | ||
|
|
||
| await receivingService.updateReceivingItems(shipmentId, [ | ||
| { | ||
| shipmentItemId: getShipmentItemId(receipt, 0, 0), | ||
| quantityReceiving: 10, | ||
| binLocationName: receivingBin, | ||
| }, | ||
| ]); | ||
| await receivingService.completeReceipt(shipmentId); | ||
| } | ||
| ); | ||
|
|
||
| test.afterEach( | ||
| async ({ | ||
| stockMovementShowPage, | ||
| stockMovementService, | ||
| putawayListPage, | ||
| oldViewShipmentPage, | ||
| }) => { | ||
| await putawayListPage.goToPage(); | ||
| await putawayListPage.table.row(1).actionsButton.click(); | ||
| await putawayListPage.table.clickDeleteOrderButton(); | ||
| await putawayListPage.emptyPutawayList.isVisible(); | ||
|
|
||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.detailsListTable.oldViewShipmentPage.click(); | ||
| await oldViewShipmentPage.undoStatusChangeButton.click(); | ||
| await stockMovementShowPage.isLoaded(); | ||
| await stockMovementShowPage.rollbackButton.click(); | ||
|
|
||
| await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id); | ||
| } | ||
| ); | ||
|
|
||
| test('Change location on putaway create page and list page', async ({ | ||
| stockMovementShowPage, | ||
| navbar, | ||
| createPutawayPage, | ||
| locationChooser, | ||
| fifthProductService, | ||
| depotLocationService, | ||
| mainLocationService, | ||
| putawayListPage, | ||
| authService, | ||
| }) => { | ||
| const receivingBin = | ||
| AppConfig.instance.receivingBinPrefix + STOCK_MOVEMENT.identifier; | ||
| const product = await fifthProductService.getProduct(); | ||
| const mainLocation = await mainLocationService.getLocation(); | ||
| const depotLocation = await depotLocationService.getLocation(); | ||
|
|
||
| await test.step('Go to stock movement show page and assert received status', async () => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.isLoaded(); | ||
| await expect(stockMovementShowPage.statusTag).toHaveText('Received'); | ||
| await navbar.profileButton.click(); | ||
| await navbar.refreshCachesButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Go to create putaway page and assert its content', async () => { | ||
| await createPutawayPage.goToPage(); | ||
| await createPutawayPage.isLoaded(); | ||
| await expect(createPutawayPage.table.row(0).receivingBin).toContainText( | ||
| receivingBin | ||
| ); | ||
| await createPutawayPage.table | ||
| .row(0) | ||
| .getExpandBinLocation(receivingBin) | ||
| .click(); | ||
| await expect( | ||
| createPutawayPage.table.row(1).getProductName(product.name) | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| await test.step('Change location to another depot', async () => { | ||
| await navbar.locationChooserButton.click(); | ||
| await locationChooser | ||
| .getOrganization(depotLocation.organization?.name as string) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it cast to a string? I think here we should be sure that the name is not null, so the type casting shouldn't be required |
||
| .click(); | ||
| await locationChooser.getLocation(depotLocation.name).click(); | ||
| await navbar.profileButton.click(); | ||
| await navbar.refreshCachesButton.click(); | ||
| await createPutawayPage.goToPage(); | ||
| await expect(createPutawayPage.emptyCreatePageInformation).toBeVisible(); | ||
| await expect( | ||
| createPutawayPage.table.row(0).getExpandBinLocation(receivingBin) | ||
| ).toBeHidden(); | ||
| }); | ||
|
|
||
| await test.step('Return to main location and create pending putaway', async () => { | ||
| await navbar.locationChooserButton.click(); | ||
| await locationChooser | ||
| .getOrganization(mainLocation.organization?.name as string) | ||
| .click(); | ||
| await locationChooser.getLocation(mainLocation.name).click(); | ||
| await navbar.profileButton.click(); | ||
| await navbar.refreshCachesButton.click(); | ||
| await createPutawayPage.goToPage(); | ||
| await createPutawayPage.table | ||
| .row(0) | ||
| .getExpandBinLocation(receivingBin) | ||
| .click(); | ||
| await createPutawayPage.table.row(1).checkbox.click(); | ||
| await createPutawayPage.startPutawayButton.click(); | ||
| await createPutawayPage.startStep.isLoaded(); | ||
| await createPutawayPage.startStep.saveButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Go to list page and assert putaway is created', async () => { | ||
| await putawayListPage.goToPage(); | ||
| await putawayListPage.isLoaded(); | ||
| await expect(putawayListPage.table.row(1).statusTag).toHaveText( | ||
| 'Pending' | ||
| ); | ||
| }); | ||
|
|
||
| const putawayOrderIdentifier = await putawayListPage.table | ||
| .row(1) | ||
| .orderNumber.textContent(); | ||
|
|
||
| await test.step('Change location to another depot', async () => { | ||
| await navbar.locationChooserButton.click(); | ||
| await locationChooser | ||
| .getOrganization(depotLocation.organization?.name as string) | ||
| .click(); | ||
| await locationChooser.getLocation(depotLocation.name).click(); | ||
| await putawayListPage.goToPage(); | ||
| await putawayListPage.searchField.fill( | ||
| `${putawayOrderIdentifier}`.toString().trim() | ||
| ); | ||
| await putawayListPage.searchButton.click(); | ||
| await putawayListPage.emptyPutawayList.isVisible(); | ||
| }); | ||
|
|
||
| await test.step('Go to putaway list page and assert pending putaway not visible in other location', async () => { | ||
| await putawayListPage.goToPage(); | ||
| await expect(putawayListPage.destinationFilter).toContainText( | ||
| depotLocation.name | ||
| ); | ||
| await putawayListPage.searchField.fill( | ||
| `${putawayOrderIdentifier}`.toString().trim() | ||
| ); | ||
| await putawayListPage.searchButton.click(); | ||
| await putawayListPage.emptyPutawayList.isVisible(); | ||
| }); | ||
|
|
||
| await test.step('Return to main location', async () => { | ||
| await authService.changeLocation(AppConfig.instance.locations.main.id); | ||
| }); | ||
|
Comment on lines
+187
to
+189
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't you somehow check if that redirect works? |
||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this -undefined-undefined data-testid should be fixed 😢