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

20653 mobile home shipment card main #13760

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 4 additions & 2 deletions pkg/services/move/move_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/services/mto_shipment/mto_shipment_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
Expand Down
141 changes: 141 additions & 0 deletions playwright/tests/my/mymove/mobileHome.spec.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
9 changes: 9 additions & 0 deletions playwright/tests/utils/my/waitForCustomerPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ export class WaitForCustomerPage extends WaitForPage {
await this.runAccessibilityAudit();
}

/**
* @returns {Promise<void>}
*/
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<void>}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const BoatShipmentForm = ({ mtoShipment, onBack, onSubmit }) => {
Examples
<ul>
<li>
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
</li>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const MobileHomeShipmentForm = ({ mtoShipment, onBack, onSubmit }) => {
<div className={styles.formContainer}>
<Form className={formStyles.form}>
<SectionWrapper className={classnames(styles.sectionWrapper, formStyles.formSection, 'origin')}>
<h2>Mobile home Information</h2>
<h2>Mobile Home Information</h2>
<div className="grid-row grid-gap">
<div className="mobile-lg:grid-col-3">
<MaskedTextField
Expand Down Expand Up @@ -141,7 +141,7 @@ const MobileHomeShipmentForm = ({ mtoShipment, onBack, onSubmit }) => {
</SectionWrapper>
<SectionWrapper className={classnames(styles.sectionWrapper, formStyles.formSection, 'origin')}>
<h2>Mobile Home Dimensions</h2>
<p>Enter all of the dimensions of the mobile home.</p>
<p>Enter the total outside dimensions (in Feet and Inches) of the Mobile Home.</p>
<div>
<Fieldset className={styles.formFieldContainer}>
<div className="labelWrapper">
Expand Down Expand Up @@ -276,14 +276,12 @@ const MobileHomeShipmentForm = ({ mtoShipment, onBack, onSubmit }) => {
</Label>

<Callout>
Examples
Example
<ul>
<li>
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., &lsquo;wrecker service requested&rsquo; and &lsquo;crane service needed&rsquo;).
</li>

<li>Access info for your origin or destination address/marina</li>
</ul>
</Callout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ class MtoShipmentForm extends Component {
</SectionWrapper>
)}

{!isBoat && (
{!isBoat && !isMobileHome && (
<SectionWrapper className={formStyles.formSection}>
<Fieldset legend={<div className={formStyles.legendContent}>Remarks {optionalLabel}</div>}>
<Label htmlFor="customerRemarks">
Expand Down
2 changes: 2 additions & 0 deletions src/components/Customer/Review/Summary/Summary.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ describe('Summary page', () => {
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.NTS);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.NTSR);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.BOAT);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.MOBILE_HOME);
});

it('add shipment modal displays still in dev mode', async () => {
Expand Down Expand Up @@ -697,6 +698,7 @@ describe('Summary page', () => {
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.NTS);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.NTSR);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.BOAT);
expect(isBooleanFlagEnabled).toBeCalledWith(FEATURE_FLAG_KEYS.MOBILE_HOME);
});
});
afterEach(jest.clearAllMocks);
Expand Down
3 changes: 2 additions & 1 deletion src/components/ShipmentList/ShipmentList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import styles from './ShipmentList.module.scss';

