From 2e1b11a2bf784016d12c1716c278776326d1a3dc Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 1 Apr 2020 15:00:42 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 4 ++++ ayanova/tests/e2e/specs/widget-crud.js | 20 +++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index dc650bf7..f1fff8b0 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -51,9 +51,13 @@ CURRENT TODOs + todo: Client automated testing - Need several as basis for all future, make sure it's right. +todo: de-var-ification + - use const for unchanging values, let everywhere else, no var anywhere and test out before moving on + todo: new widget - There should be a new option (in addition to duplicate) within the existing widget form because it makes sense to want to make a new one while editing previous one - Plus you could have arrived there from anywhere, don't want to have to reload a big list just to add a new one diff --git a/ayanova/tests/e2e/specs/widget-crud.js b/ayanova/tests/e2e/specs/widget-crud.js index 319cde3a..8ed18f0b 100644 --- a/ayanova/tests/e2e/specs/widget-crud.js +++ b/ayanova/tests/e2e/specs/widget-crud.js @@ -2,7 +2,7 @@ describe("WIDGET", () => { it("Performs all crud ops on widget", () => { - var unique = new Date().getTime(); + let unique = new Date().getTime(); cy.visit("/login"); cy.get("input[name=username]") @@ -17,6 +17,13 @@ describe("WIDGET", () => { cy.url().should("include", "/home-dashboard"); cy.visit("/widgets/0"); cy.url().should("include", "/widgets/0"); + //save the start url for later + let startUrl = null; + //funcs are async so need to get result via then + cy.url().then(url => { + startUrl = url; + }); + //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 @@ -33,9 +40,10 @@ describe("WIDGET", () => { //start date cy.get("[data-cy='dtfpick:startDate']").click(); - //first row first day (the first of the month) + //second row first day (the first row first day is variable so not suitable) + //cy.get(':nth-child(2) > :nth-child(1) > .v-btn') cy.get( - '[data-cy="dpick:startDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(1) > :nth-child(1)' + '[data-cy="dpick:startDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(2) > :nth-child(1)' ).click(); //Start time @@ -56,9 +64,9 @@ describe("WIDGET", () => { //end date cy.get("[data-cy='dtfpick:endDate']").click(); - //first row second day (the second of the month) + //second row second day (second row always has all days represented) cy.get( - '[data-cy="dpick:endDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(1) > :nth-child(2)' + '[data-cy="dpick:endDate"] > .v-picker__body > :nth-child(1) > .v-date-picker-table > table > tbody > :nth-child(2) > :nth-child(2)' ).click(); //End time @@ -106,6 +114,8 @@ describe("WIDGET", () => { //SAve the record cy.get('[data-cy="widget-edit:save"]').click(); + cy.url().should("not.eql", startUrl); + //cy.get("[data-cy=WidgetCustom4]").check({ force: true }); //have to force, for some reason it thinks it's covered //cy.get("[data-cy=tags]").type("zone1{enter}", { force: true });