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

B 21977 INT Part 2 - Fix Office User Select Counseling Office Validation #14603

Merged
merged 40 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
49db121
merging in latest main and fixing conflicts
KonstanceH Jan 16, 2025
df50478
adding missing changes to updater
KonstanceH Jan 16, 2025
c44931c
adding missing change from test
KonstanceH Jan 16, 2025
35b0ff8
pull in latest main and fix conflicts
KonstanceH Jan 16, 2025
f551280
adding missing from test
KonstanceH Jan 16, 2025
c69023e
Merge remote-tracking branch 'origin/main' into B-21977
ajlusk Jan 16, 2025
9254ad2
fix office user selecting counseling office validation
ajlusk Jan 16, 2025
fd50864
Merge branch 'B-21977' into B-21977-INT3
ajlusk Jan 16, 2025
ead22f0
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 16, 2025
224a40b
fix AddOrdersForm test
ajlusk Jan 16, 2025
e4e2f75
Merge branch 'B-21977' into B-21977-INT3
ajlusk Jan 16, 2025
7fb141d
Merge branch 'main' into B-21904-NTS-OCONUS-MAIN
KonstanceH Jan 17, 2025
e8042fb
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 17, 2025
16736fa
Merge pull request #14450 from transcom/B-21904-NTS-OCONUS-MAIN
WeatherfordAaron Jan 17, 2025
bd416ad
Merge branch 'main' into b21576-main-add_order_types_for_sc_too
JamesHawks224 Jan 17, 2025
25f6942
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 17, 2025
04469ef
Merge branch 'main' into MAIN-B-22196-PPM-SIT-Cost-Defect
brooklyn-welsh Jan 17, 2025
eb05df9
Merge remote-tracking branch 'origin/main' into B-21977
ajlusk Jan 17, 2025
cb4cfaa
consistent required hints on AddOrdersForm.jsx
ajlusk Jan 17, 2025
c25596c
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 17, 2025
0c90fde
Merge branch 'B-21977' into B-21977-INT3
ajlusk Jan 17, 2025
826cf1a
added intergration scripts
JacintaCallahan Jan 17, 2025
342b061
Merge pull request #14610 from transcom/MAIN-B-22196-PPM-SIT-Cost-Defect
WeatherfordAaron Jan 17, 2025
03cc3c5
Merge branch 'main' into b21576-main-add_order_types_for_sc_too
WeatherfordAaron Jan 17, 2025
82273ba
update docker runner tag; merge health check changes
josiahzimmerman-caci Jan 17, 2025
23f569d
add mtls artifact
josiahzimmerman-caci Jan 17, 2025
cf53cfa
test fixes for 21977
ajlusk Jan 17, 2025
f704154
Merge remote-tracking branch 'origin/main' into B-21977
ajlusk Jan 17, 2025
51227e6
Merge branch 'B-21977' into B-21977-INT3
ajlusk Jan 17, 2025
e6fc65a
Merge branch 'main' into B-22110-cicd-optimizations-jc
josiahzimmerman-caci Jan 17, 2025
c7bbb5c
Merge pull request #14306 from transcom/b21576-main-add_order_types_f…
WeatherfordAaron Jan 17, 2025
bc74194
Merge branch 'main' into B-22110-cicd-optimizations-jc
josiahzimmerman-caci Jan 17, 2025
3c3d645
Merge pull request #14616 from transcom/B-22110-cicd-optimizations-jc
josiahzimmerman-caci Jan 17, 2025
9ad79b6
Merge remote-tracking branch 'origin/main' into B-21977
ajlusk Jan 17, 2025
5b30fcd
test updates for 21977
ajlusk Jan 17, 2025
adf50a8
Merge branch 'B-21977' into B-21977-INT3
ajlusk Jan 17, 2025
dd96fa9
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 17, 2025
8ec8dfa
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 20, 2025
36cda63
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 20, 2025
eaee8b6
Merge branch 'integrationTesting' into B-21977-INT3
ajlusk Jan 21, 2025
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
24 changes: 19 additions & 5 deletions src/components/Office/AddOrdersForm/AddOrdersForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const AddOrdersForm = ({
.required('Required'),
hasDependents: Yup.mixed().oneOf(['yes', 'no']).required('Required'),
originDutyLocation: Yup.object().nullable().required('Required'),
counselingOfficeId: currentDutyLocation.provides_services_counseling
? Yup.string().required('Required')
: Yup.string().notRequired(),
newDutyLocation: Yup.object().nullable().required('Required'),
grade: Yup.mixed().oneOf(Object.keys(ORDERS_PAY_GRADE_OPTIONS)).required('Required'),
accompaniedTour: showAccompaniedTourField
Expand Down Expand Up @@ -193,9 +196,10 @@ const AddOrdersForm = ({
handleOrderTypeChange(e);
}}
isDisabled={isSafetyMoveSelected || isBluebarkMoveSelected}
hint="Required"
/>
<DatePickerInput name="issueDate" label="Orders date" required />
<DatePickerInput name="reportByDate" label="Report by date" required />
<DatePickerInput name="issueDate" label="Orders date" required hint="Required" />
<DatePickerInput name="reportByDate" label="Report by date" required hint="Required" />

<DutyLocationInput
label="Current duty location"
Expand All @@ -207,6 +211,7 @@ const AddOrdersForm = ({
}}
metaOverride={originMeta}
required
hint="Required"
/>
{currentDutyLocation.provides_services_counseling && (
<div>
Expand Down Expand Up @@ -256,6 +261,7 @@ const AddOrdersForm = ({
displayAddress={false}
placeholder="Enter a city or ZIP"
metaOverride={newDutyMeta}
hint="Required"
onDutyLocationChange={(e) => {
setNewDutyLocation(e);
}}
Expand All @@ -266,6 +272,7 @@ const AddOrdersForm = ({
name="newDutyLocation"
label="New duty location"
required
hint="Required"
metaOverride={newDutyMeta}
onDutyLocationChange={(e) => {
setNewDutyLocation(e);
Expand All @@ -274,7 +281,7 @@ const AddOrdersForm = ({
)}

<FormGroup>
<Label>Are dependents included in the orders?</Label>
<Label hint="Required">Are dependents included in the orders?</Label>
<div>
<Field
as={Radio}
Expand Down Expand Up @@ -309,7 +316,7 @@ const AddOrdersForm = ({

{showAccompaniedTourField && (
<FormGroup>
<Label>Is this an accompanied tour?</Label>
<Label hint="Required">Is this an accompanied tour?</Label>
<div>
<div className={styles.radioWithToolTip}>
<Field
Expand Down Expand Up @@ -383,7 +390,14 @@ const AddOrdersForm = ({
</FormGroup>
)}

<DropdownInput label="Pay grade" name="grade" id="grade" required options={payGradeOptions} />
<DropdownInput
label="Pay grade"
name="grade"
id="grade"
required
options={payGradeOptions}
hint="Required"
/>
</SectionWrapper>

<div className={formStyles.formActions}>
Expand Down
124 changes: 68 additions & 56 deletions src/components/Office/AddOrdersForm/AddOrdersForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ describe('CreateMoveCustomerInfo Component', () => {

await waitFor(() => {
expect(screen.getByText('Tell us about the orders')).toBeInTheDocument();
expect(screen.getByLabelText('Orders type')).toBeInTheDocument();
expect(screen.getByLabelText('Orders date')).toBeInTheDocument();
expect(screen.getByLabelText('Report by date')).toBeInTheDocument();
expect(screen.getByText('Are dependents included in the orders?')).toBeInTheDocument();
expect(screen.getByLabelText(/Orders type/)).toBeInTheDocument();
expect(screen.getByLabelText(/Orders date/)).toBeInTheDocument();
expect(screen.getByLabelText(/Report by date/)).toBeInTheDocument();
expect(screen.getByText(/Are dependents included in the orders?/)).toBeInTheDocument();
expect(screen.getByTestId('hasDependentsYes')).toBeInTheDocument();
expect(screen.getByTestId('hasDependentsNo')).toBeInTheDocument();
expect(screen.getByLabelText('Current duty location')).toBeInTheDocument();
expect(screen.getByLabelText('New duty location')).toBeInTheDocument();
expect(screen.getByLabelText('Pay grade')).toBeInTheDocument();
expect(screen.getByLabelText(/Current duty location/)).toBeInTheDocument();
expect(screen.getByLabelText(/New duty location/)).toBeInTheDocument();
expect(screen.getByLabelText(/Pay grade/)).toBeInTheDocument();
});
});

Expand All @@ -170,7 +170,7 @@ describe('CreateMoveCustomerInfo Component', () => {
</Provider>,
);

const ordersTypeDropdown = getByLabelText('Orders type');
const ordersTypeDropdown = getByLabelText(/Orders type/);
expect(ordersTypeDropdown).toBeInstanceOf(HTMLSelectElement);

await userEvent.selectOptions(ordersTypeDropdown, ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION);
Expand Down Expand Up @@ -201,12 +201,12 @@ describe('CreateMoveCustomerInfo Component', () => {
<AddOrdersForm {...testProps} />
</Provider>,
);
await userEvent.click(getByLabelText('Orders type'));
await userEvent.click(getByLabelText('Orders date'));
await userEvent.click(getByLabelText('Report by date'));
await userEvent.click(getByLabelText('Current duty location'));
await userEvent.click(getByLabelText('New duty location'));
await userEvent.click(getByLabelText('Pay grade'));
await userEvent.click(getByLabelText(/Orders type/));
await userEvent.click(getByLabelText(/Orders date/));
await userEvent.click(getByLabelText(/Report by date/));
await userEvent.click(getByLabelText(/Current duty location/));
await userEvent.click(getByLabelText(/New duty location/));
await userEvent.click(getByLabelText(/Pay grade/));

const submitBtn = getByRole('button', { name: 'Next' });
await userEvent.click(submitBtn);
Expand Down Expand Up @@ -261,27 +261,6 @@ describe('AddOrdersForm - OCONUS and Accompanied Tour Test', () => {
});
});

describe('AddOrdersForm - Edge Cases and Additional Scenarios', () => {
it('disables orders type when safety move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isSafetyMoveSelected />
</Provider>,
);

expect(screen.getByLabelText('Orders type')).toBeDisabled();
});

it('disables orders type when bluebark move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isBluebarkMoveSelected />
</Provider>,
);
expect(screen.getByLabelText('Orders type')).toBeDisabled();
});
});

describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () => {
it('has dependents is yes and disabled when order type is student travel', async () => {
isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true));
Expand All @@ -292,7 +271,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
</Provider>,
);

await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.STUDENT_TRAVEL);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.STUDENT_TRAVEL);

const hasDependentsYes = screen.getByLabelText('Yes');
const hasDependentsNo = screen.getByLabelText('No');
Expand All @@ -313,7 +292,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
</Provider>,
);

await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.EARLY_RETURN_OF_DEPENDENTS);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.EARLY_RETURN_OF_DEPENDENTS);
const hasDependentsYes = screen.getByLabelText('Yes');
const hasDependentsNo = screen.getByLabelText('No');

Expand All @@ -333,7 +312,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
</Provider>,
);

await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION);

const hasDependentsYesPermChg = screen.getByLabelText('Yes');
const hasDependentsNoPermChg = screen.getByLabelText('No');
Expand All @@ -346,7 +325,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
});

// set order type to value that disables and defaults "has dependents"
await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.STUDENT_TRAVEL);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.STUDENT_TRAVEL);

