Files
raven-test/e2e/tests/regression/accounting-user/accounting-features.js
2021-11-01 22:19:53 +00:00

185 lines
7.3 KiB
JavaScript

/// <reference types="cypress" />
describe("When Accounting user logs in", () => {
it("should correctly run all functionality", () => {
//format for typing input and setting value is always YYYY-MM-DD for date and HH:MM in 24 hour time for time
const dNow = new Date();
const dToday = `${dNow.getFullYear()}-${(dNow.getMonth() + 1)
.toString()
.padStart(2, "0")}-${dNow.getDate().toString().padStart(2, "0")}`;
const tNow = `${dNow.getHours()}:${dNow.getMinutes()}`;
const tOneHourFromNow = `${dNow.getHours() + 1}:${dNow.getMinutes()}`;
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
//USER OPTIONS
cy.get("[data-cy=home]").click();
cy.get("[data-cy='nav/home-user-settings']").click();
cy.url().should("include", "/home-user-settings");
cy.get("[data-cy='nativeDateTimeInput']").check({ force: true });
/*
//DASHBOARD
cy.get("[data-cy=navicon]").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]");
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();
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='startDate:date']").type(dToday);
cy.get("[data-cy='startDate:time']").type(tNow);
cy.get("[data-cy='stopDate:date']").type(dToday);
cy.get("[data-cy='stopDate:time']").type(tOneHourFromNow);
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");
//SCHEDULE
//should show reminder made above in month display by default
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy='nav/home-schedule']").click();
cy.url().should("include", "/home-schedule");
cy.contains(`${Cypress.config("cyid")}-test-reminder`);
//NOTIFICATION SUBSCRIPTION
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy='nav/home-notify-subscriptions']").click();
cy.url().should("include", "/home-notify-subscriptions");
cy.get("[data-cy='notify-subscriptions:new']").click();
cy.url().should("include", "/home-notify-subscriptions/0");
cy.chooseVSelect("eventType", "Object created");
cy.chooseVSelect("ayaType", "Contract");
cy.get("[data-cy='notify-subscription:save'] > .v-btn__content").click();
//confirm
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy='nav/home-notify-subscriptions']").click();
cy.url().should("include", "/home-notify-subscriptions");
cy.contains("Object created");
cy.contains("Contract");
cy.contains("Deliver in application");
*/
//CONTRACT
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy=accounting]").click();
cy.get("[data-cy='nav/svc-contracts']").click();
cy.url().should("include", "/svc-contracts");
cy.get("[data-cy=contractsTable]");
cy.get("[data-cy='contract-list:new']").click();
cy.get("[data-cy=name]").type(
`${Cypress.config("cyid")}-test-contract{enter}`
);
cy.get("[data-cy='responseTime:days']").type('7');
cy.get("[data-cy='partsOverridePct']").type('2');
cy.get("[data-cy='serviceRatesOverridePct']").type('3');
cy.get("[data-cy='travelRatesOverridePct']").type('4');
cy.get("[data-cy=notes]").type(
`Test contract NOTES!!!{enter}eot{enter}`
);
cy.get("[data-cy=alertNotes]").type(
`Test contract alert message{enter}eot{enter}`
);
cy.get("[data-cy='contract-edit:save'] > .v-btn__content").click();
cy.get("[data-cy=navicon]").click();
cy.get("[data-cy='nav/svc-contracts']").click();
cy.url().should("include", "/svc-contracts");
cy.contains(`${Cypress.config("cyid")}-test-contract`);
//NOTIFICATION
cy.get("[data-cy=notification]").click();
cy.url().should("include", "/home-notifications");
cy.contains("Object created");
cy.contains(`${Cypress.config("cyid")}-test-contract`);
//=========================================================
// 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']");
//-----------------------------------------------------
});
});