-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
fbd5999
commit 940060a
Showing
2 changed files
with
53 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 15 additions & 40 deletions
55
tests/cypress/tests/integration/submitAndUncertify.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,43 @@ | ||
// element selectors | ||
const logoutButton = "[data-testid='header-menu-option-log-out']"; | ||
const headerDropdownMenu = "[data-testid='headerDropDownMenu']"; | ||
const actionButton = "[data-testid='report-action-button']"; | ||
const certifySubmitButton = "[data-testid='certifySubmit']"; | ||
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 and uncertify as a Reviewer", () => { | ||
cy.ensureAvailableReport(); // Needs to happen each iteration of the test | ||
|
||
// log in as State User | ||
cy.authenticate("stateUser"); | ||
|
||
// certify and submit report | ||
cy.get(actionButton, { timeout: 30000 }).contains("Edit").click(); | ||
cy.wait(3000); | ||
cy.contains("Certify and Submit").click(); | ||
cy.wait(3000); | ||
|
||
cy.get(certifySubmitButton).click(); | ||
cy.get("button").contains("Confirm Certify and Submit").click(); | ||
cy.get("button").contains("Return Home").click(); | ||
|
||
// log out | ||
cy.get(headerDropdownMenu).click(); | ||
cy.get(logoutButton).click(); | ||
cy.logout(); | ||
|
||
// log in as CMS Admin (user who can uncertify) | ||
cy.authenticate("adminUser"); | ||
|
||
// uncertify report | ||
// uncertify report - Scope to test user's state | ||
cy.get(".dropdown-heading").first().click(); | ||
cy.contains("Alabama").click(); | ||
cy.get("body").click(0, 0); | ||
cy.get(".filter-button").contains("Filter").click(); | ||
cy.wait(3000); | ||
|
||
cy.get(uncertifyButton).first().contains("Uncertify").click(); | ||
cy.get("button").contains("Yes, Uncertify").click(); | ||
|
||
cy.wait(3000); | ||
|
||
// log back out | ||
cy.get(headerDropdownMenu).click(); | ||
cy.get(logoutButton).click(); | ||
cy.logout(); | ||
|
||
// log back in as State User | ||
// log back in as State User - the report should be "In Progress" again | ||
cy.authenticate("stateUser"); | ||
|
||
// the report should be "In Progress" again | ||
cy.get(actionButton).contains("Edit").should("be.visible"); | ||
}); | ||
}); |