From 9544547019140bc91a4e7a9b33126bb51879bb89 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 29 Oct 2021 19:34:12 +0000 Subject: [PATCH] --- e2e/cypress.json | 4 +- .../accounting-user/accounting-features.js | 58 +++++++++++++++++++ .../authenticate-bad-creds-fails.js | 22 +++++++ .../regression/authorization/authenticate.js | 21 ------- 4 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 e2e/tests/regression/accounting-user/accounting-features.js create mode 100644 e2e/tests/regression/authorization/authenticate-bad-creds-fails.js delete mode 100644 e2e/tests/regression/authorization/authenticate.js diff --git a/e2e/cypress.json b/e2e/cypress.json index 48496c1..c22c76d 100644 --- a/e2e/cypress.json +++ b/e2e/cypress.json @@ -6,6 +6,8 @@ "xdefaultCommandTimeout": 10000, "env": { "adminusername": "superuser", - "adminpassword": "l3tm3in" + "adminpassword": "l3tm3in", + "accountinguser": "Accounting", + "accountingpassword": "Accounting" } } \ No newline at end of file diff --git a/e2e/tests/regression/accounting-user/accounting-features.js b/e2e/tests/regression/accounting-user/accounting-features.js new file mode 100644 index 0000000..9cbe278 --- /dev/null +++ b/e2e/tests/regression/accounting-user/accounting-features.js @@ -0,0 +1,58 @@ +/// +describe("When Accounting user logs in", () => { + it("should allow user all functionality available to them", () => { + cy.visit("/login"); + + cy.get("input[name=username]").clear().type(Cypress.env("accountinguser")); + + // {enter} causes the form to submit + cy.get("input[name=password]") + .clear() + .type(`${Cypress.env("accountingpassword")}{enter}`); + + cy.url().should("include", "/ay-evaluate"); + + //open nav pane + cy.get("[data-cy=navicon]").click(); + cy.contains("Accounting"); //accounting is part of name displayed at top + + //DASHBOARD + cy.get("[data-cy=home]").click(); + cy.get("[data-cy='nav/home-dashboard']").click(); + cy.url().should("include", "/home-dashboard"); + + //SEARCH + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy='nav/home-search']").click(); + cy.url().should("include", "/home-search"); + cy.get("[data-cy=phrase]").clear().type("xyz{enter}"); + //check for expected results + cy.contains("Customer"); + cy.contains("XYZ Accounting"); + cy.contains("Head Office"); + cy.contains("XYZ Head Office"); + + //MEMOS + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy='nav/home-memos']").click(); + cy.url().should("include", "/home-memos"); + cy.get("[data-cy=memosTable]"); + //new memo + cy.get("[data-cy='memo-list:new']").click(); + // cy.get('[data-cy=pickListSelectedUserId] > .v-input > .v-input__control') + cy.get('[data-cy=pickListSelectedUserId]').click().type("accounting{enter}"); + cy.get("[data-cy=name]").type("cypress-test-subject-xxx{enter}"); + + + + + // cy.get("[data-cy='nav/home-memos']"); + // cy.get("[data-cy='nav/home-reminders']"); + // cy.get("[data-cy='nav/home-reviews']"); + // cy.get("[data-cy='nav/home-user-settings']"); + // cy.get("[data-cy='nav/home-notify-subscriptions']"); + // cy.get("[data-cy='nav/home-history']"); + + //----------------------------------------------------- + }); +}); diff --git a/e2e/tests/regression/authorization/authenticate-bad-creds-fails.js b/e2e/tests/regression/authorization/authenticate-bad-creds-fails.js new file mode 100644 index 0000000..0e6b588 --- /dev/null +++ b/e2e/tests/regression/authorization/authenticate-bad-creds-fails.js @@ -0,0 +1,22 @@ +/// +describe("When authenticating with bad credentials", () => { + it("does not allow a login returns error", () => { + cy.visit("/login"); + + cy.get("input[name=username]").clear().type('notauser'); + + // {enter} causes the form to submit + cy.get("input[name=password]") + .clear() + .type(`notapassword{enter}`); + + // //LOGOUT + // cy.get("[data-cy=navicon]").click(); + // cy.contains("AyaNova SuperUser"); + cy.get("[data-cy=loginbutton_failedcreds]"); + + cy.url().should("include", "/login"); + + //----------------------------------------------------- + }); +}); diff --git a/e2e/tests/regression/authorization/authenticate.js b/e2e/tests/regression/authorization/authenticate.js deleted file mode 100644 index 2b331f4..0000000 --- a/e2e/tests/regression/authorization/authenticate.js +++ /dev/null @@ -1,21 +0,0 @@ -/// -describe("When authenticating", () => { - it("logs in and logs out superuser without error", () => { - cy.visit("/login"); - - cy.get("input[name=username]").clear().type(Cypress.env("adminusername")); - - // {enter} causes the form to submit - cy.get("input[name=password]") - .clear() - .type(`${Cypress.env("adminpassword")}{enter}`); - - //LOGOUT - cy.get("[data-cy=navicon]").click(); - cy.contains("AyaNova SuperUser"); - cy.get("[data-cy=logout]").click({force:true}); - cy.url().should("include", "/login"); - - //----------------------------------------------------- - }); -});