initial testing

deepsource-autofix-76c6eb20
Dan Gowans 2022-09-20 15:13:34 -04:00
parent 866ca42338
commit b0a6e1b085
10 changed files with 241 additions and 1 deletions

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,25 @@
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", () => {
cy.visit("/admin/cleanup");
cy.location("pathname").should("equal", "/admin/cleanup");
});
it("Has no detectable accessibility issues", () => {
cy.injectAxe();
cy.checkA11y();
});
it("Cleans up the database", () => {
cy.get("button[data-cy='cleanup']").click();
cy.get(".modal").should("be.visible").should("contain.text", "Cleanup");
cy.get(".modal button[data-cy='ok']").click();
cy.wait(ajaxDelayMillis);
cy.get(".modal").should("contain.text", "Cleaned Up").should("contain.text", "Success");
cy.get(".modal button[data-cy='ok']").click();
});
});

View File

@ -0,0 +1,38 @@
/* eslint-disable unicorn/filename-case, promise/catch-or-return, promise/always-return */
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", () => {
cy.visit("/admin/cleanup");
cy.location("pathname").should("equal", "/admin/cleanup");
});
it("Has no detectable accessibility issues", () => {
cy.injectAxe();
cy.checkA11y();
});
it("Cleans up the database", () => {
cy.get("button[data-cy='cleanup']").click();
cy.get(".modal").should("be.visible").should("contain.text", "Cleanup");
cy.get(".modal button[data-cy='ok']").click();
cy.wait(ajaxDelayMillis);
cy.get(".modal").should("contain.text", "Cleaned Up").should("contain.text", "Success");
cy.get(".modal button[data-cy='ok']").click();
});
});

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,26 @@
import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js";
describe("Update User", () => {
before(logout);
after(logout);
it("Logs In Successfully", () => {
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");
});
});
it("Redirects to Dashboard when attempting to access admin area", () => {
cy.visit("/admin/cleanup");
cy.wait(200);
cy.location("pathname").should("equal", "/dashboard");
});
});

View File

@ -0,0 +1,34 @@
import { testUpdate } from "../../../test/_globals.js";
import { logout, login } from "../../support/index.js";
describe("Update User", () => {
before(logout);
after(logout);
it("Logs In Successfully", () => {
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");
});
});
it("Redirects to Dashboard when attempting to access admin area", () => {
cy.visit("/admin/cleanup");
cy.wait(200);
cy.location("pathname").should("equal", "/dashboard");
});
});

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,50 @@
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", () => {
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");
});
});
it("Has no link to create maps on Map Search", () => {
cy.visit("/maps");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create lots on Lot Search", () => {
cy.visit("/lots");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create occupancies on Occupancy Search", () => {
cy.visit("/lotOccupancies");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create work orders on Work Order Search", () => {
cy.visit("/workOrders");
cy.get("a[href*='/new']").should("not.exist");
});
it("Redirects to Dashboard when attempting to create a work order", () => {
cy.visit("/workOrders/new");
cy.wait(200);
cy.location("pathname").should("equal", "/dashboard");
});
it("Redirects to Dashboard when attempting to alter fees", () => {
cy.visit("/admin/fees");
cy.wait(200);
cy.location("pathname").should("not.contain", "/admin");
});
});

View File

@ -0,0 +1,64 @@
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", () => {
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");
});
});
it("Has no link to create maps on Map Search", () => {
cy.visit("/maps");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create lots on Lot Search", () => {
cy.visit("/lots");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create occupancies on Occupancy Search", () => {
cy.visit("/lotOccupancies");
cy.get("a[href*='/new']").should("not.exist");
});
it("Has no link to create work orders on Work Order Search", () => {
cy.visit("/workOrders");
cy.get("a[href*='/new']").should("not.exist");
});
it("Redirects to Dashboard when attempting to create a work order", () => {
cy.visit("/workOrders/new");
cy.wait(200);
cy.location("pathname").should("equal", "/dashboard");
});
it("Redirects to Dashboard when attempting to alter fees", () => {
cy.visit("/admin/fees");
cy.wait(200);
cy.location("pathname").should("not.contain", "/admin");
});
});

View File

@ -45,7 +45,7 @@
</div>
<p class="has-text-right">
<button class="button is-success" id="button--cleanupDatabase" type="button">
<button class="button is-success" id="button--cleanupDatabase" data-cy="cleanup" type="button">
Cleanup Database
</button>
</p>