From 89e3a612a4599d3ac3b5a3284962107ab553bf0e Mon Sep 17 00:00:00 2001 From: Brooklyn Welsh Date: Fri, 30 Aug 2024 14:06:53 -0400 Subject: [PATCH 1/4] Merge MAIN-B-19226-redo into INT-B-19226-redo --- migrations/app/migrations_manifest.txt | 1 - .../servicesCounselingTestFixture.js | 4 +- .../BackupAddressForm/BackupAddressForm.jsx | 1 + .../BackupAddressForm.test.jsx | 8 +- .../BackupContactForm.stories.jsx | 8 +- .../BackupContactForm.test.jsx | 34 +-- .../Customer/BackupContactForm/index.jsx | 2 +- .../BoatShipmentForm/BoatShipmentForm.jsx | 9 +- .../BoatShipmentForm.module.scss | 2 +- .../ContactInfoForm/ContactInfoForm.test.jsx | 36 ++-- .../Customer/ContactInfoForm/index.jsx | 2 +- .../Customer/DodInfoForm/DodInfoForm.jsx | 3 + .../Customer/DodInfoForm/DodInfoForm.test.jsx | 36 ++-- .../EditContactInfoForm.jsx | 35 ++- .../EditContactInfoForm.test.jsx | 18 +- .../EditOrdersForm/EditOrdersForm.jsx | 51 +++-- .../EditOrdersForm/EditOrdersForm.test.jsx | 54 ++--- .../MtoShipmentForm/MtoShipmentForm.jsx | 22 +- .../MtoShipmentForm/MtoShipmentForm.test.jsx | 201 +++++++++--------- src/components/Customer/NameForm/NameForm.jsx | 8 +- .../Customer/NameForm/NameForm.test.jsx | 16 +- .../OrdersInfoForm/OrdersInfoForm.jsx | 38 ++-- .../OrdersInfoForm/OrdersInfoForm.test.jsx | 60 +++--- .../PPM/Booking/Advance/AdvanceForm.jsx | 1 + .../PPM/Booking/Advance/AdvanceForm.test.jsx | 12 +- .../DateAndLocationForm.jsx | 23 +- .../DateAndLocationForm.test.jsx | 70 +++--- .../EstimatedWeightsProGearForm.jsx | 5 + .../EstimatedWeightsProGearForm.test.jsx | 18 +- .../PPM/Closeout/AboutForm/AboutForm.jsx | 7 +- .../PPM/Closeout/AboutForm/AboutForm.test.jsx | 54 ++--- .../PPM/Closeout/ExpenseForm/ExpenseForm.jsx | 4 +- src/components/Customer/PPM/PPM.module.scss | 21 +- .../ResidentialAddressForm.jsx | 1 + .../ResidentialAddressForm.test.jsx | 13 +- .../ServiceInfoForm/ServiceInfoForm.jsx | 4 +- .../LocationSearchBox/LocationSearchBox.jsx | 7 +- .../EditBillableWeight/EditBillableWeight.jsx | 2 - .../EditBillableWeight.test.jsx | 10 +- .../EditFacilityInfoModal.test.jsx | 2 +- .../Office/ShipmentForm/ShipmentForm.test.jsx | 4 +- .../ShipmentWeightInput.test.jsx | 9 +- .../StorageFacilityAddress.test.jsx | 2 +- .../StorageFacilityInfo.test.jsx | 4 +- .../form/AddressFields/AddressFields.jsx | 6 +- .../form/AddressFields/AddressFields.test.jsx | 24 +-- .../form/BackupContactInfoFields/index.jsx | 12 +- .../ContactInfoFields/ContactInfoFields.jsx | 21 +- .../CustomerAltContactInfoFields/index.jsx | 14 +- .../CustomerContactInfoFields.stories.jsx | 2 +- .../form/CustomerContactInfoFields/index.jsx | 11 +- .../form/fields/DatePickerInput.jsx | 6 +- src/components/form/fields/DropdownInput.jsx | 20 +- .../form/fields/DutyLocationInput.jsx | 18 +- .../form/fields/DutyLocationInput.test.jsx | 26 ++- .../MaskedTextField/MaskedTextField.jsx | 4 +- .../form/fields/TextField/TextField.jsx | 4 +- src/pages/MyMove/AddOrders.test.jsx | 24 +-- .../BoatShipmentLocationInfo.test.jsx | 28 +-- .../MobileHomeShipmentLocationInfo.test.jsx | 10 +- src/pages/MyMove/Orders.test.jsx | 8 +- .../PPM/Booking/Advance/Advance.test.jsx | 18 +- .../DateAndLocation/DateAndLocation.test.jsx | 34 +-- .../MyMove/PPM/Closeout/About/About.test.jsx | 36 ++-- .../MyMove/Profile/BackupContact.test.jsx | 12 +- .../MyMove/Profile/EditContactInfo.test.jsx | 4 +- .../CustomerOnboarding/CreateCustomerForm.jsx | 18 +- ...icesCounselingEditShipmentDetails.test.jsx | 6 +- .../PrimeUIShipmentUpdateAddressForm.test.jsx | 10 +- ...pmentUpdateDestinationAddressForm.test.jsx | 8 +- 70 files changed, 694 insertions(+), 612 deletions(-) diff --git a/migrations/app/migrations_manifest.txt b/migrations/app/migrations_manifest.txt index 9698bf10bcb..60eac35540a 100644 --- a/migrations/app/migrations_manifest.txt +++ b/migrations/app/migrations_manifest.txt @@ -997,4 +997,3 @@ 20240820151043_add_gsr_role.up.sql 20240821180447_populating_locked_price_cents_for_ms_and_cs.up.sql 20240822180409_adding_locked_price_cents_service_param.up.sql -20240820151043_add_gsr_role.up.sql diff --git a/playwright/tests/office/servicescounseling/servicesCounselingTestFixture.js b/playwright/tests/office/servicescounseling/servicesCounselingTestFixture.js index 1174d4830cd..cd24ca642ca 100644 --- a/playwright/tests/office/servicescounseling/servicesCounselingTestFixture.js +++ b/playwright/tests/office/servicescounseling/servicesCounselingTestFixture.js @@ -159,7 +159,7 @@ export class ServiceCounselorPage extends OfficePage { // Storage facility address const storageAddress = await this.page.getByRole('heading', { name: 'Storage facility address' }).locator('..'); - await storageAddress.getByLabel('Address 1').fill('148 S East St'); + await storageAddress.getByLabel(/Address 1/).fill('148 S East St'); await storageAddress.getByLabel('Address 2').fill('Suite 7A'); await storageAddress.getByLabel('City').fill('Sample City'); await storageAddress.getByLabel('State').selectOption({ label: 'GA' }); @@ -172,7 +172,7 @@ export class ServiceCounselorPage extends OfficePage { // Delivery location const deliveryLocation = await this.page.getByRole('group', { name: 'Delivery location' }); - await deliveryLocation.getByLabel('Address 1').fill('448 Washington Blvd NE'); + await deliveryLocation.getByLabel(/Address 1/).fill('448 Washington Blvd NE'); await deliveryLocation.getByLabel('Address 2').fill('Apt D3'); await deliveryLocation.getByLabel('City').fill('Another City'); await deliveryLocation.getByLabel('State').selectOption({ label: 'AL' }); diff --git a/src/components/Customer/BackupAddressForm/BackupAddressForm.jsx b/src/components/Customer/BackupAddressForm/BackupAddressForm.jsx index f6593c3466b..7507cdd1ac4 100644 --- a/src/components/Customer/BackupAddressForm/BackupAddressForm.jsx +++ b/src/components/Customer/BackupAddressForm/BackupAddressForm.jsx @@ -59,6 +59,7 @@ const BackupAddressForm = ({ formFieldsName, initialValues, onSubmit, onBack }) { const { getByLabelText } = render(); await waitFor(() => { - expect(getByLabelText('Address 1')).toBeInstanceOf(HTMLInputElement); + expect(getByLabelText(/Address 1/)).toBeInstanceOf(HTMLInputElement); expect(getByLabelText(/Address 2/)).toBeInstanceOf(HTMLInputElement); @@ -59,13 +59,13 @@ describe('BackupAddressForm component', () => { expect(getByLabelText('State')).toBeInstanceOf(HTMLInputElement); - expect(getByLabelText('ZIP')).toBeInstanceOf(HTMLInputElement); + expect(getByLabelText(/ZIP/)).toBeInstanceOf(HTMLInputElement); }); }); it('shows an error message if trying to submit an invalid form', async () => { const { getByRole, findAllByRole, getByLabelText } = render(); - await userEvent.click(getByLabelText('Address 1')); + await userEvent.click(getByLabelText(/Address 1/)); await userEvent.click(getByLabelText(/Address 2/)); const submitBtn = getByRole('button', { name: 'Next' }); @@ -85,7 +85,7 @@ describe('BackupAddressForm component', () => { const { getByRole, getByLabelText } = render(); const submitBtn = getByRole('button', { name: 'Next' }); - await userEvent.type(getByLabelText('Address 1'), fakeAddress.streetAddress1); + await userEvent.type(getByLabelText(/Address 1/), fakeAddress.streetAddress1); await userEvent.type(getByLabelText(/Address 2/), fakeAddress.streetAddress2); await userEvent.tab(); diff --git a/src/components/Customer/BackupContactForm/BackupContactForm.stories.jsx b/src/components/Customer/BackupContactForm/BackupContactForm.stories.jsx index 8ff7a0b13b3..60a1e96b6e0 100644 --- a/src/components/Customer/BackupContactForm/BackupContactForm.stories.jsx +++ b/src/components/Customer/BackupContactForm/BackupContactForm.stories.jsx @@ -18,7 +18,12 @@ const emptyInitialValues = { }; export const DefaultState = (argTypes) => ( - + ); export const WithInitialValues = (argTypes) => ( @@ -30,5 +35,6 @@ export const WithInitialValues = (argTypes) => ( }} onSubmit={argTypes.onSubmit} onBack={argTypes.onBack} + labelHint="Required" /> ); diff --git a/src/components/Customer/BackupContactForm/BackupContactForm.test.jsx b/src/components/Customer/BackupContactForm/BackupContactForm.test.jsx index eac8a486ae6..d948f63c8e2 100644 --- a/src/components/Customer/BackupContactForm/BackupContactForm.test.jsx +++ b/src/components/Customer/BackupContactForm/BackupContactForm.test.jsx @@ -20,18 +20,18 @@ describe('BackupContactForm Component', () => { const { getByLabelText } = render(); await waitFor(() => { - expect(getByLabelText('Name')).toBeInstanceOf(HTMLInputElement); - expect(getByLabelText('Name')).toBeRequired(); - expect(getByLabelText('Phone')).toBeInstanceOf(HTMLInputElement); - expect(getByLabelText('Phone')).toBeRequired(); - expect(getByLabelText('Email')).toBeInstanceOf(HTMLInputElement); - expect(getByLabelText('Email')).toBeRequired(); + expect(getByLabelText(/Name/)).toBeInstanceOf(HTMLInputElement); + expect(getByLabelText(/Name/)).toBeRequired(); + expect(getByLabelText(/Phone/)).toBeInstanceOf(HTMLInputElement); + expect(getByLabelText(/Phone/)).toBeRequired(); + expect(getByLabelText(/Email/)).toBeInstanceOf(HTMLInputElement); + expect(getByLabelText(/Email/)).toBeRequired(); }); }); it('validates the contact phone field', async () => { const { getByText, getByLabelText } = render(); - await userEvent.type(getByLabelText('Phone'), '12345'); + await userEvent.type(getByLabelText(/Phone/), '12345'); await userEvent.tab(); await waitFor(() => { @@ -43,7 +43,7 @@ describe('BackupContactForm Component', () => { it('validates the email field', async () => { const { getByText, getByLabelText } = render(); - await userEvent.type(getByLabelText('Email'), 'sample@'); + await userEvent.type(getByLabelText(/Email/), 'sample@'); await userEvent.tab(); await waitFor(() => { @@ -56,9 +56,9 @@ describe('BackupContactForm Component', () => { const submitBtn = getByRole('button', { name: 'Next' }); // Touch all of the required fields so that they show error messages - await userEvent.click(getByLabelText('Name')); - await userEvent.click(getByLabelText('Phone')); - await userEvent.click(getByLabelText('Email')); + await userEvent.click(getByLabelText(/Name/)); + await userEvent.click(getByLabelText(/Phone/)); + await userEvent.click(getByLabelText(/Email/)); await userEvent.click(submitBtn); await waitFor(() => { @@ -72,9 +72,9 @@ describe('BackupContactForm Component', () => { const { getByRole, getByLabelText } = render(); const submitBtn = getByRole('button', { name: 'Next' }); - await userEvent.type(getByLabelText('Name'), 'Joe Schmoe'); - await userEvent.type(getByLabelText('Phone'), '555-555-5555'); - await userEvent.type(getByLabelText('Email'), 'test@sample.com'); + await userEvent.type(getByLabelText(/Name/), 'Joe Schmoe'); + await userEvent.type(getByLabelText(/Phone/), '555-555-5555'); + await userEvent.type(getByLabelText(/Email/), 'test@sample.com'); await userEvent.click(submitBtn); await waitFor(() => { @@ -86,9 +86,9 @@ describe('BackupContactForm Component', () => { const { getByRole, getByLabelText } = render(); const backBtn = getByRole('button', { name: 'Back' }); - await userEvent.type(getByLabelText('Name'), 'Janey Profaney'); - await userEvent.type(getByLabelText('Phone'), '555-555-1111'); - await userEvent.click(getByLabelText('Email')); + await userEvent.type(getByLabelText(/Name/), 'Janey Profaney'); + await userEvent.type(getByLabelText(/Phone/), '555-555-1111'); + await userEvent.click(getByLabelText(/Email/)); await userEvent.click(backBtn); await waitFor(() => { diff --git a/src/components/Customer/BackupContactForm/index.jsx b/src/components/Customer/BackupContactForm/index.jsx index bb6978d156b..e24bdf8d73e 100644 --- a/src/components/Customer/BackupContactForm/index.jsx +++ b/src/components/Customer/BackupContactForm/index.jsx @@ -27,7 +27,7 @@ const BackupContactForm = ({ initialValues, onSubmit, onBack }) => {
Date your orders were issued.
Uploads:
What address are the movers picking up from?
Do you know your delivery address yet?
What address are you moving from?
A second origin address could mean that your final incentive is lower than your estimate. @@ -253,6 +256,7 @@ const DateAndLocationForm = ({ mtoShipment, destinationDutyLocation, serviceMemb
Please input your destination address.
A second destination address could mean that your final incentive is lower than your @@ -349,6 +355,7 @@ const DateAndLocationForm = ({ mtoShipment, destinationDutyLocation, serviceMemb
What is the address on your W-2?
Must be a physical address.