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] Stabilize carts e2e smoke test #139420

Merged
merged 6 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 2 additions & 0 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const reviewer = {
};

Cypress.Commands.add("authenticate", (userType, userCredentials) => {
cy.reload();
let credentials = {};
if (userType && userCredentials) {
console.warn(
Expand Down Expand Up @@ -54,6 +55,7 @@ Cypress.Commands.add("authenticate", (userType, userCredentials) => {
cy.xpath(emailForCognito).type(credentials.email);
cy.xpath(passwordForCognito).type(credentials.password);
cy.get('[data-cy="login-with-cognito-button"]').click();
cy.wait(3000);
});

// Define at the top of the spec file or just import it
Expand Down
25 changes: 21 additions & 4 deletions tests/cypress/tests/integration/submitAndUncertify.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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("/");
Expand All @@ -18,8 +17,14 @@ describe("CARTS Submit and Uncertify Integration Tests", () => {
cy.wait(15000);

cy.get("body").then(($body) => {
if ($body.text().includes("Uncertify")) {
cy.wait(3000);
// 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);

if ($body.find(uncertifyButton).length > 0) {
cy.get(uncertifyButton).first().click();
cy.get("button").contains("Yes, Uncertify").click();
}
Expand All @@ -29,6 +34,7 @@ describe("CARTS Submit and Uncertify Integration Tests", () => {
cy.wait(3000);
cy.get(headerDropdownMenu).click();
cy.get(logoutButton).click();
cy.wait(3000); // let logout settle
});

it("Should submit form as a State User and uncertify as a Reviewer", () => {
Expand All @@ -37,19 +43,29 @@ describe("CARTS Submit and Uncertify Integration Tests", () => {

// 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.wait(3000); // let logout settle

// 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();

Expand All @@ -58,6 +74,7 @@ describe("CARTS Submit and Uncertify Integration Tests", () => {
// log back out
cy.get(headerDropdownMenu).click();
cy.get(logoutButton).click();
cy.wait(3000); // let logout settle

// log back in as State User
cy.authenticate("stateUser");
Expand Down
Loading