Skip to content

Commit

Permalink
Fixed a couple of tests and added a status field to the waterbody rep…
Browse files Browse the repository at this point in the history
…ort.
  • Loading branch information
cschwinderg committed Dec 6, 2024
1 parent d1466e5 commit 6e41839
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
43 changes: 40 additions & 3 deletions app/client/src/components/pages/WaterbodyReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import { getExtensionFromPath, titleCaseWithExceptions } from 'utils/utils';
// styles
import { colors } from 'styles/index';
// errors
import { waterbodyReportError } from 'config/errorMessages';
import {
status303dShortError,
waterbodyReportError,
} from 'config/errorMessages';

const containerStyles = css`
${splitLayoutContainerStyles};
Expand Down Expand Up @@ -268,6 +271,7 @@ function WaterbodyReport() {
data: [],
});
setReportingCycleFetch({ status: 'failure', year: '' });
setReportStatusFetch({ status: 'failure', value: '' });
setWaterbodyStatus({ status: 'failure', data: [] });
setWaterbodyUses({ status: 'failure', data: [] });
setWaterbodySources({ status: 'failure', data: [] });
Expand All @@ -283,9 +287,9 @@ function WaterbodyReport() {
status: 'no-data',
data: { condition: '', planForRestoration: '', listed303d: '' },
});
setReportingCycleFetch({
setReportStatusFetch({
status: 'success',
year: '',
value: '',
});
setWaterbodyUses({
status: 'success',
Expand Down Expand Up @@ -451,6 +455,10 @@ function WaterbodyReport() {
status: 'fetching',
year: '',
});
const [reportStatusFetch, setReportStatusFetch] = useState({
status: 'fetching',
value: '',
});
const [organizationName, setOrganizationName] = useState({
status: 'fetching',
name: '',
Expand Down Expand Up @@ -527,6 +535,10 @@ function WaterbodyReport() {
return;
}

setReportStatusFetch({
status: 'success',
value: firstItem.reportStatusCode,
});
setReportingCycleFetch({
status: 'success',
year: firstItem.reportingCycleText,
Expand Down Expand Up @@ -981,6 +993,31 @@ function WaterbodyReport() {
)}
</div>

<div css={inlineBoxSectionStyles}>
<strong>
<GlossaryTerm term="303(d) listed impaired waters (Category 5)">
303(d) List Status
</GlossaryTerm>
:
</strong>
&nbsp;&nbsp;
{reportStatusFetch.status === 'fetching' && <LoadingSpinner />}
{reportStatusFetch.status === 'failure' && (
<div css={modifiedErrorBoxStyles}>
<p>{status303dShortError}</p>
</div>
)}
{reportStatusFetch.status === 'success' && (
<p>
{configFiles.data.reportStatusMapping.hasOwnProperty(
reportStatusFetch.value,
)
? configFiles.data.reportStatusMapping[reportStatusFetch.value]
: reportStatusFetch.value}{' '}
</p>
)}
</div>

<div css={inlineBoxSectionStyles}>
<h4>Other Years Reported:</h4>
{(allReportingCycles.status === 'fetching' ||
Expand Down
4 changes: 2 additions & 2 deletions app/cypress/e2e/add-data-widget.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe('Add & Save Data Widget', () => {
});

// Run tests against "ArcGIS Online"
runSearchTests('USA Counties (Generalized)');
runSearchTests('Covid-19 kommunalt data');
});

it('Test URL feature', () => {
Expand Down Expand Up @@ -353,7 +353,7 @@ describe('Add & Save Data Widget', () => {
});

it("Test that the save panel includes layers added from the widget's other tabs", () => {
const agoSaveName = 'CYPRESS-TEST-HMW';
const agoSaveName = 'CYPRESS-TEST-HMW-C';

cy.get(adwId).within(() => {
cy.findByRole('listitem', { name: 'USA Current Wildfires' }).within(
Expand Down
2 changes: 1 addition & 1 deletion app/cypress/e2e/data.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('Data page', () => {
scrollTest(
'Watershed Assessment, Tracking & Environmental Results System (WATERS)',
);
scrollTest('Watershed Index Online (WSIO)');
scrollTest('Restoration and Protection Screening (RPS)');
scrollTest('Wild and Scenic Rivers');

// loop through and verify the "Top of Page" buttons all scroll to
Expand Down

0 comments on commit 6e41839

Please sign in to comment.