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

Mcpar form e2e fix #11935

Merged
merged 39 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1f25617
validateDOMnesting console error fix
britt-mo Jul 16, 2024
a212be7
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Jul 18, 2024
66f35cf
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Jul 22, 2024
acc67b2
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Jul 24, 2024
ff9c461
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Aug 1, 2024
696609d
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Aug 9, 2024
7773cc0
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Aug 13, 2024
08bee35
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Aug 20, 2024
421c436
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Aug 28, 2024
6478fb8
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Sep 19, 2024
b973df2
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 3, 2024
4787fbf
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 8, 2024
84715dd
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 8, 2024
416b351
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 15, 2024
4fe6762
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 21, 2024
d087628
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 22, 2024
2ebb048
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 24, 2024
29dd81e
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Oct 28, 2024
e082d06
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Nov 6, 2024
e3f313c
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Nov 7, 2024
8c388b8
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Nov 18, 2024
8f1e141
Merge branch 'main' of https://github.com/Enterprise-CMCS/macpro-mdct…
britt-mo Nov 20, 2024
72ca351
update to mcpar form test
britt-mo Nov 21, 2024
08e9f13
update to MLR form test
britt-mo Nov 21, 2024
40b09a9
another change please let this commit be green
britt-mo Nov 21, 2024
a8b48f8
Break this chain
bangbay-bluetiger Nov 22, 2024
8907029
Break more chains
bangbay-bluetiger Nov 22, 2024
2ed787f
Typo
bangbay-bluetiger Nov 22, 2024
7d886c9
Wait wait
bangbay-bluetiger Nov 22, 2024
201c2a8
Get last
bangbay-bluetiger Nov 22, 2024
bcea744
Get first
bangbay-bluetiger Nov 22, 2024
84f6f22
Revert for a sec
bangbay-bluetiger Nov 22, 2024
9730cea
Don't wait for animation on continue
bangbay-bluetiger Nov 22, 2024
f3f29a4
Use mcpar.json
bangbay-bluetiger Nov 22, 2024
de56a7c
Remove waitForAnimation: false
bangbay-bluetiger Nov 22, 2024
80e5f2f
Wait
bangbay-bluetiger Nov 23, 2024
debe728
Wait
bangbay-bluetiger Nov 23, 2024
ddb149a
Exclude routes
bangbay-bluetiger Nov 23, 2024
23f5184
Another wait
bangbay-bluetiger Nov 23, 2024
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
75 changes: 57 additions & 18 deletions tests/cypress/e2e/mcpar/form.cy.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import mcparTemplate from "../mcpar/mcpar-copy.json";
import mcparTemplate from "../../../../services/app-api/forms/mcpar.json";

const templateMap = { MCPAR: mcparTemplate };

Expand All @@ -14,14 +14,19 @@ describe("MCPAR E2E Form Submission", () => {

//no errors; submit enabled
cy.get('div[role*="alert"]').should("not.exist");
cy.get(`button:contains("Submit MCPAR")`).should("not.be.disabled");
cy.get('button:contains("Submit MCPAR")').should("not.be.disabled");

//Submit the program
cy.get(`button:contains("Submit MCPAR")`).focus().click();
cy.get('[data-testid="modal-submit-button"]').focus().click();
cy.get('button:contains("Submit MCPAR")').as("mcparSubmitButton").focus();
cy.get("@mcparSubmitButton").click();
cy.get('[data-testid="modal-submit-button"]')
.as("mcparModalSubmitButton")
.focus();
cy.get("@mcparModalSubmitButton").click();

cy.contains("Successfully Submitted").should("be.visible");
cy.get("a:contains('Leave form')").focus().click();
cy.get("a:contains('Leave form')").as("mcparLinkFormLink").focus();
cy.get("@mcparLinkFormLink").click();
cy.url().should("include", "/mcpar");
});

Expand Down Expand Up @@ -62,12 +67,14 @@ function fillOutMCPAR() {

//Find our new program and open it
cy.get("table").within(() => {
cy.wait(2000);
cy.get("td")
.contains(programName)
.parent()
.find('button:contains("Edit")')
.focus()
.click();
.as("mcparEditButton")
.focus();
cy.get("@mcparEditButton").click();
});

//Using the json as a guide, traverse all the routes/forms and fill it out dynamically
Expand Down Expand Up @@ -101,8 +108,9 @@ function fillOutPartialMCPAR() {
.contains(programName)
.parent()
.find('button:contains("Edit")')
.focus()
.click();
.as("mcparPartialEditButton")
.focus();
cy.get("@mcparPartialEditButton").click();
});
//Using the json as a guide, traverse all the routes/forms and fill it out dynamically
const template = templateMap["MCPAR"];
Expand All @@ -121,6 +129,17 @@ const traverseRoutes = (routes) => {
};

const traverseRoute = (route) => {
// TODO: Don't just skip these routes
if (
[
"/mcpar/plan-level-indicators/patient-access-api",
"/mcpar/plan-level-indicators/prior-authorization",
"/mcpar/state-level-indicators/prior-authorization",
].includes(route.path)
) {
return;
}

//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 @@ -132,35 +151,55 @@ const traverseRoute = (route) => {
cy.contains(route.verbiage?.intro?.subsection);

//Fill out the 3 different types of forms
completeFrom(route.form);
completeForm(route.form);
completeModalForm(route.modalForm, route.verbiage?.addEntityButtonText);
completeDrawerForm(route.drawerForm);

cy.get('button:contains("Continue")').focus().click();
cy.get('button:contains("Continue")').as("mcparContinueButton").focus();
cy.get("@mcparContinueButton").click();
}

//If this route has children routes, traverse those as well
if (route.children) traverseRoutes(route.children);
};

const completeDrawerForm = (drawerForm) => {
if (drawerForm) {
//enter the drawer, then fill out the form and save it
cy.get('button:contains("Enter")').focus().click();
completeFrom(drawerForm);
cy.get('button:contains("Save")').focus().click();
cy.get('button:contains("Enter")').then(($editButton) => {
if ($editButton.is(":disabled")) {
return;
} else {
cy.wrap($editButton).focus();
cy.get($editButton).click();
completeForm(drawerForm);
cy.get('button:contains("Save")')
.as("mcparCompleteDrawerSaveButton")
.focus();
cy.get("@mcparCompleteDrawerSaveButton").click();
cy.wait(1000);
}
});
}
};

const completeModalForm = (modalForm, buttonText) => {
//open the modal, then fill out the form and save it
if (modalForm && buttonText) {
cy.get(`button:contains("${buttonText}")`).focus().click();
completeFrom(modalForm);
cy.get('button:contains("Save")').focus().click();
cy.get(`button:contains("${buttonText}")`)
.as("mcparCompleteModalButton")
.focus();
cy.get("@mcparCompleteModalButton").click();
completeForm(modalForm);
cy.get('button:contains("Save")')
.as("mcparCompleteModalSaveButton")
.focus();
cy.get("@mcparCompleteModalSaveButton").click();
cy.wait(1000);
}
};

const completeFrom = (form) => {
const completeForm = (form) => {
//iterate over each field and fill it appropriately
form?.fields?.forEach((field) => processField(field));
};
Expand Down
Loading