Skip to content

Commit

Permalink
Merge pull request #13839 from transcom/MAIN-remerge-B20617-SC-TOO-Cr…
Browse files Browse the repository at this point in the history
…eating-Mobile-Home-Shipment-and-Shipment-Card-Display

B-20617: SC TOO Creating Mobile Home Shipment and Shipment Card Display
  • Loading branch information
taeJungCaci authored Oct 22, 2024
2 parents bad2b72 + c0564c6 commit d702365
Show file tree
Hide file tree
Showing 17 changed files with 1,351 additions and 3 deletions.
10 changes: 10 additions & 0 deletions pkg/services/move/move_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ func (router moveRouter) sendToServiceCounselor(appCtx appcontext.AppContext, mo
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 {
msg := "failure saving shipment when routing move submission"
appCtx.Logger().Error(msg, zap.Error(err))
return apperror.NewInvalidInputError(move.MTOShipments[i].ID, err, verrs, msg)
}
}
// update status for mobile home shipment
if 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 {
msg := "failure saving shipment when routing move submission"
appCtx.Logger().Error(msg, zap.Error(err))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// @ts-check
import { test, expect } from './servicesCounselingTestFixture';

test.describe('Services counselor user', () => {
test.beforeEach(async ({ scPage }) => {
const move = await scPage.testHarness.buildHHGMoveWithNTSAndNeedsSC();
await scPage.navigateToMove(move.locator);
});

test('Services Counselor can create a mobile home shipment and view shipment card info', async ({ page, scPage }) => {
const deliveryDate = new Date().toLocaleDateString('en-US');
await page.getByTestId('dropdown').selectOption({ label: 'Mobile Home' });

await expect(page.getByRole('heading', { level: 1 })).toHaveText('Add shipment details');
await expect(page.getByTestId('tag')).toHaveText('Mobile Home');

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.locator('#requestedPickupDate').fill(deliveryDate);
await page.locator('#requestedPickupDate').blur();
await page.getByText('Use current address').click();
await page.locator('#requestedDeliveryDate').fill('16 Mar 2022');
await page.locator('#requestedDeliveryDate').blur();

await page.getByLabel('Counselor remarks').fill('Sample counselor remarks');

// Save the shipment
await page.getByRole('button', { name: 'Save' }).click();
await scPage.waitForPage.moveDetails();

await expect(page.getByTestId('ShipmentContainer')).toHaveCount(2);

await expect(page.getByText('Mobile home year')).toBeVisible();
await expect(page.getByTestId('year')).toHaveText('2022');
await expect(page.getByText('Mobile home make')).toBeVisible();
await expect(page.getByTestId('make')).toHaveText('make');
await expect(page.getByText('Mobile home model')).toBeVisible();
await expect(page.getByTestId('model')).toHaveText('model');
await expect(page.getByText('Dimensions')).toBeVisible();
await expect(page.getByTestId('dimensions')).toHaveText("22' L x 22' W x 22' H");
});
});
58 changes: 58 additions & 0 deletions playwright/tests/office/txo/tooFlowsMobileHome.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Semi-automated converted from a cypress test, and thus may contain
* non best-practices, in particular: heavy use of `page.locator`
* instead of `page.getBy*`.
*/

// @ts-check
import { test, expect } from '../../utils/office/officeTest';

import { TooFlowPage } from './tooTestFixture';

test.describe('TOO user', () => {
/** @type {TooFlowPage} */
let tooFlowPage;

test.beforeEach(async ({ officePage }) => {
const move = await officePage.testHarness.buildHHGMoveWithServiceItemsAndPaymentRequestsAndFilesForTOO();
await officePage.signInAsNewTOOUser();
tooFlowPage = new TooFlowPage(officePage, move);
await tooFlowPage.waitForLoading();
await officePage.tooNavigateToMove(tooFlowPage.moveLocator);
});

test('TOO can create a mobile home shipment and view shipment card info', async ({ page }) => {
const deliveryDate = new Date().toLocaleDateString('en-US');
await page.getByTestId('dropdown').selectOption({ label: 'Mobile Home' });

await expect(page.getByRole('heading', { level: 1 })).toHaveText('Add shipment details');
await expect(page.getByTestId('tag')).toHaveText('Mobile Home');

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.locator('#requestedPickupDate').fill(deliveryDate);
await page.locator('#requestedPickupDate').blur();
await page.getByText('Use current address').click();
await page.locator('#requestedDeliveryDate').fill('16 Mar 2022');
await page.locator('#requestedDeliveryDate').blur();

// Save the shipment
await page.getByRole('button', { name: 'Save' }).click();

await expect(page.getByTestId('ShipmentContainer')).toHaveCount(2);

await expect(page.getByText('Mobile home year')).toBeVisible();
await expect(page.getByTestId('year')).toHaveText('2022');
await expect(page.getByText('Mobile home make')).toBeVisible();
await expect(page.getByTestId('make')).toHaveText('make');
await expect(page.getByText('Mobile home model')).toBeVisible();
await expect(page.getByTestId('model')).toHaveText('model');
await expect(page.getByText('Dimensions')).toBeVisible();
await expect(page.getByTestId('dimensions')).toHaveText("22' L x 22' W x 22' H");
});
});
Loading

0 comments on commit d702365

Please sign in to comment.