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

Update error alert message on which VA location page #33238

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ describe('VAOS Page: VAFacilityPage eligibility check', () => {
store,
});

expect(await screen.findByText(/Something went wrong on our end/)).to
.exist;
expect(
await screen.findByText(
/You can.t schedule an appointment online right now/,
),
).to.exist;

// expect(await screen.findByText(/Continue/)).to.have.attribute('disabled');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { getFacilityPageV2Info } from '../../redux/selectors';
import { FETCH_STATUS } from '../../../utils/constants';
import EligibilityModal from './EligibilityModal';
import ErrorMessage from '../../../components/ErrorMessage';
import InfoAlert from '../../../components/InfoAlert';
import FacilitiesRadioWidget from './FacilitiesRadioWidget';
import FormButtons from '../../../components/FormButtons';
import NoValidVAFacilities from './NoValidVAFacilitiesV2';
Expand Down Expand Up @@ -92,14 +92,14 @@

useEffect(() => {
dispatch(openFacilityPageV2(pageKey, uiSchema, initialSchema));
}, []);

Check warning on line 95 in src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx:95:6:React Hook useEffect has missing dependencies: 'dispatch' and 'uiSchema'. Either include them or remove the dependency array.

Check warning on line 95 in src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx:95:6:React Hook useEffect has missing dependencies: 'dispatch' and 'uiSchema'. Either include them or remove the dependency array.

useEffect(
() => {
document.title = `${pageTitle} | Veterans Affairs`;
scrollAndFocus();
},
[isLoading],

Check warning on line 102 in src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx:102:5:React Hook useEffect has a missing dependency: 'pageTitle'. Either include it or remove the dependency array.

Check warning on line 102 in src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/components/VAFacilityPage/VAFacilityPageV2.jsx:102:5:React Hook useEffect has a missing dependency: 'pageTitle'. Either include it or remove the dependency array.
);

const previouslyShowingModal = usePrevious(showEligibilityModal);
Expand Down Expand Up @@ -131,7 +131,20 @@
return (
<div>
{pageHeader}
<ErrorMessage level="2" />
<InfoAlert
status="error"
level={2}
headline="You can't schedule an appointment online right now"
>
<p>
We're sorry. There's a problem with our system. Try again later.
</p>
<p>
If you need to schedule now, call your VA facility.
<br />
<a href="/find-locations">Find your VA health facility</a>
</p>
</InfoAlert>
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,11 @@ describe('VAOS Page: VAFacilityPage', () => {
store,
});

expect(await screen.findByText(/something went wrong on our end/i)).to
.exist;
expect(
await screen.findByText(
/You can.t schedule an appointment online right now/i,
),
).to.exist;
});

// Skipping test, it breaks the unit test suite when ran in a certain order and is testing v0
Expand Down
6 changes: 4 additions & 2 deletions src/applications/vaos/new-appointment/redux/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
newData = unset('vaFacility', newData);
}

if (newData.isSingleVaFacility) {
newData = unset('isSingleVaFacility', newData);
}

Comment on lines +140 to +143
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reset the boolean isSingleVaFacility when a new type of care is selected

// reset community care provider if type of care changes
if (pages.ccPreferences || !!newData.communityCareProvider?.id) {
newPages = unset('ccPreferences', newPages);
Expand All @@ -147,7 +151,7 @@
return { newPages, newData };
}

export default function formReducer(state = initialState, action) {

Check warning on line 154 in src/applications/vaos/new-appointment/redux/reducer.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/redux/reducer.js:154:25:Refactor this function to reduce its Cognitive Complexity from 63 to the 50 allowed.

Check warning on line 154 in src/applications/vaos/new-appointment/redux/reducer.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/new-appointment/redux/reducer.js:154:25:Refactor this function to reduce its Cognitive Complexity from 63 to the 50 allowed.
switch (action.type) {
case FORM_PAGE_OPENED: {
const { data, schema } = setupFormData(
Expand Down Expand Up @@ -273,8 +277,6 @@
data: {
...state.data,
facilityType: action.facilityType,
isSingleVaFacility:
action.facilityType !== FACILITY_TYPES.COMMUNITY_CARE,
},
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('VAOS direct schedule flow - Multiple facilities dead ends', () => {
.clickNextButton();

VAFacilityPageObject.assertUrl().assertErrorAlert({
text: /We.re sorry. We.ve run into a problem/i,
text: /You can.t schedule an appointment online right now/i,
});

// Assert
Expand Down
Loading