From c140a286920204d08d190cc9c3a0d1c2abd16f8b Mon Sep 17 00:00:00 2001 From: KonstanceH Date: Wed, 25 Sep 2024 16:58:07 +0000 Subject: [PATCH] everything up to date --- pkg/services/move/move_router.go | 6 +- .../mto_shipment/mto_shipment_creator.go | 2 +- playwright/tests/my/mymove/mobileHome.spec.js | 141 ++++++++++++++++++ .../tests/utils/my/waitForCustomerPage.js | 9 ++ .../BoatShipmentForm/BoatShipmentForm.jsx | 2 +- .../MobileHomeShipmentForm.jsx | 12 +- .../MtoShipmentForm/MtoShipmentForm.jsx | 2 +- .../MobileHomeShipmentCard.test.jsx | 7 + .../Customer/Review/Summary/Summary.test.jsx | 2 + src/components/ShipmentList/ShipmentList.jsx | 3 +- src/content/shipments.js | 3 +- .../MobileHomeShipmentCreate.jsx | 5 +- .../MobileHomeShipmentCreate.test.jsx | 12 +- src/pages/MyMove/SelectShipmentType.jsx | 2 +- 14 files changed, 183 insertions(+), 25 deletions(-) create mode 100644 playwright/tests/my/mymove/mobileHome.spec.js diff --git a/pkg/services/move/move_router.go b/pkg/services/move/move_router.go index 771ed557fa1..c510023e5a7 100644 --- a/pkg/services/move/move_router.go +++ b/pkg/services/move/move_router.go @@ -207,8 +207,10 @@ func (router moveRouter) sendToServiceCounselor(appCtx appcontext.AppContext, mo return apperror.NewInvalidInputError(move.MTOShipments[i].PPMShipment.ID, err, verrs, msg) } } - // update status for boat shipment - if move.MTOShipments[i].ShipmentType == models.MTOShipmentTypeBoatHaulAway || move.MTOShipments[i].ShipmentType == models.MTOShipmentTypeBoatTowAway { + // update status for boat or mobile home shipment + if move.MTOShipments[i].ShipmentType == models.MTOShipmentTypeBoatHaulAway || + move.MTOShipments[i].ShipmentType == models.MTOShipmentTypeBoatTowAway || + move.MTOShipments[i].ShipmentType == models.MTOShipmentTypeMobileHome { move.MTOShipments[i].Status = models.MTOShipmentStatusSubmitted if verrs, err := appCtx.DB().ValidateAndUpdate(&move.MTOShipments[i]); verrs.HasAny() || err != nil { diff --git a/pkg/services/mto_shipment/mto_shipment_creator.go b/pkg/services/mto_shipment/mto_shipment_creator.go index aa65f0e6fe0..2ec87035109 100644 --- a/pkg/services/mto_shipment/mto_shipment_creator.go +++ b/pkg/services/mto_shipment/mto_shipment_creator.go @@ -157,7 +157,7 @@ func (f mtoShipmentCreator) CreateMTOShipment(appCtx appcontext.AppContext, ship // Populate the destination address fields with the new duty location's address when // we have an HHG or Boat with no destination address, but don't copy over any street fields. - if (shipment.ShipmentType == models.MTOShipmentTypeHHG || isBoatShipment) && shipment.DestinationAddress == nil { + if (shipment.ShipmentType == models.MTOShipmentTypeHHG || isBoatShipment || isMobileHomeShipment) && shipment.DestinationAddress == nil { err = appCtx.DB().Load(&move, "Orders.NewDutyLocation.Address") if err != nil { return nil, apperror.NewQueryError("Orders", err, "") diff --git a/playwright/tests/my/mymove/mobileHome.spec.js b/playwright/tests/my/mymove/mobileHome.spec.js new file mode 100644 index 00000000000..e87642c224d --- /dev/null +++ b/playwright/tests/my/mymove/mobileHome.spec.js @@ -0,0 +1,141 @@ +import { test, expect } from '../../utils/my/customerTest'; + +const multiMoveEnabled = process.env.FEATURE_FLAG_MULTI_MOVE; + +test.describe('Mobile Home shipment', () => { + test.skip(multiMoveEnabled === 'true', 'Skip if MultiMove workflow is enabled.'); + + test('A customer can create a Mobile Home shipment', async ({ page, customerPage }) => { + // Generate a new onboarded user with orders and log in + const move = await customerPage.testHarness.buildMoveWithOrders(); + const userId = move.Orders.ServiceMember.user_id; + await customerPage.signInAsExistingCustomer(userId); + + // Navigate to create a new shipment + await customerPage.waitForPage.home(); + await page.getByTestId('shipment-selection-btn').click(); + await customerPage.waitForPage.aboutShipments(); + await customerPage.navigateForward(); + await customerPage.waitForPage.selectShipmentType(); + + // Create an Mobile Home shipment + await page.getByText('Move a Mobile Home').click(); + await customerPage.navigateForward(); + + // Fill in form to create Mobile Home shipment + await customerPage.waitForPage.mobileHomeShipment(); + await page.getByLabel('Year').fill('2022'); + await page.getByLabel('Make').fill('make'); + await page.getByLabel('Model').fill('model'); + await page.getByTestId('lengthFeet').fill('22'); + await page.getByTestId('widthFeet').fill('22'); + await page.getByTestId('heightFeet').fill('22'); + await page.getByRole('button', { name: 'Continue' }).click(); + + await expect(page.getByTestId('tag')).toContainText('Mobile Home'); + + await expect(page.getByText('Pickup info')).toBeVisible(); + await page.getByLabel('Preferred pickup date').fill('25 Dec 2022'); + await page.getByLabel('Preferred pickup date').blur(); + await page.getByText('Use my current address').click(); + await page.getByLabel('Preferred delivery date').fill('25 Dec 2022'); + await page.getByLabel('Preferred delivery date').blur(); + await page.getByRole('button', { name: 'Save & Continue' }).click(); + await customerPage.waitForPage.reviewShipments(); + }); +}); + +test.describe('(MultiMove) Mobile Home shipment', () => { + test.skip(multiMoveEnabled === 'false', 'Skip if MultiMove workflow is not enabled.'); + + test('A customer can create a Mobile Home shipment', async ({ page, customerPage }) => { + // Generate a new onboarded user with orders and log in + const move = await customerPage.testHarness.buildMoveWithOrders(); + const userId = move.Orders.ServiceMember.user_id; + await customerPage.signInAsExistingCustomer(userId); + + // Navigate from MM Dashboard to Move + await customerPage.navigateFromMMDashboardToMove(move); + + // Navigate to create a new shipment + await customerPage.waitForPage.home(); + await page.getByTestId('shipment-selection-btn').click(); + await customerPage.waitForPage.aboutShipments(); + await customerPage.navigateForward(); + await customerPage.waitForPage.selectShipmentType(); + + // Create an Mobile Home shipment + await page.getByText('Move a mobile home').click(); + await customerPage.navigateForward(); + + // Fill in form to create Mobile Home shipment + await customerPage.waitForPage.mobileHomeShipment(); + await page.getByLabel('Year').fill('2022'); + await page.getByLabel('Make').fill('make'); + await page.getByLabel('Model').fill('model'); + await page.getByTestId('lengthFeet').fill('22'); + await page.getByTestId('widthFeet').fill('22'); + await page.getByTestId('heightFeet').fill('22'); + await page.getByRole('button', { name: 'Continue' }).click(); + + await expect(page.getByTestId('tag')).toContainText('Mobile Home'); + + await expect(page.getByText('Pickup info')).toBeVisible(); + await page.getByLabel('Preferred pickup date').fill('25 Dec 2022'); + await page.getByLabel('Preferred pickup date').blur(); + await page.getByText('Use my current address').click(); + await page.getByLabel('Preferred delivery date').fill('25 Dec 2022'); + await page.getByLabel('Preferred delivery date').blur(); + await page.getByRole('button', { name: 'Save & Continue' }).click(); + await customerPage.waitForPage.reviewShipments(); + }); + + test('Is able to delete a Mobile Home shipment', async ({ page, customerPage }) => { + // Generate a new onboarded user with orders and log in + const move = await customerPage.testHarness.buildMoveWithOrders(); + const userId = move.Orders.ServiceMember.user_id; + await customerPage.signInAsExistingCustomer(userId); + + // Navigate from MM Dashboard to Move + await customerPage.navigateFromMMDashboardToMove(move); + + // Navigate to create a new shipment + await customerPage.waitForPage.home(); + await page.getByTestId('shipment-selection-btn').click(); + await customerPage.waitForPage.aboutShipments(); + await customerPage.navigateForward(); + await customerPage.waitForPage.selectShipmentType(); + + // Create an Mobile Home shipment + await page.getByText('Move a mobile home').click(); + await customerPage.navigateForward(); + + // Fill in form to create Mobile Home shipment + await customerPage.waitForPage.mobileHomeShipment(); + await page.getByLabel('Year').fill('2022'); + await page.getByLabel('Make').fill('make'); + await page.getByLabel('Model').fill('model'); + await page.getByTestId('lengthFeet').fill('22'); + await page.getByTestId('widthFeet').fill('22'); + await page.getByTestId('heightFeet').fill('22'); + await page.getByRole('button', { name: 'Continue' }).click(); + + await expect(page.getByTestId('tag')).toContainText('Mobile Home'); + + await expect(page.getByText('Pickup info')).toBeVisible(); + await page.getByLabel('Preferred pickup date').fill('25 Dec 2022'); + await page.getByLabel('Preferred pickup date').blur(); + await page.getByText('Use my current address').click(); + await page.getByLabel('Preferred delivery date').fill('25 Dec 2022'); + await page.getByLabel('Preferred delivery date').blur(); + await page.getByRole('button', { name: 'Save & Continue' }).click(); + await customerPage.waitForPage.reviewShipments(); + + await expect(page.getByRole('heading', { name: 'Mobile Home 1' })).toBeVisible(); + await page.getByTestId('deleteShipmentButton').click(); + await expect(page.getByRole('heading', { name: 'Delete this?' })).toBeVisible(); + await page.getByText('Yes, Delete').click(); + + await expect(page.getByRole('heading', { name: 'Mobile Home 1' })).not.toBeVisible(); + }); +}); diff --git a/playwright/tests/utils/my/waitForCustomerPage.js b/playwright/tests/utils/my/waitForCustomerPage.js index 18d76ac5d95..20fa227d9b0 100644 --- a/playwright/tests/utils/my/waitForCustomerPage.js +++ b/playwright/tests/utils/my/waitForCustomerPage.js @@ -193,6 +193,15 @@ export class WaitForCustomerPage extends WaitForPage { await this.runAccessibilityAudit(); } + /** + * @returns {Promise} + */ + async mobileHomeShipment() { + await this.runAccessibilityAudit(); + await base.expect(this.page.getByRole('heading', { level: 1 })).toHaveText('Mobile Home details and measurements'); + await this.runAccessibilityAudit(); + } + /** * @returns {Promise} */ diff --git a/src/components/Customer/BoatShipment/BoatShipmentForm/BoatShipmentForm.jsx b/src/components/Customer/BoatShipment/BoatShipmentForm/BoatShipmentForm.jsx index 71231b68f6f..23be0316bd2 100644 --- a/src/components/Customer/BoatShipment/BoatShipmentForm/BoatShipmentForm.jsx +++ b/src/components/Customer/BoatShipment/BoatShipmentForm/BoatShipmentForm.jsx @@ -332,7 +332,7 @@ const BoatShipmentForm = ({ mtoShipment, onBack, onSubmit }) => { Examples
  • - Dimensions of the boat on the trailer are signigicantly different than one would expect given + Dimensions of the boat on the trailer are significantly different than one would expect given their individual dimensions
  • diff --git a/src/components/Customer/MobileHomeShipment/MobileHomeShipmentForm/MobileHomeShipmentForm.jsx b/src/components/Customer/MobileHomeShipment/MobileHomeShipmentForm/MobileHomeShipmentForm.jsx index ed539caa480..bcda327502b 100644 --- a/src/components/Customer/MobileHomeShipment/MobileHomeShipmentForm/MobileHomeShipmentForm.jsx +++ b/src/components/Customer/MobileHomeShipment/MobileHomeShipmentForm/MobileHomeShipmentForm.jsx @@ -109,7 +109,7 @@ const MobileHomeShipmentForm = ({ mtoShipment, onBack, onSubmit }) => {
    -

    Mobile home Information

    +

    Mobile Home Information

    {

    Mobile Home Dimensions

    -

    Enter all of the dimensions of the mobile home.

    +

    Enter the total outside dimensions (in Feet and Inches) of the Mobile Home.

    @@ -276,14 +276,12 @@ const MobileHomeShipmentForm = ({ mtoShipment, onBack, onSubmit }) => { - Examples + Example
    • - Dimensions of the mobile home on the trailer are signigicantly different than one would expect - given their individual dimensions + Is there additional information you feel is pertinent to the processing of your mobile home + shipment?(e.g., ‘wrecker service requested’ and ‘crane service needed’).
    • - -
    • Access info for your origin or destination address/marina
    diff --git a/src/components/Customer/MtoShipmentForm/MtoShipmentForm.jsx b/src/components/Customer/MtoShipmentForm/MtoShipmentForm.jsx index 354407ad2a6..a8429cd4f19 100644 --- a/src/components/Customer/MtoShipmentForm/MtoShipmentForm.jsx +++ b/src/components/Customer/MtoShipmentForm/MtoShipmentForm.jsx @@ -622,7 +622,7 @@ class MtoShipmentForm extends Component { )} - {!isBoat && ( + {!isBoat && !isMobileHome && (
    Remarks {optionalLabel}
    }>