Files
raven-client/ayanova/tests/e2e/specs/widget-crud.js
2020-03-31 23:02:48 +00:00

66 lines
2.4 KiB
JavaScript

// https://docs.cypress.io/api/introduction/api.html
describe("WIDGET", () => {
it("Performs all crud ops on widget", () => {
var unique = new Date().getTime();
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", "/home-dashboard");
cy.visit("/widgets/0");
cy.url().should("include", "/widgets/0");
//first edit to break the required rules
cy.get("[data-cy=active]").check({ force: true }); //have to force, for some reason it thinks it's covered
//now name and price sb required rule broken
cy.contains("Name is a required field");
cy.contains("Price is a required field");
//enter name
cy.get("[data-cy=name]").type("E2E CRUD " + unique);
//confirm error went away
cy.contains("Name is a required field").should("not.exist");
cy.get("[data-cy=count]").type("123");
cy.get("[data-cy=dollarAmount]").type("123.45");
cy.contains("Price is a required field").should("not.exist");
//start date
cy.get("[data-cy='dtfpick:startDate']").click();
//first row first day (the first of the month)
cy.get(
'[data-cy="dpick:startDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(1) > :nth-child(1)'
).click();
//end
cy.get("[data-cy='dtfpick:endDate']").click();
//first row second day (the second of the month)
// cy.get(
// '[data-cy="dpick:endDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(2) > :nth-child(1)'
// ).click();
cy.get(
'[data-cy="dpick:endDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(1) > :nth-child(2)'
).click();
// // we should be redirected to /dashboard
// cy.url().should("include", "/home-dashboard");
// //navigate and confirm
// //open nav and home menu
// cy.get("[data-cy=navicon]").click();
// 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=contextmenu]").click();
// cy.get("[data-cy='app:logout']").click();
// cy.url().should("include", "/login");
});
});