This commit is contained in:
2021-10-29 19:34:12 +00:00
parent d700e9137e
commit 9544547019
4 changed files with 83 additions and 22 deletions

View File

@@ -6,6 +6,8 @@
"xdefaultCommandTimeout": 10000,
"env": {
"adminusername": "superuser",
"adminpassword": "l3tm3in"
"adminpassword": "l3tm3in",
"accountinguser": "Accounting",
"accountingpassword": "Accounting"
}
}

View File

@@ -0,0 +1,58 @@
/// <reference types="cypress" />
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']");
//-----------------------------------------------------
});
});

View File

@@ -0,0 +1,22 @@
/// <reference types="cypress" />
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");
//-----------------------------------------------------
});
});

View File

@@ -1,21 +0,0 @@
/// <reference types="cypress" />
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");
//-----------------------------------------------------
});
});