fee management cypress tests

deepsource-autofix-76c6eb20
Dan Gowans 2022-10-21 11:27:02 -04:00
parent 1d7f17cfda
commit 48cecf8735
13 changed files with 168 additions and 17 deletions

View File

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

View File

@ -0,0 +1,53 @@
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(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/fees");
cy.location("pathname").should("equal", "/admin/fees");
});
it("Has no detectable accessibility issues", () => {
cy.injectAxe();
cy.checkA11y();
});
it("Creates a new fee category", () => {
cy.get("[data-cy='addFeeCategory']").click();
cy.get(".modal").should("be.visible");
cy.injectAxe();
cy.checkA11y();
cy.fixture("fee.json").then((fee) => {
cy.get(".modal input[name='feeCategory']").type(fee.feeCategory);
cy.get(".modal button[type='submit']").click();
cy.wait(ajaxDelayMillis);
cy.get(".container--feeCategory .panel-heading .title").should("contain.text", fee.feeCategory);
});
});
it.only("Creates a new fee", () => {
cy.get("[data-cy='addFee']").first().click();
cy.get(".modal").should("be.visible");
cy.injectAxe();
cy.checkA11y();
cy.fixture("fee.json").then((fee) => {
cy.get(".modal input[name='feeName']").type(fee.feeName);
cy.get(".modal textarea[name='feeDescription']").type(fee.feeDescription);
cy.get(".modal input[name='feeAmount']").clear().type(fee.feeAmount.toString());
cy.get(".modal input[name='taxAmount']").should("be.disabled");
cy.get(".modal input[name='taxPercentage']")
.invoke("val")
.should("equal", configFunctions.getProperty("settings.fees.taxPercentageDefault").toString());
cy.get(".modal input[name='quantityUnit']").should("be.disabled");
cy.get(".modal select[name='includeQuantity']").select("1");
cy.get(".modal input[name='quantityUnit']")
.should("not.be.disabled")
.type(fee.quantityUnit);
cy.get(".modal button[type='submit']").click();
cy.wait(ajaxDelayMillis);
cy.get(".container--fee a").should("contain.text", fee.feeName);
});
});
});

View File

