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

Refactor test card #6653

Merged
merged 80 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
f88fcb4
Use storysource addon
mpbrown Aug 14, 2023
eb99649
Initial TestQueueCard
mpbrown Aug 14, 2023
5ca6636
Refactor test card and form
mpbrown Aug 30, 2023
feeeeec
Use TestCard.scss
mpbrown Aug 30, 2023
81c70ce
Change accordion to collapsible card
mpbrown Sep 5, 2023
78d203c
Add Covid AoE form
mpbrown Sep 5, 2023
c2b9c9d
Update symptoms and save form edits
mpbrown Sep 7, 2023
277fbe3
Add submit and validation
mpbrown Sep 11, 2023
a6378f1
Update card styling
mpbrown Sep 13, 2023
8c26c9a
Revert demo changes to single card
mpbrown Sep 15, 2023
3a00dfb
Add test date and time validation style
mpbrown Sep 15, 2023
40514df
Update test result radio group style
mpbrown Sep 15, 2023
3fe6ac4
Update card styling, add submit loader, correction alert
mpbrown Sep 18, 2023
a7cd9a4
Update timer styling
mpbrown Sep 18, 2023
53e61c6
Fix lint warnings in timer
mpbrown Sep 18, 2023
de49005
Revert timer and close button style change
mpbrown Sep 19, 2023
cb8cec3
Fix error summary display logic
mpbrown Sep 19, 2023
9a059ac
Add unordered list for error summary
mpbrown Sep 19, 2023
6035f46
Add submit modal
mpbrown Sep 19, 2023
5a80fab
Update CovidAoEForm and check if completed
mpbrown Sep 20, 2023
272cd10
Add testCardRefactorEnabled feature flag
mpbrown Sep 20, 2023
2635936
Start test without AOE modal
mpbrown Sep 20, 2023
023b97f
Revert explicit null aoe fields
mpbrown Sep 25, 2023
7dd5dfc
Organize disease specific components
mpbrown Sep 25, 2023
0c0141f
Remove from queue and fix adding from manage patients
mpbrown Sep 25, 2023
cad0405
Fix active patient added again after submit
mpbrown Sep 25, 2023
91b7817
Save AOE responses
mpbrown Sep 25, 2023
8e8f699
Reposition close button
mpbrown Sep 25, 2023
34a3fbe
Update test timer design
mpbrown Sep 25, 2023
a1416fa
Cleanup and refactor
mpbrown Sep 25, 2023
c523cd0
Fix dirty state update and test results comparison
mpbrown Sep 27, 2023
e1e2ee4
Update validation messages
mpbrown Sep 27, 2023
7dd6c2c
Update tests with timer changes
mpbrown Sep 27, 2023
982ed9b
Move files and use feature flag on submit loader
mpbrown Sep 27, 2023
ca3cd09
Add required asterisks
mpbrown Sep 27, 2023
22f29f9
Prevent patient re-add after page refresh
mpbrown Sep 27, 2023
e7d96fb
Fix fade out transition on test card
mpbrown Sep 27, 2023
070fbd0
Check for active mutations before updates from backend
mpbrown Sep 27, 2023
34351ed
Remove useMemo on options hooks with complex object dependencies
mpbrown Sep 27, 2023
5e78e35
WIP test card frontend tests
mpbrown Sep 27, 2023
e846362
Scroll to active patient and update test
mpbrown Sep 28, 2023
6b335ed
Update test snapshots for new timer
mpbrown Sep 28, 2023
8a5dcda
Update test for handling deleted device
mpbrown Sep 28, 2023
391c011
Revert "Use storysource addon"
mpbrown Sep 28, 2023
271a27c
Fix eslint import order
mpbrown Sep 28, 2023
6d24e25
fix snap
zdeveloper Oct 2, 2023
3504d86
fixed frontend test and fixed crash when sysmptomOnSet date was set
zdeveloper Oct 5, 2023
66b28d3
update snapshots
zdeveloper Oct 5, 2023
5c1031c
fix linting
zdeveloper Oct 5, 2023
5e2611e
address sonar feedback
zdeveloper Oct 5, 2023
cb62e1f
follow up fix
zdeveloper Oct 5, 2023
ab66c91
add MultiplexResultInputGroup tests
zdeveloper Oct 10, 2023
e244186
add CovidResultInputGroup tests
zdeveloper Oct 10, 2023
d4a5387
clean console.log
zdeveloper Oct 10, 2023
92aae30
refactor all userEvents to use the user.setup object in testcard.test…
zdeveloper Oct 10, 2023
efbc72b
added more test coverage
zdeveloper Oct 10, 2023
3b32075
Hide AOE for flu only devices
mpbrown Oct 11, 2023
16d87d4
disable new test card in e2e and improve testing
zdeveloper Oct 11, 2023
57d4e66
turn off new test card in stg demo training and e2e
zdeveloper Oct 11, 2023
2ec9828
more direct ignore coverage
zdeveloper Oct 11, 2023
84b98a1
update snapshot
zdeveloper Oct 11, 2023
cb7cbe0
add more coverage and fix error message logic
zdeveloper Oct 12, 2023
e06c439
add more test coverage
zdeveloper Oct 12, 2023
a0a88d5
update snaps
zdeveloper Oct 12, 2023
04c1c1d
Revert storybook react-docgen config
mpbrown Oct 13, 2023
631edd3
Cleanup comments and unused variables
mpbrown Oct 13, 2023
e0dad05
Move modals to individual files
mpbrown Oct 13, 2023
152a0dd
Use covid AOE for devices w/o disease info
mpbrown Oct 16, 2023
d3dc675
Fix AOE symptoms boolean quote bug
mpbrown Oct 16, 2023
d4ea639
Fix track AOE test and snapshots
mpbrown Oct 17, 2023
c9af83c
Fix check if AOE answers completed
mpbrown Oct 17, 2023
09ad5e7
Update snapshot
mpbrown Oct 17, 2023
1ffdf86
Update test to use async find instead of get
mpbrown Oct 17, 2023
e492d68
Enable test card refactor in training
mpbrown Oct 18, 2023
b3dac87
set fixed date for now on test-queue test
zdeveloper Oct 18, 2023
a3332db
Reset startTestPatientId in error catch
mpbrown Oct 20, 2023
1bdf159
Merge remote-tracking branch 'origin/mike/6079-refactor-test-card' in…
mpbrown Oct 20, 2023
737d4e9
Update accessibility attributes
mpbrown Oct 23, 2023
49cb874
Filter rsv devices on test card
mpbrown Oct 23, 2023
66881f6
Update snapshots
mpbrown Oct 23, 2023
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
2 changes: 2 additions & 0 deletions backend/src/main/resources/application-azure-demo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ simple-report:
- https://demo.simplereport.gov
twilio:
enabled: false
features:
testCardRefactorEnabled: false
DanielSass marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions backend/src/main/resources/application-azure-stg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ simple-report:
- https://stg.simplereport.gov
experian:
enabled: true
features:
testCardRefactorEnabled: false
2 changes: 2 additions & 0 deletions backend/src/main/resources/application-azure-training.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ simple-report:
- https://training.simplereport.gov
twilio:
enabled: false
features:
testCardRefactorEnabled: true
4 changes: 3 additions & 1 deletion backend/src/main/resources/application-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,6 @@ simple-report-initialization:
test-ordered-loinc-code: "94558-4"
datahub:
url: "http://invalidhost:8080"
api-key: "placeholder"
api-key: "placeholder"
features:
testCardRefactorEnabled: false
1 change: 0 additions & 1 deletion frontend/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { resolve } = require("path");
module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
Expand Down
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@
"coveragePathIgnorePatterns": [
"<rootDir>/src/index.tsx",
"<rootDir>/src/serviceWorker.ts",
".stories.tsx"
".stories.tsx",
"<rootDir>/src/app/testQueue/constants.ts",
"<rootDir>/src/patientApp/timeOfTest/constants.ts"
]
}
}
3 changes: 2 additions & 1 deletion frontend/src/app/commonComponents/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export const TextInput = ({
labelClassName
)}
htmlFor={id}
id={`label-for-${id}`}
aria-describedby={ariaDescribedBy}
>
{required ? <Required label={label} /> : <Optional label={label} />}
Expand All @@ -112,7 +113,6 @@ export const TextInput = ({
"usa-input",
validationStatus === "error" && "usa-input--error"
)}
id={id}
data-testid={idString}
name={name}
value={value || ""}
Expand All @@ -135,6 +135,7 @@ export const TextInput = ({
? { "aria-describedby": `error_${id}`, "aria-invalid": true }
: null)}
{...registrationProps}
id={id}
/>
</div>
)}
Expand Down
26 changes: 10 additions & 16 deletions frontend/src/app/commonComponents/YesNoRadioGroup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import YesNoRadioGroup, {
boolToYesNoUnknown,
yesNoUnknownToBool,
} from "./YesNoRadioGroup";
import YesNoRadioGroup, { boolToYesNo, yesNoToBool } from "./YesNoRadioGroup";

