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

156 lines
6.7 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='dpick:startDate']").type(dToday);
cy.get("[data-cy='tpick:startDate']").type(tNow);
cy.get("[data-cy='dpick:stopDate']").type(dToday);
cy.get("[data-cy='tpick:stopDate']").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");
//autocomplete method required
cy.get("[data-cy=eventType]").type("O", { force: true }); //bring up the menu by typing an available option
cy.contains("Object created").click({ force: true }); //look for the option and click it on the page
cy.chooseVSelect("ayaType", "Contract");
// cy.get("[data-cy=ayaType]").click({force:true});//.contains(".v-list-item__title","Contract").click({force:true});
// cy.get(".v-list-item__title").contains(/^Contract$/).click({force:true});
//this one is scoped to a class of .ayaType that had to be jigged on to the menu to work see the notify subscription code
//reason being that looking for Contract unscoped matches eventType above and selects again in there, the class is required to put
//on the vmenu that is generated so that it can find it in there rather than in the wrong place, ugly workaround required because not fixed yet in this case:
//https://github.com/vuetifyjs/vuetify/issues/10988#issuecomment-726089949
//note it's prefixed with .cy for future to strip it all back out when vuetify gets their e2e testing shit together properly (likely v3)
//cy.get(".cyAyaType").contains("Contract").click({force:true});
//=========================================================
// 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']");
//-----------------------------------------------------
});
});