update for cypress 12

deepsource-autofix-76c6eb20
Dan Gowans 2022-12-21 15:16:10 -05:00
parent 1e9161032a
commit a1348fedbc
24 changed files with 202 additions and 242 deletions

View File

@ -1,15 +1,13 @@
import { testAdmin } from "../../../test/_globals.js"; import { testAdmin } from "../../../test/_globals.js";
import { logout, login, ajaxDelayMillis } from "../../support/index.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js";
describe("Admin - Cleanup Database", () => { describe("Admin - Cleanup Database", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testAdmin); login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/cleanup"); cy.visit("/admin/cleanup");
cy.location("pathname").should("equal", "/admin/cleanup"); cy.location("pathname").should("equal", "/admin/cleanup");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -5,18 +5,16 @@ import { testAdmin } from "../../../test/_globals.js";
import { logout, login, ajaxDelayMillis } from "../../support/index.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js";
describe("Admin - Cleanup Database", () => { describe("Admin - Cleanup Database", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => { beforeEach("Loads page", () => {
logout();
login(testAdmin);
cy.visit("/admin/cleanup"); cy.visit("/admin/cleanup");
cy.location("pathname").should("equal", "/admin/cleanup"); cy.location("pathname").should("equal", "/admin/cleanup");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -1,15 +1,13 @@
import { testAdmin } from "../../../test/_globals.js"; import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Config Table Management", () => { describe("Admin - Config Table Management", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testAdmin); login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/tables"); cy.visit("/admin/tables");
cy.location("pathname").should("equal", "/admin/tables"); cy.location("pathname").should("equal", "/admin/tables");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.get(".tabs a").each(($tab) => { cy.get(".tabs a").each(($tab) => {
cy.wrap($tab).click({ force: true }); cy.wrap($tab).click({ force: true });

View File

@ -5,18 +5,16 @@ import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Config Table Management", () => { describe("Admin - Config Table Management", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => { beforeEach("Loads page", () => {
logout();
login(testAdmin);
cy.visit("/admin/tables"); cy.visit("/admin/tables");
cy.location("pathname").should("equal", "/admin/tables"); cy.location("pathname").should("equal", "/admin/tables");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.get(".tabs a").each(($tab) => { cy.get(".tabs a").each(($tab) => {
cy.wrap($tab).click({ force: true }); cy.wrap($tab).click({ force: true });

View File

@ -2,15 +2,13 @@ import { testAdmin } from "../../../test/_globals.js";
import { logout, login, ajaxDelayMillis } from "../../support/index.js"; import { logout, login, ajaxDelayMillis } from "../../support/index.js";
import * as configFunctions from "../../../helpers/functions.config.js"; import * as configFunctions from "../../../helpers/functions.config.js";
describe("Admin - Fee Management", () => { describe("Admin - Fee Management", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testAdmin); login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/fees"); cy.visit("/admin/fees");
cy.location("pathname").should("equal", "/admin/fees"); cy.location("pathname").should("equal", "/admin/fees");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -9,18 +9,16 @@ import * as configFunctions from "../../../helpers/functions.config.js";
import type * as recordTypes from "../../../types/recordTypes"; import type * as recordTypes from "../../../types/recordTypes";
describe("Admin - Fee Management", () => { describe("Admin - Fee Management", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => { beforeEach("Loads page", () => {
logout();
login(testAdmin);
cy.visit("/admin/fees"); cy.visit("/admin/fees");
cy.location("pathname").should("equal", "/admin/fees"); cy.location("pathname").should("equal", "/admin/fees");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -1,15 +1,13 @@
import { testAdmin } from "../../../test/_globals.js"; import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Lot Type Management", () => { describe("Admin - Lot Type Management", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testAdmin); login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/lotTypes"); cy.visit("/admin/lotTypes");
cy.location("pathname").should("equal", "/admin/lotTypes"); cy.location("pathname").should("equal", "/admin/lotTypes");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -5,18 +5,16 @@ import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Lot Type Management", () => { describe("Admin - Lot Type Management", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => { beforeEach("Loads page", () => {
logout();
login(testAdmin);
cy.visit("/admin/lotTypes"); cy.visit("/admin/lotTypes");
cy.location("pathname").should("equal", "/admin/lotTypes"); cy.location("pathname").should("equal", "/admin/lotTypes");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -1,15 +1,13 @@
import { testAdmin } from "../../../test/_globals.js"; import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Occupancy Type Management", () => { describe("Admin - Occupancy Type Management", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testAdmin); login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/occupancyTypes"); cy.visit("/admin/occupancyTypes");
cy.location("pathname").should("equal", "/admin/occupancyTypes"); cy.location("pathname").should("equal", "/admin/occupancyTypes");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -5,18 +5,16 @@ import { testAdmin } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Admin - Occupancy Type Management", () => { describe("Admin - Occupancy Type Management", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => { beforeEach("Loads page", () => {
logout();
login(testAdmin);
cy.visit("/admin/occupancyTypes"); cy.visit("/admin/occupancyTypes");
cy.location("pathname").should("equal", "/admin/occupancyTypes"); cy.location("pathname").should("equal", "/admin/occupancyTypes");
}); });
afterEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -1,19 +1,19 @@
import { testUpdate } from "../../../test/_globals.js"; import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update - Lot Occupancies", () => { describe("Update - Lot Occupancies", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Lot Occupancy Search', () => { it('Has a "Create" link on the Lot Occupancy Search', () => {
cy.visit("/lotOccupancies"); cy.visit("/lotOccupancies");
cy.location("pathname").should("equal", "/lotOccupancies");
cy.get("a[href$='/lotOccupancies/new']").should("exist"); cy.get("a[href$='/lotOccupancies/new']").should("exist");
}); });
describe("Update a New Lot Occupancy", () => { describe("Update a New Lot Occupancy", () => {
before(() => {
cy.visit("/lotOccupancies/new");
});
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.visit("/lotOccupancies/new");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); });

View File

@ -3,22 +3,24 @@ import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update - Lot Occupancies", () => { describe("Update - Lot Occupancies", () => {
before(() => {
beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Lot Occupancy Search', () => { it('Has a "Create" link on the Lot Occupancy Search', () => {
cy.visit("/lotOccupancies"); cy.visit("/lotOccupancies");
cy.location("pathname").should("equal", "/lotOccupancies");
cy.get("a[href$='/lotOccupancies/new']").should("exist"); cy.get("a[href$='/lotOccupancies/new']").should("exist");
}); });
describe("Update a New Lot Occupancy", () => { describe("Update a New Lot Occupancy", () => {
before(() => {
cy.visit("/lotOccupancies/new");
});
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.visit("/lotOccupancies/new");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); });

View File

@ -1,19 +1,19 @@
import { testUpdate } from "../../../test/_globals.js"; import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update - Lots", () => { describe("Update - Lots", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Lot Search', () => { it('Has a "Create" link on the Lot Search', () => {
cy.visit("/lots"); cy.visit("/lots");
cy.location("pathname").should("equal", "/lots");
cy.get("a[href$='/lots/new']").should("exist"); cy.get("a[href$='/lots/new']").should("exist");
}); });
describe("Update a New Lot", () => { describe("Update a New Lot", () => {
before(() => {
cy.visit("/lots/new");
});
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.visit("/lots/new");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); });

View File

@ -3,22 +3,22 @@ import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update - Lots", () => { describe("Update - Lots", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Lot Search', () => { it('Has a "Create" link on the Lot Search', () => {
cy.visit("/lots"); cy.visit("/lots");
cy.location("pathname").should("equal", "/lots");
cy.get("a[href$='/lots/new']").should("exist"); cy.get("a[href$='/lots/new']").should("exist");
}); });
describe("Update a New Lot", () => { describe("Update a New Lot", () => {
before(() => {
cy.visit("/lots/new");
});
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.visit("/lots/new");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); });

View File

@ -2,23 +2,22 @@ import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
import * as configFunctions from "../../../helpers/functions.config.js"; import * as configFunctions from "../../../helpers/functions.config.js";
describe("Update - Maps", () => { describe("Update - Maps", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Map Search', () => { it('Has a "Create" link on the Map Search', () => {
cy.visit("/maps"); cy.visit("/maps");
cy.location("pathname").should("equal", "/maps");
cy.get("a[href$='/maps/new']").should("exist"); cy.get("a[href$='/maps/new']").should("exist");
}); });
describe("Update a New Map", () => { it("Creates a new map", () => {
before(() => {
cy.visit("/maps/new"); cy.visit("/maps/new");
}); cy.log("Check the accessibility");
it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); cy.log("Populate the fields");
it("Can populate basic details", () => {
cy.fixture("map.json").then((mapJSON) => { cy.fixture("map.json").then((mapJSON) => {
cy.get("input[name='mapName']").clear().type(mapJSON.mapName); cy.get("input[name='mapName']").clear().type(mapJSON.mapName);
cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription); cy.get("textarea[name='mapDescription']").clear().type(mapJSON.mapDescription);
@ -29,17 +28,13 @@ describe("Update - Maps", () => {
cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString());
cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString()); cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.toString());
}); });
}); cy.log("Ensure the default city and province are used");
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='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='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault"));
}); cy.log("Submit the form");
it("Should submit form and create the map", () => {
cy.get("#form--map").submit(); cy.get("#form--map").submit();
cy.wait(1000); cy.wait(1000);
cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); cy.location("pathname").should("not.contain", "/new").should("contain", "/edit");
});
it("Should be populated as expected", () => {
cy.fixture("map.json").then((mapJSON) => { cy.fixture("map.json").then((mapJSON) => {
cy.get("input[name='mapName']").should("have.value", mapJSON.mapName); cy.get("input[name='mapName']").should("have.value", mapJSON.mapName);
cy.get("textarea[name='mapDescription']").should("have.value", mapJSON.mapDescription); cy.get("textarea[name='mapDescription']").should("have.value", mapJSON.mapDescription);
@ -54,4 +49,3 @@ describe("Update - Maps", () => {
}); });
}); });
}); });
});

