Files
raven-test/e2e/tests/regression/accounting-user/accounting-features.js
2021-10-29 23:17:32 +00:00

115 lines
4.4 KiB
JavaScript

/// <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
cy.get("[data-cy=home]").click();
//DASHBOARD
/* */
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.url().should("include", "/home-memos/");
cy.get("[data-cy=pickListSelectedUserId]")
.click()
.type("accounting{enter}");//select Accounting user (self)
cy.get("[data-cy=name]").type(
`${Cypress.config("cyid")}-test-subject{enter}`
);
cy.get("[data-cy=notes]").type(
`The quick brown fox jumped{enter}over the six lazy dogs{enter}eot`
);
cy.get("[data-cy=tags]")
.click()
.type("zone1{enter}blue{enter}zone2{enter}"); //select some tags
cy.get("[data-cy='memo-edit:save'] > .v-btn__content").click();
cy.url().should("include", "/home-memos"); //wait for nav
cy.contains(`${Cypress.config("cyid")}-test-subject`).click(); //find and open memo record
cy.contains("zone1");
cy.contains("blue");
cy.contains("zone2");
//reply
cy.get("[data-cy=contextmenu]").click();
cy.get("[data-cy='memo-edit:reply']").click();
cy.url().should("include", "/home-memos/");
cy.get("[data-cy=notes]").type(`this is my reply`);
cy.get("[data-cy='memo-edit:save'] > .v-btn__content").click();
cy.contains(`RE: ${Cypress.config("cyid")}-test-subject`).click(); //find and open reply
//forward to superuser
cy.get("[data-cy=contextmenu]").click();
cy.get("[data-cy='memo-edit:forward']").click();
cy.url().should("include", "/home-memos/");
cy.get("[data-cy=notes]").type(`Hello SuperUser this is my forward to you!{enter}eot{enter}`);
cy.get("[data-cy=pickListSelectedUserId]")
.click()
.type("SuperUser{enter}");
cy.get("[data-cy='memo-edit:save'] > .v-btn__content").click();
//REMINDERS
cy.get("[data-cy=navicon]").click();
//new reminder
cy.get("[data-cy='nav/home-reminders']").click();
cy.url().should("include", "/home-reminders");
cy.get("[data-cy='reminder-list:new']:first").click();
cy.url().should("include", "/home-reminders/");
cy.get("[data-cy=name]").type(
`${Cypress.config("cyid")}-test-reminder{enter}`
);
cy.get("[data-cy='dtfpick:startDate']:first").click();
cy.get('[data-cy="dpicktoday:startDate"] > .v-btn__content').click();//select today
cy.get('[data-cy="ttfpick:startDate"]').click();
cy.get('[data-cy="ttfpicknow:startDate"] > .v-btn__content').click();//select now
cy.get("[data-cy=notes]").type(`This is a reminder{enter}eot{enter}`);
cy.get('.v-color-picker__input > input').clear().type("#11E1D07E{enter}");//select a color
cy.get('[data-cy="reminder-edit:save"] > .v-btn__content').click();
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy='nav/home-reminders']").click();
cy.url().should("include", "/home-reminders");
//=========================================================
// 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']");
//-----------------------------------------------------
});
});