diff --git a/cypress/e2e/01-admin/cleanupDatabase.cy.js b/cypress/e2e/01-admin/cleanupDatabase.cy.js index 595f4838..73c56fa1 100644 --- a/cypress/e2e/01-admin/cleanupDatabase.cy.js +++ b/cypress/e2e/01-admin/cleanupDatabase.cy.js @@ -1,15 +1,13 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js"; describe("Admin - Cleanup Database", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - after(logout); - beforeEach("Loads page", () => { cy.visit("/admin/cleanup"); cy.location("pathname").should("equal", "/admin/cleanup"); }); + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); cy.checkA11y(); diff --git a/cypress/e2e/01-admin/cleanupDatabase.cy.ts b/cypress/e2e/01-admin/cleanupDatabase.cy.ts index 6709147c..3b1c1688 100644 --- a/cypress/e2e/01-admin/cleanupDatabase.cy.ts +++ b/cypress/e2e/01-admin/cleanupDatabase.cy.ts @@ -5,17 +5,15 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js"; describe("Admin - Cleanup Database", () => { - before(() => { - logout(); - login(testAdmin); - }); - - after(logout); beforeEach("Loads page", () => { + logout(); + login(testAdmin); cy.visit("/admin/cleanup"); cy.location("pathname").should("equal", "/admin/cleanup"); }); + + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); diff --git a/cypress/e2e/01-admin/configTables.cy.js b/cypress/e2e/01-admin/configTables.cy.js index 91ddf86f..12b784cb 100644 --- a/cypress/e2e/01-admin/configTables.cy.js +++ b/cypress/e2e/01-admin/configTables.cy.js @@ -1,15 +1,13 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Config Table Management", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - after(logout); - beforeEach("Loads page", () => { cy.visit("/admin/tables"); cy.location("pathname").should("equal", "/admin/tables"); }); + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.get(".tabs a").each(($tab) => { cy.wrap($tab).click({ force: true }); diff --git a/cypress/e2e/01-admin/configTables.cy.ts b/cypress/e2e/01-admin/configTables.cy.ts index 031c031b..dd25e489 100644 --- a/cypress/e2e/01-admin/configTables.cy.ts +++ b/cypress/e2e/01-admin/configTables.cy.ts @@ -5,17 +5,15 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Config Table Management", () => { - before(() => { + + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - - after(logout); - - beforeEach("Loads page", () => { cy.visit("/admin/tables"); cy.location("pathname").should("equal", "/admin/tables"); }); + + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.get(".tabs a").each(($tab) => { diff --git a/cypress/e2e/01-admin/feeManagement.cy.js b/cypress/e2e/01-admin/feeManagement.cy.js index 6ca7ee62..763c568b 100644 --- a/cypress/e2e/01-admin/feeManagement.cy.js +++ b/cypress/e2e/01-admin/feeManagement.cy.js @@ -2,15 +2,13 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js"; import * as configFunctions from "../../../helpers/functions.config.js"; describe("Admin - Fee Management", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - after(logout); - beforeEach("Loads page", () => { cy.visit("/admin/fees"); cy.location("pathname").should("equal", "/admin/fees"); }); + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); cy.checkA11y(); diff --git a/cypress/e2e/01-admin/feeManagement.cy.ts b/cypress/e2e/01-admin/feeManagement.cy.ts index 00e0f1ae..9e3c8018 100644 --- a/cypress/e2e/01-admin/feeManagement.cy.ts +++ b/cypress/e2e/01-admin/feeManagement.cy.ts @@ -9,17 +9,15 @@ import * as configFunctions from "../../../helpers/functions.config.js"; import type * as recordTypes from "../../../types/recordTypes"; describe("Admin - Fee Management", () => { - before(() => { + + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - - after(logout); - - beforeEach("Loads page", () => { cy.visit("/admin/fees"); cy.location("pathname").should("equal", "/admin/fees"); }); + + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); diff --git a/cypress/e2e/01-admin/lotTypeManagement.cy.js b/cypress/e2e/01-admin/lotTypeManagement.cy.js index ed138624..b7455be9 100644 --- a/cypress/e2e/01-admin/lotTypeManagement.cy.js +++ b/cypress/e2e/01-admin/lotTypeManagement.cy.js @@ -1,15 +1,13 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Lot Type Management", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - after(logout); - beforeEach("Loads page", () => { cy.visit("/admin/lotTypes"); cy.location("pathname").should("equal", "/admin/lotTypes"); }); + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); cy.checkA11y(); diff --git a/cypress/e2e/01-admin/lotTypeManagement.cy.ts b/cypress/e2e/01-admin/lotTypeManagement.cy.ts index 194cb100..e7892415 100644 --- a/cypress/e2e/01-admin/lotTypeManagement.cy.ts +++ b/cypress/e2e/01-admin/lotTypeManagement.cy.ts @@ -5,17 +5,15 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Lot Type Management", () => { - before(() => { + + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - - after(logout); - - beforeEach("Loads page", () => { cy.visit("/admin/lotTypes"); cy.location("pathname").should("equal", "/admin/lotTypes"); }); + + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); diff --git a/cypress/e2e/01-admin/occupancyTypeManagement.cy.js b/cypress/e2e/01-admin/occupancyTypeManagement.cy.js index 3e4b56ba..f195aa86 100644 --- a/cypress/e2e/01-admin/occupancyTypeManagement.cy.js +++ b/cypress/e2e/01-admin/occupancyTypeManagement.cy.js @@ -1,15 +1,13 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Occupancy Type Management", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - after(logout); - beforeEach("Loads page", () => { cy.visit("/admin/occupancyTypes"); cy.location("pathname").should("equal", "/admin/occupancyTypes"); }); + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); cy.checkA11y(); diff --git a/cypress/e2e/01-admin/occupancyTypeManagement.cy.ts b/cypress/e2e/01-admin/occupancyTypeManagement.cy.ts index c7b8e696..abc3aec8 100644 --- a/cypress/e2e/01-admin/occupancyTypeManagement.cy.ts +++ b/cypress/e2e/01-admin/occupancyTypeManagement.cy.ts @@ -5,17 +5,15 @@ import { testAdmin } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Admin - Occupancy Type Management", () => { - before(() => { + + beforeEach("Loads page", () => { logout(); login(testAdmin); - }); - - after(logout); - - beforeEach("Loads page", () => { cy.visit("/admin/occupancyTypes"); cy.location("pathname").should("equal", "/admin/occupancyTypes"); }); + + afterEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); diff --git a/cypress/e2e/02-update/lotOccupancies.cy.js b/cypress/e2e/02-update/lotOccupancies.cy.js index 934c4e32..266a57ab 100644 --- a/cypress/e2e/02-update/lotOccupancies.cy.js +++ b/cypress/e2e/02-update/lotOccupancies.cy.js @@ -1,19 +1,19 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update - Lot Occupancies", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testUpdate); }); + afterEach(logout); it('Has a "Create" link on the Lot Occupancy Search', () => { cy.visit("/lotOccupancies"); + cy.location("pathname").should("equal", "/lotOccupancies"); cy.get("a[href$='/lotOccupancies/new']").should("exist"); }); describe("Update a New Lot Occupancy", () => { - before(() => { - cy.visit("/lotOccupancies/new"); - }); it("Has no detectable accessibility issues", () => { + cy.visit("/lotOccupancies/new"); cy.injectAxe(); cy.checkA11y(); }); diff --git a/cypress/e2e/02-update/lotOccupancies.cy.ts b/cypress/e2e/02-update/lotOccupancies.cy.ts index e58559ff..0816e681 100644 --- a/cypress/e2e/02-update/lotOccupancies.cy.ts +++ b/cypress/e2e/02-update/lotOccupancies.cy.ts @@ -3,22 +3,24 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update - Lot Occupancies", () => { - before(() => { + + beforeEach("Loads page", () => { logout(); login(testUpdate); }); - + + afterEach(logout); + it('Has a "Create" link on the Lot Occupancy Search', () => { cy.visit("/lotOccupancies"); + cy.location("pathname").should("equal", "/lotOccupancies"); cy.get("a[href$='/lotOccupancies/new']").should("exist"); }); describe("Update a New Lot Occupancy", () => { - before(() => { - cy.visit("/lotOccupancies/new"); - }); it("Has no detectable accessibility issues", () => { + cy.visit("/lotOccupancies/new"); cy.injectAxe(); cy.checkA11y(); }); diff --git a/cypress/e2e/02-update/lots.cy.js b/cypress/e2e/02-update/lots.cy.js index 38a02b1e..3a7c544e 100644 --- a/cypress/e2e/02-update/lots.cy.js +++ b/cypress/e2e/02-update/lots.cy.js @@ -1,19 +1,19 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update - Lots", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testUpdate); }); + afterEach(logout); it('Has a "Create" link on the Lot Search', () => { cy.visit("/lots"); + cy.location("pathname").should("equal", "/lots"); cy.get("a[href$='/lots/new']").should("exist"); }); describe("Update a New Lot", () => { - before(() => { - cy.visit("/lots/new"); - }); it("Has no detectable accessibility issues", () => { + cy.visit("/lots/new"); cy.injectAxe(); cy.checkA11y(); }); diff --git a/cypress/e2e/02-update/lots.cy.ts b/cypress/e2e/02-update/lots.cy.ts index 9083e481..59a1503f 100644 --- a/cypress/e2e/02-update/lots.cy.ts +++ b/cypress/e2e/02-update/lots.cy.ts @@ -3,22 +3,22 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update - Lots", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testUpdate); }); + afterEach(logout); + it('Has a "Create" link on the Lot Search', () => { cy.visit("/lots"); + cy.location("pathname").should("equal", "/lots"); cy.get("a[href$='/lots/new']").should("exist"); }); describe("Update a New Lot", () => { - before(() => { - cy.visit("/lots/new"); - }); - it("Has no detectable accessibility issues", () => { + cy.visit("/lots/new"); cy.injectAxe(); cy.checkA11y(); }); diff --git a/cypress/e2e/02-update/maps.cy.js b/cypress/e2e/02-update/maps.cy.js index 98b4ceca..b6eed676 100644 --- a/cypress/e2e/02-update/maps.cy.js +++ b/cypress/e2e/02-update/maps.cy.js @@ -2,56 +2,50 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; import * as configFunctions from "../../../helpers/functions.config.js"; describe("Update - Maps", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testUpdate); }); + afterEach(logout); it('Has a "Create" link on the Map Search', () => { cy.visit("/maps"); + cy.location("pathname").should("equal", "/maps"); cy.get("a[href$='/maps/new']").should("exist"); }); - describe("Update a New Map", () => { - before(() => { - cy.visit("/maps/new"); + it("Creates a new map", () => { + cy.visit("/maps/new"); + cy.log("Check the accessibility"); + cy.injectAxe(); + cy.checkA11y(); + cy.log("Populate the fields"); + cy.fixture("map.json").then((mapJSON) => { + cy.get("input[name='mapName']").clear().type(mapJSON.mapName); + cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription); + cy.get("input[name='mapAddress1']").clear().type(mapJSON.mapAddress1); + cy.get("input[name='mapAddress2']").clear().type(mapJSON.mapAddress2); + cy.get("input[name='mapPostalCode']").clear().type(mapJSON.mapPostalCode); + cy.get("input[name='mapPhoneNumber']").clear().type(mapJSON.mapPhoneNumber); + cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); + cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString()); }); - it("Has no detectable accessibility issues", () => { - cy.injectAxe(); - cy.checkA11y(); - }); - it("Can populate basic details", () => { - cy.fixture("map.json").then((mapJSON) => { - cy.get("input[name='mapName']").clear().type(mapJSON.mapName); - cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription); - cy.get("input[name='mapAddress1']").clear().type(mapJSON.mapAddress1); - cy.get("input[name='mapAddress2']").clear().type(mapJSON.mapAddress2); - cy.get("input[name='mapPostalCode']").clear().type(mapJSON.mapPostalCode); - cy.get("input[name='mapPhoneNumber']").clear().type(mapJSON.mapPhoneNumber); - cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); - cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString()); - }); - }); - it("Should use the default map city and province", () => { + cy.log("Ensure the default city and province are used"); + cy.get("input[name='mapCity']").should("have.value", configFunctions.getProperty("settings.map.mapCityDefault")); + cy.get("input[name='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault")); + cy.log("Submit the form"); + cy.get("#form--map").submit(); + cy.wait(1000); + cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); + cy.fixture("map.json").then((mapJSON) => { + cy.get("input[name='mapName']").should("have.value", mapJSON.mapName); + cy.get("textarea[name='mapDescription']").should("have.value", mapJSON.mapDescription); + cy.get("input[name='mapAddress1']").should("have.value", mapJSON.mapAddress1); + cy.get("input[name='mapAddress2']").should("have.value", mapJSON.mapAddress2); cy.get("input[name='mapCity']").should("have.value", configFunctions.getProperty("settings.map.mapCityDefault")); cy.get("input[name='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault")); - }); - it("Should submit form and create the map", () => { - cy.get("#form--map").submit(); - cy.wait(1000); - cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); - }); - it("Should be populated as expected", () => { - cy.fixture("map.json").then((mapJSON) => { - cy.get("input[name='mapName']").should("have.value", mapJSON.mapName); - cy.get("textarea[name='mapDescription']").should("have.value", mapJSON.mapDescription); - cy.get("input[name='mapAddress1']").should("have.value", mapJSON.mapAddress1); - cy.get("input[name='mapAddress2']").should("have.value", mapJSON.mapAddress2); - cy.get("input[name='mapCity']").should("have.value", configFunctions.getProperty("settings.map.mapCityDefault")); - cy.get("input[name='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault")); - cy.get("input[name='mapPostalCode']").should("have.value", mapJSON.mapPostalCode); - cy.get("input[name='mapPhoneNumber']").should("have.value", mapJSON.mapPhoneNumber); - cy.get("input[name='mapLatitude']").should("have.value", mapJSON.mapLatitude.toString()); - cy.get("input[name='mapLongitude']").should("have.value", mapJSON.mapLongitude.toString()); - }); + cy.get("input[name='mapPostalCode']").should("have.value", mapJSON.mapPostalCode); + cy.get("input[name='mapPhoneNumber']").should("have.value", mapJSON.mapPhoneNumber); + cy.get("input[name='mapLatitude']").should("have.value", mapJSON.mapLatitude.toString()); + cy.get("input[name='mapLongitude']").should("have.value", mapJSON.mapLongitude.toString()); }); }); }); diff --git a/cypress/e2e/02-update/maps.cy.ts b/cypress/e2e/02-update/maps.cy.ts index ca401f93..c39fb73f 100644 --- a/cypress/e2e/02-update/maps.cy.ts +++ b/cypress/e2e/02-update/maps.cy.ts @@ -7,80 +7,91 @@ import * as configFunctions from "../../../helpers/functions.config.js"; import type * as recordTypes from "../../../types/recordTypes"; describe("Update - Maps", () => { - before(() => { + beforeEach("Loads page", () => { logout(); login(testUpdate); }); + afterEach(logout); + it('Has a "Create" link on the Map Search', () => { cy.visit("/maps"); + cy.location("pathname").should("equal", "/maps"); cy.get("a[href$='/maps/new']").should("exist"); }); - describe("Update a New Map", () => { - before(() => { - cy.visit("/maps/new"); + it("Creates a new map", () => { + cy.visit("/maps/new"); + + cy.log("Check the accessibility"); + + cy.injectAxe(); + cy.checkA11y(); + + cy.log("Populate the fields"); + + // eslint-disable-next-line promise/catch-or-return, promise/always-return + cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { + cy.get("input[name='mapName']").clear().type(mapJSON.mapName); + cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription); + + cy.get("input[name='mapAddress1']").clear().type(mapJSON.mapAddress1); + cy.get("input[name='mapAddress2']").clear().type(mapJSON.mapAddress2); + cy.get("input[name='mapPostalCode']").clear().type(mapJSON.mapPostalCode); + cy.get("input[name='mapPhoneNumber']").clear().type(mapJSON.mapPhoneNumber); + + cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); + cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString()); }); - it("Has no detectable accessibility issues", () => { - cy.injectAxe(); - cy.checkA11y(); - }); + cy.log("Ensure the default city and province are used"); - it("Can populate basic details", () => { - // eslint-disable-next-line promise/catch-or-return, promise/always-return - cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { - cy.get("input[name='mapName']").clear().type(mapJSON.mapName); - cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription); + cy.get("input[name='mapCity']").should( + "have.value", + configFunctions.getProperty("settings.map.mapCityDefault") + ); - cy.get("input[name='mapAddress1']").clear().type(mapJSON.mapAddress1); - cy.get("input[name='mapAddress2']").clear().type(mapJSON.mapAddress2); - cy.get("input[name='mapPostalCode']").clear().type(mapJSON.mapPostalCode); - cy.get("input[name='mapPhoneNumber']").clear().type(mapJSON.mapPhoneNumber); + cy.get("input[name='mapProvince']").should( + "have.value", + configFunctions.getProperty("settings.map.mapProvinceDefault") + ); - cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); - cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString()); - }); - }); + cy.log("Submit the form"); + + cy.get("#form--map").submit(); + + cy.wait(1000); + + cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); + + // eslint-disable-next-line promise/catch-or-return, promise/always-return + cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { + cy.get("input[name='mapName']").should("have.value", mapJSON.mapName); + cy.get("textarea[name='mapDescription']").should("have.value", mapJSON.mapDescription); + + cy.get("input[name='mapAddress1']").should("have.value", mapJSON.mapAddress1); + cy.get("input[name='mapAddress2']").should("have.value", mapJSON.mapAddress2); - it("Should use the default map city and province", () => { cy.get("input[name='mapCity']").should( "have.value", configFunctions.getProperty("settings.map.mapCityDefault") ); - cy.get("input[name='mapProvince']").should( "have.value", configFunctions.getProperty("settings.map.mapProvinceDefault") ); - }); - it("Should submit form and create the map", () => { - cy.get("#form--map").submit(); + cy.get("input[name='mapPostalCode']").should("have.value", mapJSON.mapPostalCode); + cy.get("input[name='mapPhoneNumber']").should("have.value", mapJSON.mapPhoneNumber); - cy.wait(1000); - - cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); - }); - - it("Should be populated as expected", () => { - // eslint-disable-next-line promise/catch-or-return, promise/always-return - cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { - cy.get("input[name='mapName']").should("have.value",mapJSON.mapName); - cy.get("textarea[name='mapDescription']").should("have.value",mapJSON.mapDescription); - - cy.get("input[name='mapAddress1']").should("have.value",mapJSON.mapAddress1); - cy.get("input[name='mapAddress2']").should("have.value",mapJSON.mapAddress2); - - cy.get("input[name='mapCity']").should("have.value", configFunctions.getProperty("settings.map.mapCityDefault")); - cy.get("input[name='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault")); - - cy.get("input[name='mapPostalCode']").should("have.value",mapJSON.mapPostalCode); - cy.get("input[name='mapPhoneNumber']").should("have.value",mapJSON.mapPhoneNumber); - - cy.get("input[name='mapLatitude']").should("have.value",mapJSON.mapLatitude.toString()); - cy.get("input[name='mapLongitude']").should("have.value",mapJSON.mapLongitude.toString()); - }); + cy.get("input[name='mapLatitude']").should( + "have.value", + mapJSON.mapLatitude.toString() + ); + cy.get("input[name='mapLongitude']").should( + "have.value", + mapJSON.mapLongitude.toString() + ); }); }); }); diff --git a/cypress/e2e/02-update/updateUser.cy.js b/cypress/e2e/02-update/updateUser.cy.js index 0e7fd264..b6af8181 100644 --- a/cypress/e2e/02-update/updateUser.cy.js +++ b/cypress/e2e/02-update/updateUser.cy.js @@ -1,22 +1,18 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update User", () => { - before(logout); - after(logout); - it("Logs In Successfully", () => { + beforeEach("Loads page", () => { + logout(); login(testUpdate); }); - describe("Dashboard", () => { - before(() => { - cy.visit("/dashboard"); - }); - it("Has no detectable accessibility issues", () => { - cy.injectAxe(); - cy.checkA11y(); - }); - it("Has no links to admin areas", () => { - cy.get("a[href*='/admin']").should("not.exist"); - }); + afterEach(logout); + it("Has an Update User dashboard", () => { + cy.visit("/dashboard"); + cy.log("Has no detectable accessibility issues"); + cy.injectAxe(); + cy.checkA11y(); + cy.log("Has no links to admin areas"); + cy.get("a[href*='/admin']").should("not.exist"); }); it("Redirects to Dashboard when attempting to access admin area", () => { cy.visit("/admin/cleanup"); diff --git a/cypress/e2e/02-update/updateUser.cy.ts b/cypress/e2e/02-update/updateUser.cy.ts index bd843f96..ee3623e5 100644 --- a/cypress/e2e/02-update/updateUser.cy.ts +++ b/cypress/e2e/02-update/updateUser.cy.ts @@ -3,27 +3,24 @@ import { testUpdate } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Update User", () => { - before(logout); - - after(logout); - - it("Logs In Successfully", () => { + beforeEach("Loads page", () => { + logout(); login(testUpdate); }); - describe("Dashboard", () => { - before(() => { - cy.visit("/dashboard"); - }); + afterEach(logout); - it("Has no detectable accessibility issues", () => { - cy.injectAxe(); - cy.checkA11y(); - }); + it("Has an Update User dashboard", () => { + cy.visit("/dashboard"); - it("Has no links to admin areas", () => { - cy.get("a[href*='/admin']").should("not.exist"); - }); + cy.log("Has no detectable accessibility issues"); + + cy.injectAxe(); + cy.checkA11y(); + + cy.log("Has no links to admin areas"); + + cy.get("a[href*='/admin']").should("not.exist"); }); it("Redirects to Dashboard when attempting to access admin area", () => { diff --git a/cypress/e2e/03-readOnly/readOnlyUser.cy.js b/cypress/e2e/03-readOnly/readOnlyUser.cy.js index b1d94215..832a173f 100644 --- a/cypress/e2e/03-readOnly/readOnlyUser.cy.js +++ b/cypress/e2e/03-readOnly/readOnlyUser.cy.js @@ -1,25 +1,20 @@ import { testView } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Read Only User", () => { - before(logout); - after(logout); - it("Logs In Successfully", () => { + beforeEach(() => { + logout(); login(testView); }); - describe("Dashboard", () => { - before(() => { - cy.visit("/dashboard"); - }); - it("Has no detectable accessibility issues", () => { - cy.injectAxe(); - cy.checkA11y(); - }); - it("Has no links to new areas", () => { - cy.get("a[href*='/new']").should("not.exist"); - }); - it("Has no links to admin areas", () => { - cy.get("a[href*='/admin']").should("not.exist"); - }); + afterEach(logout); + it("Has a Read Only User dashboard", () => { + cy.visit("/dashboard"); + cy.log("Has no detectable accessibility issues"); + cy.injectAxe(); + cy.checkA11y(); + cy.log("Has no links to new areas"); + cy.get("a[href*='/new']").should("not.exist"); + cy.log("Has no links to admin areas"); + cy.get("a[href*='/admin']").should("not.exist"); }); it("Has no link to create maps on Map Search", () => { cy.visit("/maps"); diff --git a/cypress/e2e/03-readOnly/readOnlyUser.cy.ts b/cypress/e2e/03-readOnly/readOnlyUser.cy.ts index 265729b0..780eeb68 100644 --- a/cypress/e2e/03-readOnly/readOnlyUser.cy.ts +++ b/cypress/e2e/03-readOnly/readOnlyUser.cy.ts @@ -3,31 +3,29 @@ import { testView } from "../../../test/_globals.js"; import { logout, login } from "../../support/index.js"; describe("Read Only User", () => { - before(logout); - - after(logout); - - it("Logs In Successfully", () => { + + beforeEach(() => { + logout(); login(testView); }); + + afterEach(logout); - describe("Dashboard", () => { - before(() => { - cy.visit("/dashboard"); - }); + it("Has a Read Only User dashboard", () => { + cy.visit("/dashboard"); - it("Has no detectable accessibility issues", () => { + cy.log("Has no detectable accessibility issues"); cy.injectAxe(); cy.checkA11y(); - }); + - it("Has no links to new areas", () => { - cy.get("a[href*='/new']").should("not.exist"); - }); - - it("Has no links to admin areas", () => { - cy.get("a[href*='/admin']").should("not.exist"); - }); + cy.log("Has no links to new areas"); + + cy.get("a[href*='/new']").should("not.exist"); + + cy.log("Has no links to admin areas"); + + cy.get("a[href*='/admin']").should("not.exist"); }); it("Has no link to create maps on Map Search", () => { diff --git a/cypress/e2e/xx-other/loginPage.cy.js b/cypress/e2e/xx-other/loginPage.cy.js index 5d0bc5ec..8bd451df 100644 --- a/cypress/e2e/xx-other/loginPage.cy.js +++ b/cypress/e2e/xx-other/loginPage.cy.js @@ -1,6 +1,6 @@ import { logout } from "../../support/index.js"; describe("Login Page", () => { - before(logout); + beforeEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); cy.checkA11y(); diff --git a/cypress/e2e/xx-other/loginPage.cy.ts b/cypress/e2e/xx-other/loginPage.cy.ts index f6318a0e..d90cba64 100644 --- a/cypress/e2e/xx-other/loginPage.cy.ts +++ b/cypress/e2e/xx-other/loginPage.cy.ts @@ -1,7 +1,7 @@ import { logout } from "../../support/index.js"; describe("Login Page", () => { - before(logout); + beforeEach(logout); it("Has no detectable accessibility issues", () => { cy.injectAxe(); diff --git a/cypress/support/index.js b/cypress/support/index.js index 104ff753..4427555c 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,14 +1,10 @@ import "cypress-axe"; -Cypress.Cookies.defaults({ - preserve: ["_csrf", "lot-occupancy-system-user-sid"] -}); export const logout = () => { cy.visit("/logout"); }; export const login = (userName) => { cy.visit("/login"); - cy.get(".message") - .contains("Testing", { + cy.get(".message").contains("Testing", { matchCase: false }); cy.get("form [name='userName']").type(userName); diff --git a/cypress/support/index.ts b/cypress/support/index.ts index 79260efc..692029b5 100644 --- a/cypress/support/index.ts +++ b/cypress/support/index.ts @@ -2,24 +2,16 @@ import "cypress-axe"; - -Cypress.Cookies.defaults({ - preserve: ["_csrf", "lot-occupancy-system-user-sid"] -}); - - export const logout = (): void => { cy.visit("/logout"); }; - export const login = (userName: string): void => { cy.visit("/login"); - cy.get(".message") - .contains("Testing", { - matchCase: false - }); + cy.get(".message").contains("Testing", { + matchCase: false + }); cy.get("form [name='userName']").type(userName); cy.get("form [name='password']").type(userName); @@ -32,5 +24,4 @@ export const login = (userName: string): void => { cy.get(".navbar").should("have.length", 1); }; - -export const ajaxDelayMillis = 800; \ No newline at end of file +export const ajaxDelayMillis = 800;