This commit is contained in:
2021-12-20 19:12:32 +00:00
parent c08b169919
commit f3ff88229e
20 changed files with 99 additions and 229 deletions

View File

@@ -1,20 +1,30 @@
{
"defaultCommandTimeout":5000,
"defaultCommandTimeout": 5000,
"xxxretries": 3,
"integrationFolder": "tests",
"supportFile":"support",
"xbaseUrl": "http://localhost:7575",
"baseUrl": "https://test.helloayanova.com",
"xxxxbaseUrl":"http://localhost:8080",
"video":false,
"supportFile": "support",
"baseUrl": "http://localhost:7575",
"xbaseUrl": "https://test.helloayanova.com",
"xxxxbaseUrl": "http://localhost:8080",
"video": false,
"env": {
"xapiBaseUrl":"http://localhost:7575/api/v8.0/",
"apiBaseUrl":"https://test.helloayanova.com/api/v8.0/",
"adminusername": "superuser",
"adminpassword": "l3tm3in",
"accountinguser": "Accounting",
"accountingpassword": "Accounting",
"serviceuser":"Service",
"servicepassword":"Service"
"apiBaseUrl": "http://localhost:7575/api/v8.0/",
"xapiBaseUrl": "https://test.helloayanova.com/api/v8.0/",
"admin": {
"login": "superuser",
"password": "l3tm3in"
},
"accounting": {
"login": "Accounting",
"password": "Accounting"
},
"service": {
"login": "Service",
"password": "Service"
},
"customer": {
"login": "Customer",
"password": "Customer"
}
}
}

View File

