From cf0a410df4dce0da1cbf66a8bca6667a7429022a Mon Sep 17 00:00:00 2001 From: Steven Gleason <180579696+stevengleason-caci@users.noreply.github.com> Date: Thu, 6 Mar 2025 14:18:52 +0000 Subject: [PATCH 1/2] B-22244 add playwright test to approve a Delivery Address Change on an iHHG, specifically testing that the change is applied after saving the Review Modal, no need to save on the Shipment Edit page too. Fixed a bug in testharness/make_move.go, the MS service item must be on the Move not the Shipment. Also fixed a typo in the dHHG test. --- pkg/testdatagen/testharness/make_move.go | 3 +- playwright/tests/office/txo/tooFlows.spec.js | 2 +- .../office/txo/tooFlowsInternational.spec.js | 74 +++++++++++++++++++ playwright/tests/utils/testharness.js | 2 +- 4 files changed, 77 insertions(+), 4 deletions(-) diff --git a/pkg/testdatagen/testharness/make_move.go b/pkg/testdatagen/testharness/make_move.go index 5c8909b983b..52dc0e671d6 100644 --- a/pkg/testdatagen/testharness/make_move.go +++ b/pkg/testdatagen/testharness/make_move.go @@ -11072,8 +11072,7 @@ func makeIntlHHGMoveDestAddressRequested( factory.BuildMTOServiceItemBasic(appCtx.DB(), []factory.Customization{ { Model: models.MTOServiceItem{ - Status: models.MTOServiceItemStatusApproved, - MTOShipmentID: &shipmentAddressUpdate.Shipment.ID, + Status: models.MTOServiceItemStatusApproved, }, }, { diff --git a/playwright/tests/office/txo/tooFlows.spec.js b/playwright/tests/office/txo/tooFlows.spec.js index 412076deb28..415790132ed 100644 --- a/playwright/tests/office/txo/tooFlows.spec.js +++ b/playwright/tests/office/txo/tooFlows.spec.js @@ -644,7 +644,7 @@ test.describe('TOO user', () => { test('approves a delivery address change request for an HHG shipment', async ({ officePage, page }) => { test.setTimeout(300000); // This one has been a headache forever. Shoehorn fix to go way above default "slow" timeout - const shipmentAddressUpdate = await officePage.testHarness.bulidHHGMoveWithAddressChangeRequest(); + const shipmentAddressUpdate = await officePage.testHarness.buildHHGMoveWithAddressChangeRequest(); await officePage.signInAsNewTOOUser(); tooFlowPage = new TooFlowPage(officePage, shipmentAddressUpdate.Shipment.MoveTaskOrder); await tooFlowPage.waitForLoading(); diff --git a/playwright/tests/office/txo/tooFlowsInternational.spec.js b/playwright/tests/office/txo/tooFlowsInternational.spec.js index 2b209b143ec..7ded89759ca 100644 --- a/playwright/tests/office/txo/tooFlowsInternational.spec.js +++ b/playwright/tests/office/txo/tooFlowsInternational.spec.js @@ -254,4 +254,78 @@ test.describe('TOO user', () => { requestedServiceItemCount = await getServiceItemsInTable(requestedServiceItemsTable).count(); }); }); + + test('approves a delivery address change request for an international HHG shipment', async ({ page, officePage }) => { + const originalStreet = 'Alaska Zone II St.'; + const originalCity = 'North Pole'; + const originalZip = '99705'; + const updatedStreet = 'Another Cold St.'; + const updatedCity = 'Juneau'; + const updatedZip = '99811'; + const move = await officePage.testHarness.buildIntlHHGMoveDestAddressRequestedAKZone2AirForce(); + await officePage.signInAsNewTOOUser(); + const moveLocator = move.locator; + tooFlowPage = new TooFlowPage(officePage, move); + await tooFlowPage.waitForLoading(); + await officePage.tooNavigateToMove(moveLocator); + + await expect(page.getByTestId('destinationAddress')).toContainText('Review required'); + + // Edit the shipment + await page.getByRole('button', { name: 'Edit shipment' }).click(); + await expect( + page.getByTestId('alert').getByText('Request needs review. See delivery address to proceed.'), + ).toBeVisible(); + await expect( + page + .getByTestId('alert') + .getByText('Pending delivery address change request needs review. Review request to proceed.'), + ).toBeVisible(); + const originalDeliveryAddress = page.getByRole('group', { name: 'Delivery Address' }); + await expect(originalDeliveryAddress.getByTestId('delivery.address.streetAddress1')).toHaveValue(originalStreet); + await expect(originalDeliveryAddress.getByTestId('City')).toHaveText(originalCity); + await expect(originalDeliveryAddress.getByTestId('State')).toHaveText('AK'); + await expect(originalDeliveryAddress.getByTestId('ZIP')).toHaveText(originalZip); + + // click to trigger review modal + await page.getByRole('button', { name: 'Review request' }).click(); + await expect(page.getByTestId('modal')).toBeVisible(); + + await expect(page.getByTestId('two-line-address').nth(0)).toContainText(originalStreet); + await expect(page.getByTestId('two-line-address').nth(0)).toContainText(originalCity); + await expect(page.getByTestId('two-line-address').nth(0)).toContainText(originalZip); + await expect(page.getByTestId('two-line-address').nth(1)).toContainText(updatedStreet); + await expect(page.getByTestId('two-line-address').nth(1)).toContainText(updatedCity); + await expect(page.getByTestId('two-line-address').nth(1)).toContainText(updatedZip); + + // Enter information in modal and submit + await page.getByTestId('modal').getByTestId('radio').getByText('Yes').click(); + await page + .getByTestId('modal') + .locator('textarea') + .fill('Approved for test TOO user approves a delivery address change request for an international HHG shipment'); + + // Click save on the modal + await page.getByTestId('modal').getByRole('button', { name: 'Save' }).click(); + await expect(page.getByTestId('modal')).not.toBeVisible(); + + await expect(page.getByText('Changes sent to contractor.')).toBeVisible(); + const deliveryAddress = page.getByRole('group', { name: 'Delivery Address' }); + await expect(deliveryAddress.getByTestId('delivery.address.streetAddress1')).toHaveValue(updatedStreet); + await expect(deliveryAddress.getByTestId('City')).toHaveText(updatedCity); + await expect(deliveryAddress.getByTestId('State')).toHaveText('AK'); + await expect(deliveryAddress.getByTestId('ZIP')).toHaveText(updatedZip); + + // Click cancel on the Edit Shipment page + await page.getByRole('button', { name: 'Cancel' }).click(); + + await expect(page.getByText('Update request details')).not.toBeVisible(); + await expect(page.getByText('Review required')).not.toBeVisible(); + await expect(page.getByTestId('destinationAddress')).toContainText(updatedStreet); + await expect(page.getByTestId('destinationAddress')).toContainText(updatedCity); + await expect(page.getByTestId('destinationAddress')).toContainText(updatedZip); + await expect(page.getByText(originalStreet)).not.toBeVisible(); + await expect(page.getByText(originalCity)).not.toBeVisible(); + await expect(page.getByText(originalZip)).not.toBeVisible(); + }); }); diff --git a/playwright/tests/utils/testharness.js b/playwright/tests/utils/testharness.js index ceae7386107..d4538e3ea7e 100644 --- a/playwright/tests/utils/testharness.js +++ b/playwright/tests/utils/testharness.js @@ -648,7 +648,7 @@ export class TestHarness { * @returns {Promise} */ - async bulidHHGMoveWithAddressChangeRequest() { + async buildHHGMoveWithAddressChangeRequest() { return this.buildDefault('HHGMoveWithAddressChangeRequest'); } From 3702fe82d0186c187ab2733622a82dea9ba4d6e9 Mon Sep 17 00:00:00 2001 From: Steven Gleason <180579696+stevengleason-caci@users.noreply.github.com> Date: Fri, 7 Mar 2025 19:16:39 +0000 Subject: [PATCH 2/2] B-22244 cleanup comment --- playwright/tests/office/txo/tooFlowsInternational.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playwright/tests/office/txo/tooFlowsInternational.spec.js b/playwright/tests/office/txo/tooFlowsInternational.spec.js index 7ded89759ca..02bf5c5c322 100644 --- a/playwright/tests/office/txo/tooFlowsInternational.spec.js +++ b/playwright/tests/office/txo/tooFlowsInternational.spec.js @@ -287,7 +287,7 @@ test.describe('TOO user', () => { await expect(originalDeliveryAddress.getByTestId('State')).toHaveText('AK'); await expect(originalDeliveryAddress.getByTestId('ZIP')).toHaveText(originalZip); - // click to trigger review modal + // Click to trigger review modal await page.getByRole('button', { name: 'Review request' }).click(); await expect(page.getByTestId('modal')).toBeVisible();