74 lines
2.8 KiB
JavaScript
74 lines
2.8 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe("When Service 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().toString().padStart(2, "0")}:${dNow
|
|
.getMinutes()
|
|
.toString()
|
|
.padStart(2, "0")}`;
|
|
const tOneHourFromNow = `${(dNow.getHours() + 1)
|
|
.toString()
|
|
.padStart(2, "0")}:${dNow.getMinutes().toString().padStart(2, "0")}`;
|
|
|
|
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");
|
|
|
|
// //open nav pane
|
|
// cy.get("[data-cy=navicon]").click();
|
|
// cy.contains("- Service"); //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 });
|
|
|
|
//WORKORDER
|
|
cy.get("[data-cy=navicon]").click();
|
|
cy.get("[data-cy=service]").click();
|
|
cy.get("[data-cy='nav/svc-workorders']").click();
|
|
cy.url().should("include", "/svc-workorders");
|
|
cy.get("[data-cy=workordersTable]");
|
|
cy.get("[data-cy='workorder-list:new']:first").click();
|
|
cy.choosePickList("customerId", "XYZ");
|
|
cy.get("[data-cy='woState:open']").click();
|
|
cy.chooseVSelect("woState:picker", "Scheduled");
|
|
cy.get("[data-cy='woState:btnok']").click();
|
|
cy.get("[data-cy='woAddress:open']").click();
|
|
|
|
cy.get("[data-cy=address]").type(`${Cypress.config("cyid")} street{enter}`);
|
|
cy.get("[data-cy=city]").type("Los Angeles");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=country]").type("United States");
|
|
cy.get("[data-cy=latitude]").type("34.052234");
|
|
cy.get("[data-cy=longitude]").type("-118.243685");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy=region]").type("California");
|
|
cy.get("[data-cy='woAddress:btnok']").click();
|
|
|
|
// //LOGOUT
|
|
// cy.get("[data-cy=navicon]").click();
|
|
// cy.get("[data-cy=logout]").click();
|
|
// cy.url().should("include", "/login");
|
|
|
|
//END OF TEST
|
|
//-----------------------------------------------------
|
|
});
|
|
});
|