describe("Yes/No/Unknown RadioGroup", () => {
describe("Yes/No RadioGroup", () => {
const onChangeFn = jest.fn(() => {});
const onBlurFn = jest.fn(() => {});

Expand Down Expand Up @@ -41,8 +38,6 @@ describe("Yes/No/Unknown RadioGroup", () => {
expect(onChangeFn).toHaveBeenCalledWith("YES");
await userEvent.click(screen.getByLabelText("No"));
expect(onChangeFn).toHaveBeenCalledWith("NO");
await userEvent.click(screen.getByLabelText("Unknown"));
expect(onChangeFn).toHaveBeenCalledWith("UNKNOWN");
});

it("calls function on blur", async () => {
Expand All @@ -53,19 +48,18 @@ describe("Yes/No/Unknown RadioGroup", () => {
expect(onBlurFn).toHaveBeenCalled();
});

describe("Yes/No/Unknown utility methods", () => {
describe("Yes/No utility methods", () => {
it("converts value to bool", () => {
expect(yesNoUnknownToBool("YES")).toBeTruthy();
expect(yesNoUnknownToBool("NO")).toBeFalsy();
expect(yesNoUnknownToBool("UNKNOWN")).toBeNull();
expect(yesNoToBool("YES")).toBeTruthy();
expect(yesNoToBool("NO")).toBeFalsy();
// @ts-ignore
expect(yesNoUnknownToBool(undefined)).toBeUndefined();
expect(yesNoToBool(undefined)).toBeUndefined();
});
it("converts bool to value", () => {
expect(boolToYesNoUnknown(true)).toBe("YES");
expect(boolToYesNoUnknown(false)).toBe("NO");
expect(boolToYesNoUnknown(null)).toBe("UNKNOWN");
expect(boolToYesNoUnknown(undefined)).toBeUndefined();
expect(boolToYesNo(true)).toBe("YES");
expect(boolToYesNo(false)).toBe("NO");
expect(boolToYesNo(null)).toBeUndefined();
expect(boolToYesNo(undefined)).toBeUndefined();
});
});
});
20 changes: 6 additions & 14 deletions frontend/src/app/commonComponents/YesNoRadioGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,33 @@ import { useTranslatedConstants } from "../constants";

import RadioGroup from "./RadioGroup";

export const boolToYesNoUnknown = (
export const boolToYesNo = (
value: boolean | null | undefined
): YesNoUnknown | undefined => {
): YesNo | undefined => {
if (value) {
return "YES";
}
if (value === false) {
return "NO";
}
if (value === null) {
return "UNKNOWN";
}
return undefined;
};

export const yesNoUnknownToBool = (
value: YesNoUnknown
): boolean | null | undefined => {
export const yesNoToBool = (value: YesNo): boolean | undefined => {
if (value === "YES") {
return true;
}
if (value === "NO") {
return false;
}
if (value === "UNKNOWN") {
return null;
}
return undefined;
};

interface Props {
name: string;
legend: React.ReactNode;
value: YesNoUnknown | undefined;
onChange: (value: YesNoUnknown) => void;
value: YesNo | undefined;
onChange: (value: YesNo) => void;
hintText?: string;
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
validationStatus?: "error" | "success";
Expand All @@ -57,7 +49,7 @@ const YesNoRadioGroup: React.FC<Props> = ({
errorMessage,
required,
}) => {
const { YES_NO_UNKNOWN_VALUES: values } = useTranslatedConstants();
const { YES_NO_VALUES: values } = useTranslatedConstants();

return (
<RadioGroup
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/app/patients/__snapshots__/EditPatient.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="103"
id="label-for-103"
>
First name
<abbr
Expand All @@ -129,6 +130,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="104"
id="label-for-104"
>
Middle name
</label>
Expand All @@ -148,6 +150,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="105"
id="label-for-105"
>
Last name
<abbr
Expand Down Expand Up @@ -1922,6 +1925,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="108"
id="label-for-108"
>
Date of birth (mm/dd/yyyy)
<abbr
Expand Down Expand Up @@ -2000,6 +2004,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="109"
id="label-for-109"
>
Primary phone number
<abbr
Expand Down Expand Up @@ -2191,6 +2196,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="112"
id="label-for-112"
>
Email address
</label>
Expand Down Expand Up @@ -3920,6 +3926,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="115"
id="label-for-115"
>
Street address 1
<abbr
Expand Down Expand Up @@ -3949,6 +3956,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="116"
id="label-for-116"
>
Street address 2
</label>
Expand All @@ -3971,6 +3979,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="117"
id="label-for-117"
>
City
<abbr
Expand All @@ -3996,6 +4005,7 @@ exports[`EditPatient facility select input matches screenshot 1`] = `
<label
class="usa-label"
for="118"
id="label-for-118"
>
County
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="41"
id="label-for-41"
>
Device Name
<abbr
Expand Down Expand Up @@ -328,6 +329,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="42"
id="label-for-42"
>
Model
<abbr
Expand Down Expand Up @@ -363,6 +365,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="43"
id="label-for-43"
>
Manufacturer
<abbr
Expand Down Expand Up @@ -398,6 +401,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="44"
id="label-for-44"
>
Test length (minutes)
<abbr
Expand Down Expand Up @@ -617,6 +621,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="47"
id="label-for-47"
>
Test performed code
<abbr
Expand Down Expand Up @@ -648,6 +653,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="48"
id="label-for-48"
>
Test ordered code
<abbr
Expand Down Expand Up @@ -679,6 +685,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="49"
id="label-for-49"
>
Testkit Name Id
</label>
Expand All @@ -703,6 +710,7 @@ exports[`update existing devices renders the Device Form 1`] = `
<label
class="usa-label"
for="50"
id="label-for-50"
>
Equipment Uid
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="1"
id="label-for-1"
>
Device Name
<abbr
Expand Down Expand Up @@ -126,6 +127,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="2"
id="label-for-2"
>
Model
<abbr
Expand Down Expand Up @@ -160,6 +162,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="3"
id="label-for-3"
>
Manufacturer
<abbr
Expand Down Expand Up @@ -194,6 +197,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="4"
id="label-for-4"
>
Test length (minutes)
<abbr
Expand Down Expand Up @@ -371,6 +375,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="7"
id="label-for-7"
>
Test performed code
<abbr
Expand Down Expand Up @@ -401,6 +406,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="8"
id="label-for-8"
>
Test ordered code
<abbr
Expand Down Expand Up @@ -431,6 +437,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="9"
id="label-for-9"
>
Testkit Name Id
</label>
Expand All @@ -454,6 +461,7 @@ exports[`DeviceTypeFormContainer should render the device type form 1`] = `
<label
class="usa-label"
for="10"
id="label-for-10"
>
Equipment Uid
</label>
Expand Down
Loading
Loading