Skip to content

Commit

Permalink
merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
britt-mo committed Dec 9, 2024
2 parents c1ef66d + e484640 commit fe3cbb0
Show file tree
Hide file tree
Showing 21 changed files with 389 additions and 112 deletions.
4 changes: 2 additions & 2 deletions .env.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ TEST_ADMIN_USER_EMAIL=op://mdct_devs/mcr_secrets/CYPRESS_ADMIN_USER_EMAIL
TEST_ADMIN_USER_PASSWORD=op://mdct_devs/mcr_secrets/CYPRESS_ADMIN_USER_PASSWORD # pragma: allowlist secret
TEST_STATE_USER_EMAIL=op://mdct_devs/mcr_secrets/CYPRESS_STATE_USER_EMAIL
TEST_STATE_USER_PASSWORD=op://mdct_devs/mcr_secrets/CYPRESS_STATE_USER_PASSWORD # pragma: allowlist secret
TEST_STATE=MN
TEST_STATE=Minnesota
TEST_STATE=DC
TEST_STATE_NAME="District of Columbia"
5 changes: 4 additions & 1 deletion services/app-api/forms/mcpar.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
},
{
"type": "html",
"content": "See Glossary in Excel Workbook for the definition of BSS entities."
"content": ". See Glossary in Excel Workbook for the definition of BSS entities."
}
]
},
Expand Down Expand Up @@ -637,6 +637,7 @@
},
{
"name": "XIII: Prior Authorization",
"flag": "novMcparRelease",
"path": "/mcpar/state-level-indicators/prior-authorization",
"pageType": "standard",
"verbiage": {
Expand Down Expand Up @@ -4267,6 +4268,7 @@
},
{
"name": "XIII: Prior Authorization",
"flag": "novMcparRelease",
"path": "/mcpar/plan-level-indicators/prior-authorization",
"pageType": "drawer",
"entityType": "plans",
Expand Down Expand Up @@ -4488,6 +4490,7 @@
},
{
"name": "XIV: Patient Access API Usage",
"flag": "novMcparRelease",
"path": "/mcpar/plan-level-indicators/patient-access-api",
"pageType": "drawer",
"entityType": "plans",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
mockStandardReportPageJson,
mockMlrReportStore,
mockMcparReportStore,
mockVerbiageIntro,
mockDrawerForm,
} from "utils/testing/setupJest";
import { useStore } from "utils";
// components
Expand Down Expand Up @@ -73,6 +75,18 @@ const mockDrawerPageJson = {
...mockDrawerReportPageJson,
drawerForm: { id: "drawer", fields: reportJsonFields },
};
const mockMissingPlansPageJson = {
name: "mock-route-2a",
path: "/mcpar/plan-level-indicators/ilos",
pageType: "drawer",
entityType: "plans",
verbiage: {
intro: mockVerbiageIntro,
dashboardTitle: "Mock dashboard title",
drawerTitle: "Mock drawer title",
},
drawerForm: mockDrawerForm,
};
const mockEmptyPageJson = {
...mockStandardReportPageJson,
form: {
Expand Down Expand Up @@ -115,11 +129,19 @@ const hintJson = {
const exportedStandardTableComponent = (
<ExportedReportFieldTable section={mockStandardPageJson} />
);

const exportedDrawerTableComponent = (
<ExportedReportFieldTable
section={mockDrawerPageJson as DrawerReportPageShape}
/>
);

const exportedMissingEntitiesComponent = (
<ExportedReportFieldTable
section={mockMissingPlansPageJson as DrawerReportPageShape}
/>
);

const emptyTableComponent = (
<ExportedReportFieldTable section={mockEmptyPageJson} />
);
Expand All @@ -141,6 +163,21 @@ describe("ExportedReportFieldRow", () => {
expect(row).toBeVisible();
});

test("handles drawer pages with missing plans", async () => {
const missingEntitiesStore = {
...mockMcparReportStore,
report: {
fieldData: {},
},
};
mockedUseStore.mockReturnValue({
...missingEntitiesStore,
});
render(exportedMissingEntitiesComponent);
const row = screen.getByTestId("missingEntityMessage");
expect(row).toBeVisible();
});

test("handles a table with no form fields", async () => {
render(emptyTableComponent);
const row = screen.getByTestId("exportTable");
Expand Down
43 changes: 29 additions & 14 deletions services/ui-src/src/components/export/ExportedReportFieldTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
FormLayoutElement,
isFieldElement,
ReportType,
entityTypes,
} from "types";
// verbiage
import verbiage from "verbiage/pages/mcpar/mcpar-export";
Expand Down Expand Up @@ -45,24 +46,39 @@ export const ExportedReportFieldTable = ({ section }: Props) => {
const reportType = report?.reportType as ReportType;
const hideHintText = reportType === ReportType.MLR;

// handle ILOS rendering logic
const renderIlosVerbiage = () => {
const hasIlos = report?.fieldData["ilos"]?.length;
return section.path === "/mcpar/plan-level-indicators/ilos" && !hasIlos;
};

const hasPlans = report?.fieldData["plans"]?.length;
const hasIlos = report?.fieldData["ilos"]?.length;
const hasBss = report?.fieldData["bssEntities"]?.length;

// handle missing plans / ilos rendering logic
const renderMissingEntityVerbiage = () => {
const { path, verbiage: v } = section as DrawerReportPageShape;

// verbiage for ILOS
if (path === "/mcpar/plan-level-indicators/ilos" && !hasIlos) {
return !hasPlans ? v.missingPlansAndIlosMessage : v.missingIlosMessage;
}

const missingVerbiage = !hasPlans
? (section as DrawerReportPageShape).verbiage.missingPlansAndIlosMessage
: (section as DrawerReportPageShape).verbiage.missingIlosMessage;
// verbiage for missing plans
return !hasPlans ? v.missingEntityMessage : undefined;
};

const missingPlansOrIlos = !(hasIlos || hasPlans);

return (
// if there are no ILOS added, render the appropriate verbiage
// if there are no plans added, render the appropriate verbiage
<Box>
{renderIlosVerbiage() ? (
<Box sx={sx.missingEntityMessage}>
{parseCustomHtml(missingVerbiage ?? "")}
{entityType === entityTypes[0] && missingPlansOrIlos ? (
<Box sx={sx.missingEntityMessage} data-testid="missingEntityMessage">
{parseCustomHtml(renderMissingEntityVerbiage() || "")}
</Box>
) : entityType === entityTypes[1] && !hasBss ? (
// if there are no BSS entities added, render the appropriate verbiage
<Box sx={sx.missingEntityMessage} data-testid="missingEntityMessage">
{parseCustomHtml(
(section as DrawerReportPageShape).verbiage.missingEntityMessage ||
""
)}
</Box>
) : (
<Table
Expand Down Expand Up @@ -222,7 +238,6 @@ const sx = {
},
missingEntityMessage: {
fontWeight: "bold",

ol: {
paddingLeft: "1rem",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const sx = {
p: {
margin: "1.5rem 0",
},
a: {
color: "palette.base",
textDecoration: "none",
"&:hover": {
color: "palette.base",
textDecoration: "none",
},
},
h3: {
fontSize: "xl",
},
Expand Down
19 changes: 5 additions & 14 deletions services/ui-src/src/utils/other/export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,15 @@ export const renderResponseData = (

const missingEntryStyle = notApplicable ? sx.notApplicable : sx.noResponse;

if (!hasResponse && !isChoiceListField) {
return <Text sx={missingEntryStyle}>{missingEntryVerbiage}</Text>;
// need to explicitly make this else if conditional so
}

if (
!hasResponse &&
isChoiceListField &&
formField.id !== "plan_ilosOfferedByPlan"
) {
if (!hasResponse) {
const isIlos = formField.id === "plan_ilosOfferedByPlan";
return (
<Text
sx={sx.noResponseOptional}
>{`${verbiage.missingEntry.noResponse}, optional`}</Text>
!isIlos && <Text sx={missingEntryStyle}>{missingEntryVerbiage}</Text>
);
// need to explicitly make this else if conditional so
}

// chandle choice list fields (checkbox, radio)
// handle choice list fields (checkbox, radio)
if (isChoiceListField) {
return renderChoiceListFieldResponse(
formField,
Expand Down
31 changes: 16 additions & 15 deletions tests/cypress/e2e/mcpar/form.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,7 @@ const traverseRoutes = (routes) => {
});
};

const traverseRoute = (route) => {
/*
* TODO: account for flag status
*
* if (
* [
* "/mcpar/plan-level-indicators/patient-access-api",
* "/mcpar/plan-level-indicators/prior-authorization",
* "/mcpar/state-level-indicators/prior-authorization",
* ].includes(route.path)
* ) {
* return;
* }
*/

const continueTraversing = (route) => {
//only perform checks on route if it contains some time of form fill
if (route.form || route.modalForm || route.drawerForm) {
//validate we are on the URL we expect to be
Expand All @@ -166,6 +152,21 @@ const traverseRoute = (route) => {
if (route.children) traverseRoutes(route.children);
};

const traverseRoute = (route) => {
if (route.flag) {
cy.intercept(/launchdarkly/).as("ld");
cy.wait("@ld").then(({ request }) => {
const flags = request.body[0].features;
if (!flags[route.flag]) {
return;
}
continueTraversing(route);
});
} else {
continueTraversing(route);
}
};

const completeDrawerForm = (drawerForm) => {
if (drawerForm) {
//enter the drawer, then fill out the form and save it
Expand Down
6 changes: 3 additions & 3 deletions tests/playwright/pages/banner.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { test, expect } from "../utils/fixtures/base";
import BannerPage from "../utils/pageObjects/banner.page";
import { expect, test } from "../utils/fixtures/base";
import { BannerPage, stateUserAuth } from "../utils";

test.describe("admin user banner page", () => {
test("Should see the correct banner page as an admin user", async ({
Expand Down Expand Up @@ -34,7 +34,7 @@ test.describe("admin user banner page", () => {
profilePage,
}) => {
const userContext = await browser.newContext({
storageState: ".auth/user.json",
storageState: stateUserAuth,
});
await profilePage.goto();
const newBannerPage = new BannerPage(await userContext.newPage());
Expand Down
9 changes: 5 additions & 4 deletions tests/playwright/pages/home.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { test, expect } from "../utils/fixtures/base";
import BasePage from "../utils/pageObjects/base.page";
import { expect, test } from "../utils/fixtures/base";
import { BasePage } from "../utils";

test.describe("state user home page", () => {
test("Should see the correct home page as a state user", async ({
stateHomePage,
}) => {
await stateHomePage.goto();
await stateHomePage.isReady();
await expect(stateHomePage.wpButton).toBeVisible();
await expect(stateHomePage.sarButton).toBeVisible();
await expect(stateHomePage.mcparButton).toBeVisible();
await expect(stateHomePage.mlrButton).toBeVisible();
await expect(stateHomePage.naaarButton).toBeVisible();
});

test("Is accessible on all device types for state user", async ({
Expand Down
72 changes: 72 additions & 0 deletions tests/playwright/pages/mcpar/dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { expect, test } from "../../utils/fixtures/base";
import { stateName } from "../../utils";

let currentDate = "";
let programName = "";
let updatedProgramName = "";

test.beforeAll(async () => {
currentDate = new Date().toISOString();
programName = `automated test - ${currentDate}`;
updatedProgramName = `Updated: ${programName}`;
});

test.describe(
"MCPAR Dashboard Page - Program Creation/Editing/Archiving",
() => {
test("State users can create and edit reports", async ({
mcparDashboardPage,
mcparGetStartedPage,
stateHomePage,
}) => {
await stateHomePage.goto();
await stateHomePage.isReady();

await stateHomePage.mcparButton.isVisible();
await stateHomePage.mcparButton.click();
await stateHomePage.redirectPage("/mcpar/get-started");

await mcparGetStartedPage.mcparButton.isVisible();
await mcparGetStartedPage.mcparButton.click();
await mcparGetStartedPage.redirectPage("/mcpar");

const originalRow = mcparDashboardPage.table.getByRole("row", {
name: programName,
});
const updatedRow = mcparDashboardPage.table.getByRole("row", {
name: updatedProgramName,
});

// Create MCPAR
await mcparDashboardPage.create(programName);
await expect(originalRow).toBeVisible();
await expect(updatedRow).toBeHidden();

// Update MCPAR
await mcparDashboardPage.update(programName, updatedProgramName);
await expect(originalRow).toBeHidden();
await expect(updatedRow).toBeVisible();
});

test("Admin users can archive/unarchive reports", async ({
adminHomePage,
}) => {
await adminHomePage.archiveMCPAR(stateName, updatedProgramName);
await adminHomePage.unarchiveMCPAR(stateName, updatedProgramName);
});

test("State users can't see archived programs", async ({
adminHomePage,
mcparDashboardPage,
}) => {
await adminHomePage.archiveMCPAR(stateName, updatedProgramName);

await mcparDashboardPage.goto();
await mcparDashboardPage.isReady();
await mcparDashboardPage.table.isVisible();
await expect(
mcparDashboardPage.table.getByRole("row", { name: updatedProgramName })
).toBeHidden();
});
}
);
Loading

0 comments on commit fe3cbb0

Please sign in to comment.