@@ -34,7 +34,21 @@ Cypress.Commands.add("chooseVSelect", (dataCyTag, selectionText) => {
Cypress.Commands.add("choosePickList", (dataCyTag, selectionText) => {
cy.get(`[data-cy='${dataCyTag}']`).click({ force: true }).type(selectionText);
cy.wait(500);
cy.get(".v-list-item__title")
.contains(new RegExp(selectionText))
.click();
cy.get(".v-list-item__title").contains(new RegExp(selectionText)).click();
});
Cypress.Commands.add("ayLogin", (user, urlAfterLogin) => {
if(!urlAfterLogin){
urlAfterLogin="/ay-evaluate"
}
cy.visit("/login");
cy.get("input[name=username]").clear().type(Cypress.env(user).login);
// {enter} causes the form to submit
cy.get("input[name=password]")
.clear()
.type(`${Cypress.env(user).password}{enter}`);
cy.url().should("include", urlAfterLogin);
});

View File

@@ -20,72 +20,4 @@ import "./commands";
// require('./commands')
//unique test run ID for all tests
Cypress.config("cyid", `cy${new Date().getTime()}`);
///////////////////////////////////////////////////////////////
//Generate fresh data
//
//
// //via UI
// // before(() => {
// // 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}`);
// // cy.url().should("include", "/ay-evaluate");
// // cy.get("[data-cy=btnSeed]").click();
// // cy.get("[data-cy=btnStart]").click();
// // cy.get('[data-cy="gzconfirm:yesbutton"]').click();
// // //cy.contains("permanently erase");
// // cy.get('[data-cy="gzconfirm:yesbutton"]').click();
// // //long delay here while data is being generated
// // cy.url({ timeout: 300000 }).should("include", "/login");
// // });
//via API
function confirmJobDone(jobId, authToken) {
cy.request({
method: "GET",
url: `${Cypress.env("apiBaseUrl")}job-operations/status/${jobId}`,
auth: {
bearer: authToken
}
}).then((resp) => {
//3 means job done
if (resp.body.data == 3) return;
// else recurse
cy.wait(1000);
confirmJobDone(jobId, authToken);
});
}
// before(() => {
// cy.request({
// url: `${Cypress.env("apiBaseUrl")}auth`,
// method: "POST",
// body: {
// login: Cypress.env("adminusername"),
// password: Cypress.env("adminpassword")
// }
// })
// .its("body")
// .then((res) => {
// cy.request({
// method: "POST",
// url: `${Cypress.env("apiBaseUrl")}trial/seed/small/-7/true`,
// auth: {
// bearer: res.data.token
// }
// })
// .its("body")
// .then((resjob) => {
// cy.log(`resjob is: ${JSON.stringify(resjob)}`);
// // expect(resjob.body).to.have.property('jobId');
// confirmJobDone(resjob.jobId, res.data.token);
// });
// });
// });
Cypress.config("cyid", `cy${new Date().getTime()}`);

View File

@@ -2,15 +2,7 @@
describe("SMOKE HOME SECTION", () => {
it("Home forms opens 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
//################# HOME
cy.visit("/home-dashboard");

View File

@@ -2,15 +2,7 @@
describe("SMOKE CUSTOMER SECTION", () => {
it("Customer section forms opens 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
//################# CUSTOMERS
cy.visit("/cust-customers");

View File

@@ -2,15 +2,7 @@
describe("SMOKE SERVICE MISC SECTION", () => {
it("Service MISC forms open 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
//################# SERVICE
cy.visit("/svc-schedule");
cy.url().should("include", "/svc-schedule");

View File

@@ -2,15 +2,7 @@
describe("SMOKE SERVICE WO SECTION", () => {
it("Service WO forms open 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
//################# SERVICE WO
cy.visit("/svc-workorders");

View File

@@ -2,14 +2,7 @@
describe("SMOKE SERVICE QUOTE SECTION", () => {
it("Service quote forms open 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}`);
cy.ayLogin("admin");
cy.visit("/svc-quotes");

View File

@@ -2,15 +2,7 @@
describe("SMOKE SERVICE PM SECTION", () => {
it("Service pm forms open 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
cy.visit("/svc-pms");
cy.url().should("include", "/svc-pms");

View File

@@ -2,15 +2,7 @@
describe("SMOKE INVENTORY", () => {
it("Inventory forms open 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}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("admin");
//################# INVENTORY
cy.visit("/inv-parts");

View File

@@ -2,17 +2,7 @@
describe("SMOKE VENDORS SECTION", () => {
it("Vendors forms open 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}`);
cy.url().should("include", "/ay-evaluate");
//################# VENDORS
cy.ayLogin("admin");
cy.visit("/vendors");
cy.url().should("include", "/vendors");
cy.get("[data-cy=generalerror]").should("not.exist");

View File

@@ -2,17 +2,7 @@
describe("SMOKE", () => {
it("Every form opens 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}`);
cy.url().should("include", "/ay-evaluate");
//################# ACCOUNTING
cy.ayLogin("accounting");
cy.visit("/acc-service-rates");
cy.url().should("include", "/acc-service-rates");

View File

@@ -2,16 +2,7 @@
describe("SMOKE ADMIN SECTION", () => {
it("Admin forms open 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}`);
cy.url().should("include", "/ay-evaluate");
//################# ADMIN
cy.ayLogin("admin");
cy.visit("/adm-global-settings");
cy.url().should("include", "/adm-global-settings");
cy.get("[data-cy=generalerror]").should("not.exist");

View File

@@ -2,17 +2,7 @@
describe("SMOKE OPERATIONS SECTION", () => {
it("Ops forms open 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}`);
cy.url().should("include", "/ay-evaluate");
//################# OPERATIONS
cy.ayLogin("admin");
cy.visit("/ops-backup");
cy.url().should("include", "/ops-backup");
cy.get("[data-cy=generalerror]").should("not.exist");

View File

@@ -2,17 +2,7 @@
describe("SMOKE MISC", () => {
it("Misc. forms open 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}`);
cy.url().should("include", "/ay-evaluate");
cy.url().should("include", "/ay-evaluate");
//################# MISC
cy.ayLogin("admin");
cy.visit("/about");
cy.url().should("include", "/about");
cy.get("[data-cy=generalerror]").should("not.exist");

View File

@@ -2,13 +2,8 @@
describe("SMOKE CUSTOMER SECTION", () => {
it("Customer User forms open without error", () => {
cy.visit("/login");
cy.ayLogin("accounting", "/customer-csr");
//CUSTOMER PAGES
cy.get("input[name=username]").clear().type("Customer");
cy.get("input[name=password]").clear().type("Customer{enter}");
cy.url().should("include", "/customer-csr");
cy.get("[data-cy=generalerror]").should("not.exist");
cy.get("[data-cy=csrTable]");
@@ -17,7 +12,7 @@ describe("SMOKE CUSTOMER SECTION", () => {
cy.get("[data-cy=generalerror]").should("not.exist");
cy.get("[data-cy=workordersTable]");
//todo:
//todo:
//path: "/customer-workorders/:recordid",
//path: "/customer-csr/:recordid"

View File

@@ -0,0 +1,20 @@
/// <reference types="cypress" />
describe("When Accounting user logs in", () => {
it("should set up accounting block user options", () => {
cy.ayLogin("accounting");
//open nav pane
cy.get("[data-cy=navicon]").click();
cy.contains("- Accounting"); //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 });
//END OF TEST
//-----------------------------------------------------
});
});

View File

@@ -0,0 +1,19 @@
/// <reference types="cypress" />
describe("Search", () => {
it("should work", () => {
//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");
//END OF TEST
//-----------------------------------------------------
});
});

View File

@@ -1,5 +1,5 @@
/// <reference types="cypress" />
describe("When Accounting user logs in", () => {
describe.skip("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();
@@ -14,16 +14,7 @@ describe("When Accounting user logs in", () => {
.toString()
.padStart(2, "0")}:${dNow.getMinutes().toString().padStart(2, "0")}`;
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");
cy.ayLogin("accounting");
//open nav pane
cy.get("[data-cy=navicon]").click();

View File

@@ -2,16 +2,9 @@
import dayjs from "../../../support/dayjs.min.js";
describe("When Service user logs in", () => {
describe.skip("When Service user logs in", () => {
it("should correctly run all functionality", () => {
cy.visit("/login");
cy.get("input[name=username]").clear().type(Cypress.env("serviceuser"));
// {enter} causes the form to submit
cy.get("input[name=password]")
.clear()
.type(`${Cypress.env("servicepassword")}{enter}`);
cy.url().should("include", "/ay-evaluate");
cy.ayLogin("service");
//open nav pane
cy.get("[data-cy=navicon]").click();