This commit is contained in:
@@ -32,7 +32,7 @@ Cypress.Commands.add("chooseVSelect", (dataCyTag, selectionText) => {
|
||||
});
|
||||
|
||||
Cypress.Commands.add("choosePickList", (dataCyTag, selectionText) => {
|
||||
cy.get(`[data-cy='${dataCyTag}']`).click({ force: true }).type('xyz');
|
||||
cy.get(`[data-cy='${dataCyTag}']`).click({ force: true }).type(selectionText);
|
||||
|
||||
cy.get(".v-list-item__title")
|
||||
.contains(new RegExp("^" + selectionText + "$", "g"))
|
||||
|
||||
@@ -4,24 +4,8 @@ import dayjs from "../../../support/dayjs.min.js"
|
||||
|
||||
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()
|
||||
@@ -39,6 +23,18 @@ describe("When Service user logs in", () => {
|
||||
cy.url().should("include", "/home-user-settings");
|
||||
cy.get("[data-cy='nativeDateTimeInput']").check({ force: true });
|
||||
|
||||
//PROJECT
|
||||
cy.get("[data-cy=navicon]").click();
|
||||
cy.get("[data-cy=service]").click();
|
||||
cy.get("[data-cy='nav/svc-projects']").click();
|
||||
cy.url().should("include", "/svc-projects");
|
||||
cy.get("[data-cy=projectsTable]");
|
||||
cy.get("[data-cy='project-list:new']:first").click();
|
||||
cy.get("[data-cy=name]").type(
|
||||
`${Cypress.config("cyid")}-test-project{enter}`
|
||||
);
|
||||
cy.get("[data-cy='project-edit:save'] > .v-btn__content").click();
|
||||
|
||||
//WORKORDER
|
||||
cy.get("[data-cy=navicon]").click();
|
||||
cy.get("[data-cy=service]").click();
|
||||
@@ -47,30 +43,34 @@ describe("When Service user logs in", () => {
|
||||
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();
|
||||
//Status
|
||||
// cy.get("[data-cy='woState:open']").click();
|
||||
// cy.chooseVSelect("woState:picker", "Scheduled");
|
||||
// cy.get("[data-cy='woState:btnok']").click();
|
||||
|
||||
cy.get("[data-cy=address]").type(`${Cypress.config("cyid")} E. First St{enter}`);
|
||||
cy.get("[data-cy=city]").type("Los Angeles");
|
||||
cy.get("[data-cy=region]").type("California");
|
||||
cy.get("[data-cy=country]").type("USA");
|
||||
cy.get("[data-cy=latitude]").type("34.052234");
|
||||
cy.get("[data-cy=longitude]").type("-118.243685");
|
||||
//Address
|
||||
//cy.get("[data-cy='woAddress:open']").click();
|
||||
// cy.get("[data-cy=address]").type(`${Cypress.config("cyid")} E. First St{enter}`);
|
||||
// cy.get("[data-cy=city]").type("Los Angeles");
|
||||
// cy.get("[data-cy=region]").type("California");
|
||||
// cy.get("[data-cy=country]").type("USA");
|
||||
// cy.get("[data-cy=latitude]").type("34.052234");
|
||||
// cy.get("[data-cy=longitude]").type("-118.243685");
|
||||
// cy.get("[data-cy=postAddress]").type(`Box ${Cypress.config("cyid")}`);
|
||||
// cy.get("[data-cy=postCity]").type("Los Angeles");
|
||||
// cy.get("[data-cy=postRegion]").type("CA");
|
||||
// cy.get("[data-cy=postCountry]").type("US");
|
||||
// cy.get("[data-cy=postCode]").type("90012");
|
||||
// cy.get("[data-cy='woAddress:btnok']").click();
|
||||
|
||||
cy.get("[data-cy=postAddress]").type(`Box ${Cypress.config("cyid")}`);
|
||||
cy.get("[data-cy=postCity]").type("Los Angeles");
|
||||
cy.get("[data-cy=postRegion]").type("CA");
|
||||
cy.get("[data-cy=postCountry]").type("US");
|
||||
cy.get("[data-cy=postCode]").type("90012");
|
||||
cy.get("[data-cy='woAddress:btnok']").click();
|
||||
|
||||
cy.get("[data-cy=notes]").type(`Test summary workorder information`);
|
||||
|
||||
//complete by now plus 7 days
|
||||
cy.get("[data-cy=notes]").type(`Test summary workorder information`);
|
||||
cy.get("[data-cy='completeByDate:date']").type( dayjs().add(7,'day').format('YYYY-MM-DD'));
|
||||
cy.get("[data-cy='completeByDate:time']").type( dayjs().add(7,'day').format('HH:mm'));
|
||||
cy.choosePickList("contractId", "Gold");
|
||||
cy.choosePickList("projectId", `${Cypress.config("cyid")}-test-project`);
|
||||
|
||||
|
||||
|
||||
|
||||
// //LOGOUT
|
||||
// cy.get("[data-cy=navicon]").click();
|
||||
|
||||
Reference in New Issue
Block a user