const hasDependentsYesStudent = screen.getByLabelText('Yes');
const hasDependentsNoStudent = screen.getByLabelText('No');
Expand All @@ -358,7 +337,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
});

// set order type to value the re-enables "has dependents"
await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.LOCAL_MOVE);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.LOCAL_MOVE);

const hasDependentsYesLocalMove = screen.getByLabelText('Yes');
const hasDependentsNoLocalMove = screen.getByLabelText('No');
Expand All @@ -380,7 +359,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
</Provider>,
);

await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.PERMANENT_CHANGE_OF_STATION);

const hasDependentsYesPermChg = screen.getByLabelText('Yes');
const hasDependentsNoPermChg = screen.getByLabelText('No');
Expand All @@ -393,7 +372,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
});

// set order type to value that disables and defaults "has dependents"
await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.EARLY_RETURN_OF_DEPENDENTS);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.EARLY_RETURN_OF_DEPENDENTS);

const hasDependentsYesEarly = screen.getByLabelText('Yes');
const hasDependentsNoEarly = screen.getByLabelText('No');
Expand All @@ -405,7 +384,7 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
});

// set order type to value the re-enables "has dependents"
await userEvent.selectOptions(screen.getByLabelText('Orders type'), ORDERS_TYPE.LOCAL_MOVE);
await userEvent.selectOptions(screen.getByLabelText(/Orders type/), ORDERS_TYPE.LOCAL_MOVE);

