From 79c5bb9b79b9e0902e6c5357d37c357fcb60d798 Mon Sep 17 00:00:00 2001 From: Amos Njoroge Date: Wed, 29 Apr 2020 15:45:51 +0300 Subject: [PATCH 1/2] Added menu navigation test --- cypress/integration/.DS_Store | Bin 8196 -> 8196 bytes .../sanity/ATCATC-5_Navigation.spec.js | 196 ++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 cypress/integration/sanity/ATCATC-5_Navigation.spec.js diff --git a/cypress/integration/.DS_Store b/cypress/integration/.DS_Store index 3e67f00baa6429c22bf310cdb0fdff8fe8cce865..129c73815dbc37fd6a472a393e2a3b5b39d610b0 100644 GIT binary patch delta 160 zcmZp1XmQw}E?{^psURn_xWvHVIwKP^3o9Et2L~4i7cWlm!>H+-6$GENO>8jQ%r5bbWwXBM4W@|=`T#NGCqDoH delta 204 zcmZp1XmQw}F5vbfsURn_xWvHV1|t(Q3o9Et2PYRdCpRBAXKZjretB?7Vo7PSQ({rP zfJ|^^N@`MKQFvxbNk&L&o@-8OS!$ktkxybt>f{Ik&#Y*WhJeJ944@(oWrsus1`y!n z;EWfLuCCTKG&VEPQ7|$#sMS%ZhH}g;Yil_`ew~uvUJ( + +context("Navigating using dropdown menu", () => { + let env; + before(() => { + env = Cypress.env(); + }); + + beforeEach(() => { + cy.apiLogin(env.un_qa_org, env.pw_qa_org); + cy.visit("/"); + }); + + const menuNavigation = (menu, submenu, title, clases = "") => { + cy.get(`${clases}.dropdown-toggle`) + .contains(menu) + .click(); + cy.get(".dropdown-menu > li") + .contains(submenu) + .click(); + + if (clases === "") { + cy.get(".dropdown-toggle") + .contains(menu) + .parent() + .should("have.class", "active"); + } + + cy.get(".page-title").should("contain", title); + }; + + it("ACTATC-5.1 Navigates using the Workflows menu", () => { + // Landing Page + cy.get(".page-title").should("contain", "My Dashboard"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Programs") + .should("exist"); + // Programs Page + menuNavigation("Workflows", "Programs", "Programs List"); + cy.get("#show-modal").should("contain", "Programs"); + + // Projects Page + menuNavigation("Workflows", "Projects", "Projects List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects Status") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Projects") + .should("exist"); + }); + + it("ACTATC-5.2 Navigates using the Indicator menu", () => { + // Indicators Page + menuNavigation("Indicators", "Indicators", "Indicators List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Indicators") + .should("exist"); + + // Objectives Page + menuNavigation("Indicators", "Objectives", "Objective List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("#show-modal").should("contain", "Objective"); + }); + + it("ACTATC-5.3 Navigates using the Form Library menu", () => { + // Individuals Page + menuNavigation("Form Library", "Individuals", "Individuals List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Training") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Distribution") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Individual") + .should("exist"); + + // Distribution Page + menuNavigation("Form Library", "Distribution", "Distribution List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Distribution") + .should("exist"); + + // Training Page + menuNavigation("Form Library", "Training", "Training List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Training") + .should("exist"); + }); + + it("ACTATC-5.4 Navigates using the Components menu", () => { + // Contacts Page + menuNavigation("Components", "Contacts", "Contact List"); + cy.get("button[data-toggle='dropdown']") + .contains("Stakeholder") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Contact") + .should("exist"); + + // Documents Page + menuNavigation("Components", "Documents", "Document List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects") + .should("exist"); + cy.get("#show-modal").should("contain", "Document"); + + // Locations Page + menuNavigation("Components", "Locations", "Locations List"); + cy.get("button[data-toggle='dropdown']") + .contains("Site Status") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects") + .should("exist"); + cy.get("button[data-toggle='modal']") + .contains("Locations") + .should("exist"); + + // Stakeholders Page + menuNavigation("Components", "Stakeholders", "Stakeholder List"); + cy.get("button[data-toggle='dropdown']") + .contains("Programs") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Projects") + .should("exist"); + cy.get("a[data-toggle='modal']") + .contains("Stakeholders") + .should("exist"); + }); + + it("ACTATC-5.5 Navigates using the Reports menu", () => { + // Dashboards Page + menuNavigation("Reports", "Dashboards", "Dashboard List"); + cy.get("button[data-toggle='dropdown']") + .contains("Filter by Sector") + .should("exist"); + cy.get("button[data-toggle='dropdown']") + .contains("Filter by Countries") + .should("exist"); + }); + + it("ACTATC-5.6 Navigates using the User Avatar menu", () => { + // Profile Page + menuNavigation( + env.fn_qa_org[0], + "Profile", + "My Profile", + ".navbar-right > .dropdown > " + ); + cy.get(".btn") + .contains("Change Password") + .should("exist"); + + // Organization Settings Page + menuNavigation( + env.fn_qa_org[0], + "Organization Settings", + "Organization Settings", + ".navbar-right > .dropdown > " + ); + }); +}); From 92115d4bd35e1cdb9e680aba64f52367bc1b6cf9 Mon Sep 17 00:00:00 2001 From: Amos Njoroge Date: Wed, 29 Apr 2020 15:48:08 +0300 Subject: [PATCH 2/2] Read Me update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 681a772..b1bde19 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ The envirom variables file `cypress.env.json` has not been commited. You can cre { "un_qa_org": "", # username for a user with django admin access "pw_qa_org": "", # password for a user with django admin access + "fn_qa_org": "", # First Name for a user with django admin access + "ln_qa_org": "", # Last Name or a user with django admin access "api_key_mailslurp": "", # [Mailslurp](https://www.mailslurp.com/) api key "mailslurp_inbox": "" # Mailslurp inbox id }