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

mdct-2555 fix submitAndUncertify e2e #139411

Merged
merged 10 commits into from
Jul 24, 2023
27 changes: 24 additions & 3 deletions tests/cypress/tests/integration/submitAndUncertify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,30 @@ const uncertifyButton = "[data-testid='uncertifyButton']";
describe("CARTS Submit and Uncertify Integration Tests", () => {
before(() => {
cy.visit("/");

// login as admin
cy.authenticate("adminUser");
/*
* check if there is a certified program, if so, uncertify
* so state user will always have an editable program
*/
cy.wait(15000);

cy.get("body").then(($body) => {
if ($body.text().includes("Uncertify")) {
cy.wait(3000);
cy.get(uncertifyButton).first().click();
cy.get("button").contains("Yes, Uncertify").click();
}
return;
});

cy.wait(3000);
cy.get(headerDropdownMenu).click();
cy.get(logoutButton).click();
});

it("Should submit form as a State User", () => {
it("Should submit form as a State User and uncertify as a Reviewer", () => {
// log in as State User
cy.authenticate("stateUser");

Expand All @@ -25,8 +46,8 @@ describe("CARTS Submit and Uncertify Integration Tests", () => {
cy.get(headerDropdownMenu).click();
cy.get(logoutButton).click();

// log in as CMS User (Reviewer)
cy.authenticate("reviewer");
// log in as CMS Admin (user who can uncertify)
cy.authenticate("adminUser");

// uncertify report
cy.get(uncertifyButton).first().contains("Uncertify").click();
Expand Down
Loading