@ -0,0 +1,90 @@
/* 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";
import * as configFunctions from "../../../helpers/functions.config.js";
import type * as recordTypes from "../../../types/recordTypes";
describe("Admin - Fee Management", () => {
before(() => {
logout();
login(testAdmin);
});
after(logout);
beforeEach("Loads page", () => {
cy.visit("/admin/fees");
cy.location("pathname").should("equal", "/admin/fees");
});
it("Has no detectable accessibility issues", () => {
cy.injectAxe();
cy.checkA11y();
});
it("Creates a new fee category", () => {
cy.get("[data-cy='addFeeCategory']").click();
cy.get(".modal").should("be.visible");
cy.injectAxe();
cy.checkA11y();
cy.fixture("fee.json").then((fee: recordTypes.Fee) => {
cy.get(".modal input[name='feeCategory']").type(fee.feeCategory);
cy.get(".modal button[type='submit']").click();
cy.wait(ajaxDelayMillis);
cy.get(".container--feeCategory .panel-heading .title").should(
"contain.text",
fee.feeCategory
);
});
});
it.only("Creates a new fee", () => {
cy.get("[data-cy='addFee']").first().click();
cy.get(".modal").should("be.visible");
cy.injectAxe();
cy.checkA11y();
cy.fixture("fee.json").then((fee: recordTypes.Fee) => {
cy.get(".modal input[name='feeName']").type(fee.feeName);
cy.get(".modal textarea[name='feeDescription']").type(fee.feeDescription);
cy.get(".modal input[name='feeAmount']").clear().type(fee.feeAmount.toString());
cy.get(".modal input[name='taxAmount']").should("be.disabled");
cy.get(".modal input[name='taxPercentage']")
.invoke("val")
.should(
"equal",
configFunctions.getProperty("settings.fees.taxPercentageDefault").toString()
);
cy.get(".modal input[name='quantityUnit']").should("be.disabled");
cy.get(".modal select[name='includeQuantity']").select("1");
cy.get(".modal input[name='quantityUnit']")
.should("not.be.disabled")
.type(fee.quantityUnit);
cy.get(".modal button[type='submit']").click();
cy.wait(ajaxDelayMillis);
cy.get(".container--fee a").should("contain.text", fee.feeName);
});
});
});

View File

@ -4,7 +4,7 @@ import { logout, login } from "../../support/index.js";
import * as configFunctions from "../../../helpers/functions.config.js";
import * as recordTypes from "../../../types/recordTypes";
import type * as recordTypes from "../../../types/recordTypes";
describe("Update - Maps", () => {
before(() => {

View File

@ -0,0 +1,7 @@
{
"feeCategory": "Cypress Test - Fee Category",
"feeName": "Cypress Test - Fee Name",
"feeDescription": "Test Description",
"feeAmount": 10.50,
"quantityUnit": "units"
}

View File

@ -1,5 +1,5 @@
{
"mapName": "Holy Sepulchre (Test)",
"mapName": "Cypress Test - Holy Sepulchre",
"mapDescription": "Operated by the City of Sault Ste. Marie" ,
"mapAddress1": "Fourth Line and Peoples Road",
"mapAddress2": "27 Fourth Line East",

View File

@ -1,3 +1,3 @@
{
"ignore": ["data/sessions/*", "public/javascripts/*", "public-typescript/*"]
"ignore": ["cypress/*", "data/sessions/*", "public/javascripts/*", "public-typescript/*"]
}

View File

@ -45,7 +45,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
"</button>" +
"</div>") +
('<div class="control">' +
'<button class="button is-small is-success button--addFee" type="button">' +
'<button class="button is-small is-success button--addFee" data-cy="addFee" type="button">' +
'<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>' +
"<span>Add Fee</span>" +
"</button>" +

View File

@ -67,7 +67,7 @@ declare const bulmaJS: BulmaJS;
"</button>" +
"</div>") +
('<div class="control">' +
'<button class="button is-small is-success button--addFee" type="button">' +
'<button class="button is-small is-success button--addFee" data-cy="addFee" type="button">' +
'<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>' +
"<span>Add Fee</span>" +
"</button>" +

View File

@ -1,12 +1,12 @@
<div class="modal">
<div class="modal" role="dialog" aria-label="Add Fee">
<div class="modal-background"></div>
<div class="modal-card" style="width:900px">
<header class="modal-card-head">
<div class="modal-card-head">
<h3 class="modal-card-title">
Add Fee
</h3>
<button class="delete is-close-modal-button" aria-label="close" type="button"></button>
</header>
</div>
<section class="modal-card-body">
<form id="form--feeAdd">
<div class="field">
@ -166,12 +166,12 @@
</div>
</form>
</section>
<footer class="modal-card-foot justify-right">
<div class="modal-card-foot justify-right">
<button class="button is-success" type="submit" form="form--feeAdd">
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add Fee</span>
</button>
<button class="button is-close-modal-button" type="button">Cancel</button>
</footer>
</div>
</div>
</div>

View File

@ -1,12 +1,12 @@
<div class="modal">
<div class="modal" role="dialog" aria-label="Add Fee Category">
<div class="modal-background"></div>
<div class="modal-card">
<header class="modal-card-head">
<div class="modal-card-head">
<h3 class="modal-card-title">
Add Fee Category
</h3>
<button class="delete is-close-modal-button" aria-label="close" type="button"></button>
</header>
</div>
<section class="modal-card-body">
<form id="form--feeCategoryAdd">
<div class="field">
@ -17,12 +17,12 @@
</div>
</form>
</section>
<footer class="modal-card-foot justify-right">
<div class="modal-card-foot justify-right">
<button class="button is-success" type="submit" form="form--feeCategoryAdd">
<span class="icon"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add Fee Category</span>
</button>
<button class="button is-close-modal-button" type="button">Cancel</button>
</footer>
</div>
</div>
</div>

File diff suppressed because one or more lines are too long

View File

@ -33,7 +33,7 @@
</div>
<div class="level-right">
<div class="level-item is-justify-content-end">
<button class="button is-success" id="button--addFeeCategory" type="button" accesskey="n">
<button class="button is-success" id="button--addFeeCategory" data-cy="addFeeCategory" type="button" accesskey="n">
<span class="icon is-small"><i class="fas fa-plus" aria-hidden="true"></i></span>
<span>Add Fee Category</span>
</button>