-
-
Notifications
You must be signed in to change notification settings - Fork 0
OBPIH-6683 Add tests for validation on delivered on date in receiving #41
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
65f23e0
OBPIH-6683 add selectors to receiving pages
kkrawczyk123 994a7d6
OBPIH-6683 add new alert
kkrawczyk123 8897569
OBPIH-6683 add tests for validation on delivered on date
kkrawczyk123 0efb88b
OBPIH-6683 add test for using save and save and exit buttons in receive
kkrawczyk123 e1fa7b6
OBPIH-6683 improve locators and assertion
kkrawczyk123 70e47d7
OBPIH-6683 add suggested method
kkrawczyk123 172d5b7
OBPIH-6683 improve assertion and use new filling method
kkrawczyk123 9b259c0
OBPIH-6683 fix conflicts and remove unused selectors
kkrawczyk123 a06fa28
OBPIH-6683 fix failing test
kkrawczyk123 f0a9cb4
Add a todo in the DatePicker component
awalkowiak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| import { ShipmentType } from '@/constants/ShipmentType'; | ||
| import { expect, test } from '@/fixtures/fixtures'; | ||
| import { StockMovementResponse } from '@/types'; | ||
| import { getDateByOffset } from '@/utils/DateUtils'; | ||
|
|
||
| test.describe('Validations on edit Deliver On Date when receiving shipment', () => { | ||
| let STOCK_MOVEMENT: StockMovementResponse; | ||
|
|
||
| test.beforeEach( | ||
| async ({ | ||
| supplierLocationService, | ||
| stockMovementService, | ||
| mainProductService, | ||
| }) => { | ||
| const supplierLocation = await supplierLocationService.getLocation(); | ||
| STOCK_MOVEMENT = await stockMovementService.createInbound({ | ||
| originId: supplierLocation.id, | ||
| }); | ||
|
|
||
| const product = await mainProductService.getProduct(); | ||
|
|
||
| await stockMovementService.addItemsToInboundStockMovement( | ||
| STOCK_MOVEMENT.id, | ||
| [{ productId: product.id, quantity: 50 }] | ||
| ); | ||
|
|
||
| await stockMovementService.sendInboundStockMovement(STOCK_MOVEMENT.id, { | ||
| shipmentType: ShipmentType.AIR, | ||
| }); | ||
| } | ||
| ); | ||
|
|
||
| test.afterEach(async ({ stockMovementShowPage, stockMovementService }) => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
|
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. don't we need a null safe here, in case the stock movement has not been created successfully in the |
||
| await stockMovementShowPage.rollbackButton.click(); | ||
| await stockMovementService.deleteStockMovement(STOCK_MOVEMENT.id); | ||
| }); | ||
|
|
||
| test('Assert validation on try to edit Delivered on Date to future date', async ({ | ||
| stockMovementShowPage, | ||
| receivingPage, | ||
| }) => { | ||
| await test.step('Go to stock movement show page', async () => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Go to shipment receiving page', async () => { | ||
| await stockMovementShowPage.receiveButton.click(); | ||
| await receivingPage.receivingStep.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Autofill qty and go to check page', async () => { | ||
| await receivingPage.receivingStep.autofillQuantitiesButton.click(); | ||
| await receivingPage.nextButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Edit Delivered on Date on check page to future date', async () => { | ||
| await receivingPage.checkStep.isLoaded(); | ||
| await receivingPage.checkStep.deliveredOnDateField.fillWithFormat( | ||
| getDateByOffset(new Date(), 1), | ||
| 'MM/DD/YYYY HH:mm:ss Z' | ||
| ); | ||
| await receivingPage.checkStep.deliveredOnDateField.assertHasError(); | ||
| await expect( | ||
| receivingPage.checkStep.deliveredOnDateField.errorMessage | ||
| ).toContainText('The date cannot be in the future'); | ||
| }); | ||
| }); | ||
|
|
||
| test('Assert validation on try to edit Delivered on Date to past date', async ({ | ||
| stockMovementShowPage, | ||
| receivingPage, | ||
| }) => { | ||
| await test.step('Go to stock movement show page', async () => { | ||
| await stockMovementShowPage.goToPage(STOCK_MOVEMENT.id); | ||
| await stockMovementShowPage.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Go to shipment receiving page', async () => { | ||
| await stockMovementShowPage.receiveButton.click(); | ||
| await receivingPage.receivingStep.isLoaded(); | ||
| }); | ||
|
|
||
| await test.step('Autofill qty and go to check page', async () => { | ||
| await receivingPage.receivingStep.autofillQuantitiesButton.click(); | ||
| await receivingPage.nextButton.click(); | ||
| }); | ||
|
|
||
| await test.step('Edit Delivered on Date on check page to past date', async () => { | ||
| await receivingPage.checkStep.isLoaded(); | ||
| await receivingPage.checkStep.deliveredOnDateField.fillWithFormat( | ||
| getDateByOffset(new Date(), -1), | ||
| 'MM/DD/YYYY HH:mm:ss Z' | ||
| ); | ||
| await receivingPage.checkStep.isLoaded(); | ||
| await receivingPage.checkStep.receiveShipmentButton.click(); | ||
| await expect( | ||
| receivingPage.checkStep.validationOnDeliveredOnPastDatePopup | ||
| ).toBeVisible(); | ||
| }); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.