import { shipmentTypes, WEIGHT_ADJUSTMENT } from 'constants/shipments';
import { SHIPMENT_OPTIONS, SHIPMENT_TYPES } from 'shared/constants';
import { getShipmentTypeLabel } from 'utils/shipmentDisplay';
import { ShipmentShape } from 'types/shipment';
import { formatWeight } from 'utils/formatters';
import { isPPMShipmentComplete, isBoatShipmentComplete, isMobileHomeShipmentComplete } from 'utils/shipments';
Expand Down Expand Up @@ -59,7 +60,7 @@ export const ShipmentListItem = ({
>
<div>
<strong>
{shipmentTypes[shipment.shipmentType]}
{getShipmentTypeLabel(shipment.shipmentType)}
{showNumber && ` ${shipmentNumber}`}
</strong>{' '}
<br />
Expand Down
3 changes: 1 addition & 2 deletions src/content/shipments.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ export const shipmentForm = {
[SHIPMENT_OPTIONS.HHG]: 'Movers pack and transport this shipment',
[SHIPMENT_OPTIONS.NTS]: 'Where and when should the movers pick up your personal property going into storage?',
[SHIPMENT_OPTIONS.NTSR]: 'Where and when should the movers deliver your personal property from storage?',
[SHIPMENT_OPTIONS.MOBILE_HOME]: 'Where and when should the movers deliver your mobile home?',
},
};

export const shipmentSectionLabels = {
HHG: 'HHG shipment',
MOBILE_HOME: 'MOBILE Home shipment',
MOBILE_HOME: 'Mobile Home shipment',
HHG_INTO_NTS_DOMESTIC: 'NTS shipment',
HHG_OUTOF_NTS_DOMESTIC: 'NTS-release shipment',
};
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const MobileHomeShipmentCreate = ({
});
}

dispatch(updateMTOShipment(response));
dispatch(updateMTOShipment(data));

// navigate to the next page
navigate(
Expand Down Expand Up @@ -151,7 +151,7 @@ const MobileHomeShipmentCreate = ({
<Grid row>
<Grid col desktop={{ col: 8, offset: 2 }}>
<ShipmentTag shipmentType={SHIPMENT_OPTIONS.MOBILE_HOME} shipmentNumber={shipmentNumber} />
<h1>Mobile home details and measurements</h1>
<h1>Mobile Home details and measurements</h1>
{errorMessage && (
<Alert headingLevel="h4" slim type="error">
{errorMessage}
Expand All @@ -165,7 +165,6 @@ const MobileHomeShipmentCreate = ({
onSubmit={handleSubmit}
onBack={handleBack}
postalCodeValidator={validatePostalCode}
isSubmitting={false}
isEditPage={isEditPage}
/>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ const renderMobileHomeShipmentCreate = async (props) => {
};

describe('MobileHomeShipmentCreate component', () => {
describe('creating a new mobile home shipment', () => {
describe('creating a new Mobile Home shipment', () => {
it('renders the heading and empty form', async () => {
await renderMobileHomeShipmentCreate();

expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile home details and measurements');
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile Home details and measurements');
});

it('routes back to the new shipment type screen when back is clicked', async () => {
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('MobileHomeShipmentCreate component', () => {
await userEvent.click(screen.getByRole('button', { name: 'Continue' }));
});

expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile home details and measurements');
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile Home details and measurements');

await waitFor(() => {
expect(createMTOShipment).toHaveBeenCalledWith({
Expand Down Expand Up @@ -167,7 +167,7 @@ describe('MobileHomeShipmentCreate component', () => {
await userEvent.click(screen.getByRole('button', { name: 'Continue' }));
});

expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile home details and measurements');
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile Home details and measurements');

await waitFor(() => {
expect(createMTOShipment).toHaveBeenCalledWith({
Expand All @@ -189,7 +189,7 @@ describe('MobileHomeShipmentCreate component', () => {
});
});

describe('editing an existing Mobile home shipment', () => {
describe('editing an existing Mobile Home shipment', () => {
const existingShipment = {
id: 'existingShipment123',
eTag: 'someETag',
Expand Down Expand Up @@ -225,7 +225,7 @@ describe('MobileHomeShipmentCreate component', () => {
await userEvent.click(screen.getByRole('button', { name: 'Continue' }));
});

expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile home details and measurements');
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Mobile Home details and measurements');

await waitFor(() => {
expect(patchMTOShipment).toHaveBeenCalledWith(
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MyMove/SelectShipmentType.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class SelectShipmentType extends Component {

const boatCardText = 'Provide information about your boat and we will determine how it will ship.';

const mobileHomeCardText = 'Please provide information about your mobile home.';
const mobileHomeCardText = 'Provide information about your mobile home.';

const selectableCardDefaultProps = {
onChange: (e) => this.setShipmentType(e),
Expand Down
Loading