View File

@ -7,27 +7,29 @@ import * as configFunctions from "../../../helpers/functions.config.js";
import type * as recordTypes from "../../../types/recordTypes"; import type * as recordTypes from "../../../types/recordTypes";
describe("Update - Maps", () => { describe("Update - Maps", () => {
before(() => { beforeEach("Loads page", () => {
logout(); logout();
login(testUpdate); login(testUpdate);
}); });
afterEach(logout);
it('Has a "Create" link on the Map Search', () => { it('Has a "Create" link on the Map Search', () => {
cy.visit("/maps"); cy.visit("/maps");
cy.location("pathname").should("equal", "/maps");
cy.get("a[href$='/maps/new']").should("exist"); cy.get("a[href$='/maps/new']").should("exist");
}); });
describe("Update a New Map", () => { it("Creates a new map", () => {
before(() => {
cy.visit("/maps/new"); cy.visit("/maps/new");
});
it("Has no detectable accessibility issues", () => { cy.log("Check the accessibility");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
});
it("Can populate basic details", () => { cy.log("Populate the fields");
// eslint-disable-next-line promise/catch-or-return, promise/always-return // eslint-disable-next-line promise/catch-or-return, promise/always-return
cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { cy.fixture("map.json").then((mapJSON: recordTypes.Map) => {
cy.get("input[name='mapName']").clear().type(mapJSON.mapName); cy.get("input[name='mapName']").clear().type(mapJSON.mapName);
@ -41,9 +43,9 @@ describe("Update - Maps", () => {
cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString()); cy.get("input[name='mapLatitude']").clear().type(mapJSON.mapLatitude.toString());
cy.get("input[name='mapLongitude']").clear().type(mapJSON.mapLongitude.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( cy.get("input[name='mapCity']").should(
"have.value", "have.value",
configFunctions.getProperty("settings.map.mapCityDefault") configFunctions.getProperty("settings.map.mapCityDefault")
@ -53,17 +55,15 @@ describe("Update - Maps", () => {
"have.value", "have.value",
configFunctions.getProperty("settings.map.mapProvinceDefault") configFunctions.getProperty("settings.map.mapProvinceDefault")
); );
});
it("Should submit form and create the map", () => { cy.log("Submit the form");
cy.get("#form--map").submit(); cy.get("#form--map").submit();
cy.wait(1000); cy.wait(1000);
cy.location("pathname").should("not.contain", "/new").should("contain", "/edit"); 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 // eslint-disable-next-line promise/catch-or-return, promise/always-return
cy.fixture("map.json").then((mapJSON: recordTypes.Map) => { cy.fixture("map.json").then((mapJSON: recordTypes.Map) => {
cy.get("input[name='mapName']").should("have.value", mapJSON.mapName); cy.get("input[name='mapName']").should("have.value", mapJSON.mapName);
@ -72,15 +72,26 @@ describe("Update - Maps", () => {
cy.get("input[name='mapAddress1']").should("have.value", mapJSON.mapAddress1); cy.get("input[name='mapAddress1']").should("have.value", mapJSON.mapAddress1);
cy.get("input[name='mapAddress2']").should("have.value", mapJSON.mapAddress2); 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='mapCity']").should(
cy.get("input[name='mapProvince']").should("have.value", configFunctions.getProperty("settings.map.mapProvinceDefault")); "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='mapPostalCode']").should("have.value", mapJSON.mapPostalCode);
cy.get("input[name='mapPhoneNumber']").should("have.value", mapJSON.mapPhoneNumber); 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='mapLatitude']").should(
cy.get("input[name='mapLongitude']").should("have.value",mapJSON.mapLongitude.toString()); "have.value",
}); mapJSON.mapLatitude.toString()
);
cy.get("input[name='mapLongitude']").should(
"have.value",
mapJSON.mapLongitude.toString()
);
}); });
}); });
}); });

View File

@ -1,23 +1,19 @@
import { testUpdate } from "../../../test/_globals.js"; import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update User", () => { describe("Update User", () => {
before(logout); beforeEach("Loads page", () => {
after(logout); logout();
it("Logs In Successfully", () => {
login(testUpdate); login(testUpdate);
}); });
describe("Dashboard", () => { afterEach(logout);
before(() => { it("Has an Update User dashboard", () => {
cy.visit("/dashboard"); cy.visit("/dashboard");
}); cy.log("Has no detectable accessibility issues");
it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); cy.log("Has no links to admin areas");
it("Has no links to admin areas", () => {
cy.get("a[href*='/admin']").should("not.exist"); cy.get("a[href*='/admin']").should("not.exist");
}); });
});
it("Redirects to Dashboard when attempting to access admin area", () => { it("Redirects to Dashboard when attempting to access admin area", () => {
cy.visit("/admin/cleanup"); cy.visit("/admin/cleanup");
cy.wait(200); cy.wait(200);

View File

@ -3,28 +3,25 @@ import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Update User", () => { describe("Update User", () => {
before(logout); beforeEach("Loads page", () => {
logout();
after(logout);
it("Logs In Successfully", () => {
login(testUpdate); login(testUpdate);
}); });
describe("Dashboard", () => { afterEach(logout);
before(() => {
cy.visit("/dashboard"); it("Has an Update User dashboard", () => {
}); cy.visit("/dashboard");
cy.log("Has no detectable accessibility issues");
it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
});
it("Has no links to admin areas", () => { cy.log("Has no links to admin areas");
cy.get("a[href*='/admin']").should("not.exist"); cy.get("a[href*='/admin']").should("not.exist");
}); });
});
it("Redirects to Dashboard when attempting to access admin area", () => { it("Redirects to Dashboard when attempting to access admin area", () => {
cy.visit("/admin/cleanup"); cy.visit("/admin/cleanup");

View File

@ -1,26 +1,21 @@
import { testView } from "../../../test/_globals.js"; import { testView } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Read Only User", () => { describe("Read Only User", () => {
before(logout); beforeEach(() => {
after(logout); logout();
it("Logs In Successfully", () => {
login(testView); login(testView);
}); });
describe("Dashboard", () => { afterEach(logout);
before(() => { it("Has a Read Only User dashboard", () => {
cy.visit("/dashboard"); cy.visit("/dashboard");
}); cy.log("Has no detectable accessibility issues");
it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
}); cy.log("Has no links to new areas");
it("Has no links to new areas", () => {
cy.get("a[href*='/new']").should("not.exist"); cy.get("a[href*='/new']").should("not.exist");
}); cy.log("Has no links to admin areas");
it("Has no links to admin areas", () => {
cy.get("a[href*='/admin']").should("not.exist"); cy.get("a[href*='/admin']").should("not.exist");
}); });
});
it("Has no link to create maps on Map Search", () => { it("Has no link to create maps on Map Search", () => {
cy.visit("/maps"); cy.visit("/maps");
cy.get("a[href*='/new']").should("not.exist"); cy.get("a[href*='/new']").should("not.exist");

View File

@ -3,32 +3,30 @@ import { testView } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js"; import { logout, login } from "../../support/index.js";
describe("Read Only User", () => { describe("Read Only User", () => {
before(logout);
after(logout); beforeEach(() => {
logout();
it("Logs In Successfully", () => {
login(testView); login(testView);
}); });
describe("Dashboard", () => { afterEach(logout);
before(() => {
cy.visit("/dashboard");
});
it("Has no detectable accessibility issues", () => { it("Has a Read Only User dashboard", () => {
cy.visit("/dashboard");
cy.log("Has no detectable accessibility issues");
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();
});
it("Has no links to new areas", () => {
cy.log("Has no links to new areas");
cy.get("a[href*='/new']").should("not.exist"); cy.get("a[href*='/new']").should("not.exist");
});
it("Has no links to admin areas", () => { cy.log("Has no links to admin areas");
cy.get("a[href*='/admin']").should("not.exist"); cy.get("a[href*='/admin']").should("not.exist");
}); });
});
it("Has no link to create maps on Map Search", () => { it("Has no link to create maps on Map Search", () => {
cy.visit("/maps"); cy.visit("/maps");

View File

@ -1,6 +1,6 @@
import { logout } from "../../support/index.js"; import { logout } from "../../support/index.js";
describe("Login Page", () => { describe("Login Page", () => {
before(logout); beforeEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();
cy.checkA11y(); cy.checkA11y();

View File

@ -1,7 +1,7 @@
import { logout } from "../../support/index.js"; import { logout } from "../../support/index.js";
describe("Login Page", () => { describe("Login Page", () => {
before(logout); beforeEach(logout);
it("Has no detectable accessibility issues", () => { it("Has no detectable accessibility issues", () => {
cy.injectAxe(); cy.injectAxe();

View File

@ -1,14 +1,10 @@
import "cypress-axe"; import "cypress-axe";
Cypress.Cookies.defaults({
preserve: ["_csrf", "lot-occupancy-system-user-sid"]
});
export const logout = () => { export const logout = () => {
cy.visit("/logout"); cy.visit("/logout");
}; };
export const login = (userName) => { export const login = (userName) => {
cy.visit("/login"); cy.visit("/login");
cy.get(".message") cy.get(".message").contains("Testing", {
.contains("Testing", {
matchCase: false matchCase: false
}); });
cy.get("form [name='userName']").type(userName); cy.get("form [name='userName']").type(userName);

View File

@ -2,22 +2,14 @@
import "cypress-axe"; import "cypress-axe";
Cypress.Cookies.defaults({
preserve: ["_csrf", "lot-occupancy-system-user-sid"]
});
export const logout = (): void => { export const logout = (): void => {
cy.visit("/logout"); cy.visit("/logout");
}; };
export const login = (userName: string): void => { export const login = (userName: string): void => {
cy.visit("/login"); cy.visit("/login");
cy.get(".message") cy.get(".message").contains("Testing", {
.contains("Testing", {
matchCase: false matchCase: false
}); });
@ -32,5 +24,4 @@ export const login = (userName: string): void => {
cy.get(".navbar").should("have.length", 1); cy.get(".navbar").should("have.length", 1);
}; };
export const ajaxDelayMillis = 800; export const ajaxDelayMillis = 800;