const hasDependentsYesLocalMove = screen.getByLabelText('Yes');
const hasDependentsNoLocalMove = screen.getByLabelText('No');
Expand All @@ -419,6 +398,27 @@ describe('AddOrdersForm - Student Travel, Early Return of Dependents Test', () =
});
});

describe('AddOrdersForm - Edge Cases and Additional Scenarios', () => {
it('disables orders type when safety move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isSafetyMoveSelected />
</Provider>,
);

expect(screen.getByLabelText(/Orders type/)).toBeDisabled();
});

it('disables orders type when bluebark move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isBluebarkMoveSelected />
</Provider>,
);
expect(screen.getByLabelText(/Orders type/)).toBeDisabled();
});
});

describe('AddOrdersForm - With Counseling Office', () => {
it('displays the counseling office dropdown', async () => {
isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true));
Expand Down Expand Up @@ -452,24 +452,36 @@ describe('AddOrdersForm - With Counseling Office', () => {
const nextBtn = screen.getByRole('button', { name: 'Next' });
expect(nextBtn.getAttribute('disabled')).toBeFalsy();
});
});
describe('AddOrdersForm - Edge Cases and Additional Scenarios', () => {
it('disables orders type when safety move is selected', async () => {

it('disabled submit if counseling office is required and blank', async () => {
isBooleanFlagEnabled.mockImplementation(() => Promise.resolve(true));
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isSafetyMoveSelected />
<AddOrdersForm {...testProps} />
</Provider>,
);

expect(screen.getByLabelText('Orders type')).toBeDisabled();
});
await userEvent.selectOptions(await screen.findByLabelText(/Orders type/), 'PERMANENT_CHANGE_OF_STATION');
await userEvent.type(screen.getByLabelText(/Orders date/), '08 Nov 2024');
await userEvent.type(screen.getByLabelText(/Report by date/), '26 Nov 2024');

it('disables orders type when bluebark move is selected', async () => {
render(
<Provider store={mockStore.store}>
<AddOrdersForm {...testProps} isBluebarkMoveSelected />
</Provider>,
);
expect(screen.getByLabelText('Orders type')).toBeDisabled();
// Test Current Duty Location Search Box interaction
await userEvent.type(screen.getByLabelText(/Current duty location/), 'AFB', { delay: 100 });
const selectedOptionCurrent = await screen.findByText(/Scott/);
await userEvent.click(selectedOptionCurrent);

// Test New Duty Location Search Box interaction
await userEvent.type(screen.getByLabelText(/New duty location/), 'AFB', { delay: 100 });
const selectedOptionNew = await screen.findByText(/Luke/);
await userEvent.click(selectedOptionNew);

const counselingOfficeLabel = await screen.queryByText(/Counseling office/);
expect(counselingOfficeLabel).toBeTruthy(); // If the field is visible then it it required

await userEvent.selectOptions(screen.getByLabelText(/Pay grade/), ['E_5']);
await userEvent.click(screen.getByLabelText('No'));

const nextBtn = await screen.getByRole('button', { name: 'Next' }, { delay: 100 });
expect(nextBtn).toBeDisabled();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -357,21 +357,21 @@ describe('ServicesCounselingAddOrders component', () => {

const user = userEvent.setup();

await user.selectOptions(screen.getByLabelText('Orders type'), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText('Orders date'), '08 Nov 2020');
await user.type(screen.getByLabelText('Report by date'), '26 Nov 2020');
await user.selectOptions(screen.getByLabelText(/Orders type/), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText(/Orders date/), '08 Nov 2020');
await user.type(screen.getByLabelText(/Report by date/), '26 Nov 2020');
await user.click(screen.getByLabelText('No'));
await user.selectOptions(screen.getByLabelText('Pay grade'), ['E-5']);
await user.selectOptions(screen.getByLabelText(/Pay grade/), ['E-5']);

// Test Current Duty Location Search Box interaction
await user.type(screen.getByLabelText('Current duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/Current duty location/), 'AFB', { delay: 500 });
const selectedOptionCurrent = await screen.findByText(/Altus/);
await user.click(selectedOptionCurrent);

const counselingOfficeLabel = await screen.queryByText(/Counseling office/);
expect(counselingOfficeLabel).toBeFalsy();

await user.type(screen.getByLabelText('New duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/New duty location/), 'AFB', { delay: 500 });
const selectedOptionNew = await screen.findByText(/Luke/);
await user.click(selectedOptionNew);

Expand All @@ -395,14 +395,14 @@ describe('ServicesCounselingAddOrders component', () => {

const user = userEvent.setup();

await user.selectOptions(screen.getByLabelText('Orders type'), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText('Orders date'), '08 Nov 2020');
await user.type(screen.getByLabelText('Report by date'), '29 Nov 2020');
await user.selectOptions(screen.getByLabelText(/Orders type/), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText(/Orders date/), '08 Nov 2020');
await user.type(screen.getByLabelText(/Report by date/), '29 Nov 2020');
await user.click(screen.getByLabelText('No'));
await user.selectOptions(screen.getByLabelText('Pay grade'), ['E-5']);
await user.selectOptions(screen.getByLabelText(/Pay grade/), ['E-5']);

// Test Current Duty Location Search Box interaction
await user.type(screen.getByLabelText('Current duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/Current duty location/), 'AFB', { delay: 500 });
const selectedOptionCurrent = await screen.findByText(/Hill/);
await user.click(selectedOptionCurrent);

Expand All @@ -411,7 +411,7 @@ describe('ServicesCounselingAddOrders component', () => {

await userEvent.selectOptions(screen.getByLabelText(/Counseling office/), ['Glendale Luke AFB']);

await user.type(screen.getByLabelText('New duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/New duty location/), 'AFB', { delay: 500 });
const selectedOptionNew = await screen.findByText(/Luke/);
await user.click(selectedOptionNew);

Expand All @@ -429,17 +429,17 @@ describe('ServicesCounselingAddOrders component', () => {

const user = userEvent.setup();

await user.selectOptions(screen.getByLabelText('Orders type'), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText('Orders date'), '08 Nov 2020');
await user.type(screen.getByLabelText('Report by date'), '26 Nov 2020');
await user.selectOptions(screen.getByLabelText(/Orders type/), 'PERMANENT_CHANGE_OF_STATION');
await user.type(screen.getByLabelText(/Orders date/), '08 Nov 2020');
await user.type(screen.getByLabelText(/Report by date/), '26 Nov 2020');
await user.click(screen.getByLabelText('No'));
await user.selectOptions(screen.getByLabelText('Pay grade'), ['E-5']);
await user.selectOptions(screen.getByLabelText(/Pay grade/), ['E-5']);

await user.type(screen.getByLabelText('Current duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/Current duty location/), 'AFB', { delay: 500 });
const selectedOptionCurrent = await screen.findByText(/Altus/);
await user.click(selectedOptionCurrent);

await user.type(screen.getByLabelText('New duty location'), 'AFB', { delay: 500 });
await user.type(screen.getByLabelText(/New duty location/), 'AFB', { delay: 500 });
const selectedOptionNew = await screen.findByText(/Outta This World/);
await user.click(selectedOptionNew);

Expand Down
Loading