From 34a9b57b68951a3e904c3bc721a44397f20422f7 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 19 Oct 2020 19:11:34 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 2 + .../_first_test_login-nav-logout.js | 4 +- ayanova/tests/e2e/OLD/customize-form.js | 65 +++++++++++++++++++ .../tests/e2e/{specs => OLD}/gz-data-table.js | 6 +- .../tests/e2e/{specs => OLD}/jwt-example.js | 0 .../{specs => OLD}/select-list-templates.js | 0 ayanova/tests/e2e/specs/customize-form.js | 59 ----------------- ayanova/tests/e2e/specs/smoke.js | 2 +- ayanova/tests/e2e/specs/translation-about.js | 25 ++++--- ayanova/tests/e2e/specs/widget-crud.js | 10 +-- 10 files changed, 90 insertions(+), 83 deletions(-) rename ayanova/tests/e2e/{specs => OLD}/_first_test_login-nav-logout.js (89%) create mode 100644 ayanova/tests/e2e/OLD/customize-form.js rename ayanova/tests/e2e/{specs => OLD}/gz-data-table.js (94%) rename ayanova/tests/e2e/{specs => OLD}/jwt-example.js (100%) rename ayanova/tests/e2e/{specs => OLD}/select-list-templates.js (100%) delete mode 100644 ayanova/tests/e2e/specs/customize-form.js diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 8873496f..356a1ec5 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -12,7 +12,9 @@ todo: take a look at front end cypress testing etc again, it's going to be the b See where it's at, is any of it usable? Even just a single test that logs in, creates a widget using every field, edits it and deletes it would be a good smoke test Ideally: + Run all tests is all that's required Smoke test runnable, visits every page and CRUD widget + It should confirm each page has loaded, right now it just checks the url bar but that's not the same as erroring or not Runs against release mode need data-cy in release mode so changes need to be made to main dev and etc, perhaps it's just a default to add cy no if statement diff --git a/ayanova/tests/e2e/specs/_first_test_login-nav-logout.js b/ayanova/tests/e2e/OLD/_first_test_login-nav-logout.js similarity index 89% rename from ayanova/tests/e2e/specs/_first_test_login-nav-logout.js rename to ayanova/tests/e2e/OLD/_first_test_login-nav-logout.js index cdc32d37..36202bb2 100644 --- a/ayanova/tests/e2e/specs/_first_test_login-nav-logout.js +++ b/ayanova/tests/e2e/OLD/_first_test_login-nav-logout.js @@ -22,8 +22,8 @@ describe("Login", () => { 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.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); cy.url().should("include", "/login"); }); }); diff --git a/ayanova/tests/e2e/OLD/customize-form.js b/ayanova/tests/e2e/OLD/customize-form.js new file mode 100644 index 00000000..6855e822 --- /dev/null +++ b/ayanova/tests/e2e/OLD/customize-form.js @@ -0,0 +1,65 @@ + +//################# COMMENTED OUT BECAUSE TOO PROBLEMATIC TO TEST, HAS SIDE EFFECTS AND IF IT FAILS THEN NEEDS TO BE REVERSED TO RE-RUN THE TEST AGAIN +//BAH + +// // https://docs.cypress.io/api/introduction/api.html + +// describe("CUSTOMIZE", () => { +// it("Edits and works", () => { +// 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.visit("/widgets/1"); +// cy.url().should("include", "/widgets/1"); +// //check serial field is present, then hide it and check it's gone then re-show it again +// cy.get("[data-cy=serial]").should("exist"); +// cy.get("[data-cy=WidgetCustom8]").should("not.exist"); + +// cy.wait(100); +// cy.get("[data-cy=contextmenu]").click(); +// cy.get('[data-cy="app:customize"]').click(); +// cy.url().should("include", "/customize/Widget"); + +// //hide serial +// cy.get("[data-cy=SerialVisible]").uncheck({ force: true }); +// cy.wait(10); + +// //show widget 8 and set it to a type +// cy.get("[data-cy=WidgetCustom8]").scrollIntoView(); +// cy.get("[data-cy=WidgetCustom8Visible]").check({ force: true }); +// cy.get("[data-cy=WidgetCustom8SelectType]").type("tr{enter}", { +// force: true +// }); + +// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click(); + +// cy.go("back"); +// //check customize worked +// cy.get("[data-cy=serial]").should("not.exist"); +// cy.get("[data-cy=WidgetCustom8]").should("exist"); + +// //reverse +// cy.wait(100); +// cy.get("[data-cy=contextmenu]").click(); +// cy.get('[data-cy="app:customize"]').click(); +// cy.url().should("include", "/customize/Widget"); +// cy.get("[data-cy=SerialVisible]").check({ force: true }); +// cy.get("[data-cy=WidgetCustom8Visible]").uncheck({ force: true }); +// cy.get("[data-cy=WidgetCustom8SelectType]").type("te{enter}", { +// force: true +// }); +// cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click(); +// cy.go("back"); +// cy.get("[data-cy=serial]").should("exist"); +// cy.get("[data-cy=WidgetCustom8]").should("not.exist"); +// //----- +// }); +// }); diff --git a/ayanova/tests/e2e/specs/gz-data-table.js b/ayanova/tests/e2e/OLD/gz-data-table.js similarity index 94% rename from ayanova/tests/e2e/specs/gz-data-table.js rename to ayanova/tests/e2e/OLD/gz-data-table.js index 04471022..2ca42dfb 100644 --- a/ayanova/tests/e2e/specs/gz-data-table.js +++ b/ayanova/tests/e2e/OLD/gz-data-table.js @@ -85,8 +85,8 @@ describe("GZ-DATA-TABLE", () => { // cy.get("[data-cy=home]").click(); // cy.get("[data-cy='nav/home-user-settings']").click(); // - // cy.get("[data-cy=contextmenu]").click(); - // cy.get("[data-cy='app:logout']").click(); - // cy.url().should("include", "/login"); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); + cy.url().should("include", "/login"); }); }); diff --git a/ayanova/tests/e2e/specs/jwt-example.js b/ayanova/tests/e2e/OLD/jwt-example.js similarity index 100% rename from ayanova/tests/e2e/specs/jwt-example.js rename to ayanova/tests/e2e/OLD/jwt-example.js diff --git a/ayanova/tests/e2e/specs/select-list-templates.js b/ayanova/tests/e2e/OLD/select-list-templates.js similarity index 100% rename from ayanova/tests/e2e/specs/select-list-templates.js rename to ayanova/tests/e2e/OLD/select-list-templates.js diff --git a/ayanova/tests/e2e/specs/customize-form.js b/ayanova/tests/e2e/specs/customize-form.js deleted file mode 100644 index 7b09fc2a..00000000 --- a/ayanova/tests/e2e/specs/customize-form.js +++ /dev/null @@ -1,59 +0,0 @@ -// https://docs.cypress.io/api/introduction/api.html - -describe("CUSTOMIZE", () => { - it("Edits and works", () => { - 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"); - //check serial field is present, then hide it and check it's gone then re-show it again - cy.get("[data-cy=serial]").should("exist"); - cy.get("[data-cy=WidgetCustom8]").should("not.exist"); - - cy.wait(100); - cy.get("[data-cy=contextmenu]").click(); - cy.get('[data-cy="app:customize"]').click(); - cy.url().should("include", "/customize/Widget"); - - //hide serial - cy.get("[data-cy=SerialVisible]").uncheck({ force: true }); - - //show widget 8 and set it to a type - cy.get("[data-cy=WidgetCustom8]").scrollIntoView(); - cy.get("[data-cy=WidgetCustom8Visible]").check({ force: true }); - cy.get("[data-cy=WidgetCustom8SelectType]").type("tr{enter}", { - force: true - }); - cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click(); - cy.go("back"); - //check customize worked - cy.get("[data-cy=serial]").should("not.exist"); - cy.get("[data-cy=WidgetCustom8]").should("exist"); - - //reverse - cy.wait(100); - cy.get("[data-cy=contextmenu]").click(); - cy.get('[data-cy="app:customize"]').click(); - cy.url().should("include", "/customize/Widget"); - cy.get("[data-cy=SerialVisible]").check({ force: true }); - cy.get("[data-cy=WidgetCustom8Visible]").uncheck({ force: true }); - cy.get("[data-cy=WidgetCustom8SelectType]").type("te{enter}", { - force: true - }); - cy.get('[data-cy="customize:save"] > .v-btn__content > .v-icon').click(); - cy.go("back"); - cy.get("[data-cy=serial]").should("exist"); - cy.get("[data-cy=WidgetCustom8]").should("not.exist"); - //----- - }); -}); diff --git a/ayanova/tests/e2e/specs/smoke.js b/ayanova/tests/e2e/specs/smoke.js index 86779320..c6dbf8fb 100644 --- a/ayanova/tests/e2e/specs/smoke.js +++ b/ayanova/tests/e2e/specs/smoke.js @@ -1,7 +1,7 @@ // Basic smoke test, visit every form to ensure they load describe("SMOKE", () => { - it("About form works for all default languages", () => { + it("Every form opens without error", () => { cy.visit("/login"); cy.get("input[name=username]") diff --git a/ayanova/tests/e2e/specs/translation-about.js b/ayanova/tests/e2e/specs/translation-about.js index d228e7c4..5bce5d01 100644 --- a/ayanova/tests/e2e/specs/translation-about.js +++ b/ayanova/tests/e2e/specs/translation-about.js @@ -14,8 +14,7 @@ describe("TRANSLATION", () => { .clear() .type("fr{enter}"); - // we should be redirected to /dashboard - // cy.url().should("include", "/home-dashboard"); + cy.wait(25); //nav to about form cy.get("[data-cy=contextmenu]").click(); @@ -34,8 +33,8 @@ describe("TRANSLATION", () => { cy.url().should("include", "/applog"); //LOGOUT - cy.get("[data-cy=contextmenu]").click(); - cy.get("[data-cy='app:logout']").click(); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); cy.url().should("include", "/login"); //----------------------------------------------------- //SPANISH @@ -48,8 +47,7 @@ describe("TRANSLATION", () => { .clear() .type("es{enter}"); - // we should be redirected to /dashboard - // cy.url().should("include", "/home-dashboard"); + cy.wait(25); //nav to about form cy.get("[data-cy=contextmenu]").click(); @@ -62,8 +60,8 @@ describe("TRANSLATION", () => { cy.contains("Navegador"); //LOGOUT - cy.get("[data-cy=contextmenu]").click(); - cy.get("[data-cy='app:logout']").click(); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); cy.url().should("include", "/login"); //------------------------- @@ -78,8 +76,7 @@ describe("TRANSLATION", () => { .clear() .type("de{enter}"); - // we should be redirected to /dashboard - // cy.url().should("include", "/home-dashboard"); + cy.wait(25); //nav to about form cy.get("[data-cy=contextmenu]").click(); @@ -92,8 +89,8 @@ describe("TRANSLATION", () => { cy.contains("Registrierter Benutzer"); //LOGOUT - cy.get("[data-cy=contextmenu]").click(); - cy.get("[data-cy='app:logout']").click(); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); cy.url().should("include", "/login"); //----------------------------------------------------- @@ -121,8 +118,8 @@ describe("TRANSLATION", () => { cy.get("[data-cy='aboutlicensedoptions]").should("not.exist"); //LOGOUT - cy.get("[data-cy=contextmenu]").click(); - cy.get("[data-cy='app:logout']").click(); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); cy.url().should("include", "/login"); //----------------------------------------------------- diff --git a/ayanova/tests/e2e/specs/widget-crud.js b/ayanova/tests/e2e/specs/widget-crud.js index 98652dba..44491f42 100644 --- a/ayanova/tests/e2e/specs/widget-crud.js +++ b/ayanova/tests/e2e/specs/widget-crud.js @@ -42,7 +42,8 @@ describe("WIDGET FORM", () => { 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.get("[data-cy=dollarAmount]").type("123.45{enter}"); + //cy.wait(25); cy.contains("Price is a required field").should("not.exist"); //start date @@ -89,12 +90,13 @@ describe("WIDGET FORM", () => { cy.get("[data-cy=name]").should("have.value", name); //delete the record + cy.get("[data-cy=contextmenu]").click(); cy.get('[data-cy="widget-edit:delete"]').click(); cy.get('[data-cy="gzconfirm:yesbutton"]').click(); // //LOGOUT - // cy.get("[data-cy=contextmenu]").click(); - // cy.get("[data-cy='app:logout']").click(); - // cy.url().should("include", "/login"); + cy.get("[data-cy=navicon]").click(); + cy.get("[data-cy=logout]").click(); + cy.url().should("include", "/login"); }); });