84 lines
3.2 KiB
JavaScript
84 lines
3.2 KiB
JavaScript
/// <reference types="cypress" />
|
|
|
|
import dayjs from "../../../support/dayjs.min.js"
|
|
|
|
describe("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");
|
|
|
|
//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 });
|
|
|
|
//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();
|
|
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");
|
|
//Status
|
|
// cy.get("[data-cy='woState:open']").click();
|
|
// cy.chooseVSelect("woState:picker", "Scheduled");
|
|
// cy.get("[data-cy='woState:btnok']").click();
|
|
|
|
//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=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();
|
|
// cy.get("[data-cy=logout]").click();
|
|
// cy.url().should("include", "/login");
|
|
|
|
//END OF TEST
|
|
//-----------------------------------------------------
|
|
});
|
|
});
|