Skip to content

Commit

Permalink
Merge branch 'main' into b21526-MAIN-add_db_swagger_support_for_actua…
Browse files Browse the repository at this point in the history
…l_expense_reimbursement
  • Loading branch information
JamesHawks224 authored Oct 22, 2024
2 parents 299a461 + ff71810 commit 56ee82d
Show file tree
Hide file tree
Showing 21 changed files with 1,435 additions and 14 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 56ee82d

Please sign in to comment.