Skip to content

Commit

Permalink
test → val (#11624)
Browse files Browse the repository at this point in the history
  • Loading branch information
karla-vm committed Mar 12, 2024
2 parents e1da17b + b28407f commit 5cbffed
Show file tree
Hide file tree
Showing 9 changed files with 180 additions and 63 deletions.
56 changes: 39 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ jobs:
application_endpoint: ${{ steps.endpoint.outputs.application_endpoint}}
BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION: ${{ steps.set_names.outputs.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION }}
BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME: ${{ steps.set_names.outputs.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME }}
# ipset_name: ${{ steps.fetch-ip-set-info.outputs.IPSET_NAME }}
# ipset_id: ${{ steps.fetch-ip-set-info.outputs.IPSET_ID }}

e2e-test:
name: E2E Integration Tests
needs: deploy
if: ${{ github.ref_name != 'production' }}
register-runner:
name: Register GitHub Runner
if: ${{ github.ref_name != 'main' && github.ref_name != 'val' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
needs: deploy
env:
SLS_DEPRECATION_DISABLE: "*" # Turn off deprecation warnings in the pipeline
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
#!/bin/bash
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
echo "Current Account ID: ${AWS_ACCOUNT_ID}"
- name: Get Github Actions CIDR Blocks
id: get-gha-cidrs
shell: bash
Expand All @@ -191,7 +191,7 @@ jobs:
echo "Github IP Set name: $STAGE_GH_IPSET_NAME"
echo "STAGE_GH_IPSET_NAME=$STAGE_GH_IPSET_NAME" >> $GITHUB_OUTPUT
- name: Fetch AWS IP set Metadata
- name: Fetch AWS IP Set Metadata
id: fetch-ip-set-info
run: |
#!/bin/bash
Expand All @@ -216,6 +216,22 @@ jobs:
AWS_RETRY_MODE: adaptive
AWS_MAX_ATTEMPTS: 10

outputs:
ipset_name: ${{ steps.fetch-ip-set-info.outputs.IPSET_NAME }}
ipset_id: ${{ steps.fetch-ip-set-info.outputs.IPSET_ID }}


e2e-test:
name: E2E Integration Tests
needs:
- deploy
- register-runner
if: ${{ always() && !cancelled() && needs.deploy.result == 'success' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Cypress Tests
uses: cypress-io/github-action@v5
with:
Expand All @@ -241,14 +257,14 @@ jobs:
path: |
tests/cypress/screenshots/
tests/cypress/videos/
outputs:
ipset_name: ${{ steps.fetch-ip-set-info.outputs.IPSET_NAME }}
ipset_id: ${{ steps.fetch-ip-set-info.outputs.IPSET_ID }}
a11y-tests:
name: E2E A11y Tests
needs: deploy
if: ${{ github.ref_name != 'production' }}
needs:
- deploy
- register-runner
if: ${{ always() && !cancelled() && needs.deploy.result == 'success' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -281,24 +297,30 @@ jobs:
cleanup:
name: Delist GHA Runner CIDR Blocks
if: ${{ github.ref != 'refs/heads/production' }}
if: ${{ github.ref_name != 'main' && github.ref_name != 'val' && github.ref_name != 'production' }}
runs-on: ubuntu-latest
needs:
- deploy
- register-runner
- a11y-tests
- e2e-test
env:
SLS_DEPRECATION_DISABLE: "*" # Turn off deprecation warnings in the pipeline
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_OIDC_ROLE_TO_ASSUME] || secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }}
- name: output account id
id: output_account_id
run: |
#!/bin/bash
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
echo "Current Account ID: ${AWS_ACCOUNT_ID}"
- name: cleanup-ip-list
id: reset-ip-set
run: ./.github/waf-controller.sh set ${{ needs.e2e-test.outputs.ipset_name }} ${{ needs.e2e-test.outputs.ipset_id }} '[]'
run: ./.github/waf-controller.sh set ${{ needs.register-runner.outputs.ipset_name }} ${{ needs.register-runner.outputs.ipset_id }} '[]'
env:
AWS_RETRY_MODE: adaptive
AWS_MAX_ATTEMPTS: 10
16 changes: 8 additions & 8 deletions services/app-api/forms/mcpar.json
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Network Adequacy"
}
]
Expand Down Expand Up @@ -1006,7 +1006,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Access Measures"
},
{
Expand Down Expand Up @@ -1753,7 +1753,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Appeals Overview"
}
]
Expand Down Expand Up @@ -1957,7 +1957,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Appeals by Service"
},
{
Expand Down Expand Up @@ -2111,7 +2111,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "State Fair Hearings"
}
]
Expand Down Expand Up @@ -2217,7 +2217,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Grievances Overview"
}
]
Expand Down Expand Up @@ -2312,7 +2312,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Grievances by Service"
},
{
Expand Down Expand Up @@ -2472,7 +2472,7 @@
"info": [
{
"type": "heading",
"as": "h3",
"as": "h4",
"content": "Grievances by Reason"
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { render, screen } from "@testing-library/react";
import { EntityCardTopSection } from "./EntityCardTopSection";

jest.mock("utils/state/useStore");

const formattedEntityData = {
category: "LTSS-related standard: provider travels to the enrollee",
methodFrequency: "Annually",
monitoringMethods: [],
population: "MLTSS",
provider: "Behavioral health",
region: "Small counties",
standardDescription: "fdsfds",
standardType: "Maximum distance to travel",
};

const entityCardTopSectionComponent = (
<EntityCardTopSection
entityType="accessMeasures"
formattedEntityData={formattedEntityData}
printVersion={true}
/>
);

describe("Test EntityCardTopSection renders", () => {
beforeEach(() => {
window.location.pathname === "/mcpar/export";
});
test("EntityCardTopSection renders correctly", () => {
render(entityCardTopSectionComponent);
expect(screen.getByText("fdsfds")).toBeVisible();
});

test("EntityCardTopSection header renders p tag wrapper in PDF report", () => {
window.history.pushState(
{},
"",
new URL("/mcpar/export", window.location.origin)
);
const { container } = render(entityCardTopSectionComponent);
const pTag = container.querySelectorAll("p")[0];
expect(pTag).toHaveTextContent(
"C2.V.1 General category: LTSS-related standard"
);
});

test("EntityCardTopSection header renders h4 tag wrapper in report", () => {
window.history.pushState({}, "", new URL(window.location.origin));
const { container } = render(entityCardTopSectionComponent);
const h4Tag = container.querySelector("h4");
screen.debug(container);
expect(h4Tag).toHaveTextContent(
"C2.V.1 General category: LTSS-related standard"
);
});
});
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useState, useEffect } from "react";
// components
import { Grid, GridItem, Heading, Text } from "@chakra-ui/react";
// utils
Expand All @@ -8,11 +9,19 @@ export const EntityCardTopSection = ({
formattedEntityData,
printVersion,
}: Props) => {
const [isPDF, setIsPDF] = useState(false);

useEffect(() => {
if (window.location.pathname === "/mcpar/export") {
setIsPDF(true);
}
}, []);

switch (entityType) {
case ModalDrawerEntityTypes.ACCESS_MEASURES:
return (
<>
<Heading as="h4" sx={sx.heading}>
<Heading as={isPDF ? "p" : "h4"} sx={sx.heading}>
{`${printVersion ? "C2.V.1 General category: " : ""}${
formattedEntityData.category
}`}
Expand All @@ -32,7 +41,7 @@ export const EntityCardTopSection = ({
case ModalDrawerEntityTypes.SANCTIONS:
return (
<>
<Heading as="h4" sx={sx.heading}>
<Heading as={isPDF ? "p" : "h4"} sx={sx.heading}>
{`${printVersion ? "D3.VIII.1 Intervention type: " : ""}${
formattedEntityData.interventionType
}`}
Expand Down Expand Up @@ -64,7 +73,7 @@ export const EntityCardTopSection = ({
case ModalDrawerEntityTypes.QUALITY_MEASURES:
return (
<>
<Heading as="h4" sx={sx.heading}>
<Heading as={isPDF ? "p" : "h4"} sx={sx.heading}>
{`${printVersion ? "D2.VII.1 Measure Name: " : ""}${
formattedEntityData.name
}`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useContext } from "react";
// components
import { Box, Heading, Text } from "@chakra-ui/react";
import { Box, Text } from "@chakra-ui/react";
import { EntityCard, ReportContext } from "components";
// utils
import { getFormattedEntityData } from "utils";
Expand All @@ -22,14 +22,14 @@ export const ExportedModalDrawerReportSection = ({
data-testid="exportedModalDrawerReportSection"
sx={sx.container}
>
<Heading as="h3" sx={sx.dashboardTitle} data-testid="headerCount">
<Text as="p" sx={sx.dashboardTitle} data-testid="headerCount">
{`${verbiage.dashboardTitle} ${entityCount > 0 ? entityCount : ""}`}
{!entityCount && (
<Text as="span" sx={sx.notAnswered} data-testid="entityMessage">
{emptyEntityMessage[entityType as keyof typeof emptyEntityMessage]}
</Text>
)}
</Heading>
</Text>
{entities?.map((entity: EntityShape, entityIndex: number) => (
<EntityCard
key={entity.id}
Expand Down Expand Up @@ -70,6 +70,5 @@ const sx = {
marginBottom: "1.25rem",
fontSize: "md",
fontWeight: "bold",
color: "palette.gray_medium",
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const ExportedReportFieldRow = ({
</Td>

{/* data column/cell */}
<Td>
<Td sx={sx.dataColumn}>
{reportData &&
isFieldElement(formField) &&
renderDataCell(
Expand Down Expand Up @@ -109,4 +109,7 @@ const sx = {
lineHeight: "lg",
color: "palette.gray_medium",
},
dataColumn: {
maxWidth: "20rem",
},
};
Loading

0 comments on commit 5cbffed

Please sign in to comment.