From 46666bc1abf613210db9196031282123f3d95c76 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:10:36 +0000 Subject: [PATCH 1/5] Initial plan From e881b9d7da8b1d42906074d2e4d520af2a041e11 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:20:08 +0000 Subject: [PATCH 2/5] Add comprehensive Cypress tests for all admin interfaces Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com> --- cypress/e2e/01-admin/dataLists.admin.cy.js | 77 ++++++++++++++-- cypress/e2e/01-admin/dataLists.admin.cy.ts | 79 +++++++++++++++- cypress/e2e/01-admin/employees.admin.cy.js | 87 ++++++++++++++++-- cypress/e2e/01-admin/employees.admin.cy.ts | 89 +++++++++++++++++- cypress/e2e/01-admin/equipment.admin.cy.js | 87 ++++++++++++++++-- cypress/e2e/01-admin/equipment.admin.cy.ts | 89 +++++++++++++++++- cypress/e2e/01-admin/locations.admin.cy.js | 89 ++++++++++++++++-- cypress/e2e/01-admin/locations.admin.cy.ts | 91 ++++++++++++++++++- cypress/e2e/01-admin/settings.admin.cy.js | 66 ++++++++++++-- cypress/e2e/01-admin/settings.admin.cy.ts | 67 +++++++++++++- cypress/e2e/01-admin/userGroups.admin.cy.js | 87 ++++++++++++++++-- cypress/e2e/01-admin/userGroups.admin.cy.ts | 89 +++++++++++++++++- cypress/e2e/01-admin/users.admin.cy.js | 75 +++++++++++++-- cypress/e2e/01-admin/users.admin.cy.ts | 75 ++++++++++++++- .../e2e/01-admin/workOrderTypes.admin.cy.js | 87 ++++++++++++++++-- .../e2e/01-admin/workOrderTypes.admin.cy.ts | 89 +++++++++++++++++- cypress/support/index.js | 27 ++++-- test/_globals.js | 11 ++- 18 files changed, 1275 insertions(+), 86 deletions(-) diff --git a/cypress/e2e/01-admin/dataLists.admin.cy.js b/cypress/e2e/01-admin/dataLists.admin.cy.js index ba8d195d..fa685b0b 100644 --- a/cypress/e2e/01-admin/dataLists.admin.cy.js +++ b/cypress/e2e/01-admin/dataLists.admin.cy.js @@ -1,15 +1,76 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Data List Management', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Data List Management', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/dataLists'); cy.location('pathname').should('equal', '/admin/dataLists'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add a data list item', function () { + // Click the first Add Item button + cy.get('.button--addItem').first().click(); + // Wait for modal to appear + cy.get('.modal.is-active').should('be.visible'); + // Fill in the item details + var testItemName = "Test Item ".concat(Date.now()); + cy.get('input[name="dataListItem"]').type(testItemName); + // Submit the form + cy.get('.modal.is-active form').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the item appears + cy.contains(testItemName).should('exist'); + }); + it('Can update a data list item', function () { + // Find the first edit button and click it + cy.get('button[title*="Edit"]').first().click(); + // Wait for modal to appear + cy.get('.modal.is-active').should('be.visible'); + // Update the item + var updatedText = " - Updated ".concat(Date.now()); + cy.get('input[name="dataListItem"]') + .invoke('val') + .then(function (originalValue) { + cy.get('input[name="dataListItem"]') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('.modal.is-active form').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated item appears + cy.contains(updatedText).should('exist'); + }); + it('Can delete a data list item', function () { + // First, add an item to delete + cy.get('.button--addItem').first().click(); + var testItemName = "Delete Item ".concat(Date.now()); + cy.get('input[name="dataListItem"]').type(testItemName); + cy.get('.modal.is-active form').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button for this item + cy.contains(testItemName) + .parents('tr') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the item is removed + cy.contains(testItemName).should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/dataLists.admin.cy.ts b/cypress/e2e/01-admin/dataLists.admin.cy.ts index f63b34bb..005b43a7 100644 --- a/cypress/e2e/01-admin/dataLists.admin.cy.ts +++ b/cypress/e2e/01-admin/dataLists.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Data List Management', () => { beforeEach('Loads page', () => { @@ -15,4 +15,81 @@ describe('Admin - Data List Management', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add a data list item', () => { + // Click the first Add Item button + cy.get('.button--addItem').first().click() + + // Wait for modal to appear + cy.get('.modal.is-active').should('be.visible') + + // Fill in the item details + const testItemName = `Test Item ${Date.now()}` + cy.get('input[name="dataListItem"]').type(testItemName) + + // Submit the form + cy.get('.modal.is-active form').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the item appears + cy.contains(testItemName).should('exist') + }) + + it('Can update a data list item', () => { + // Find the first edit button and click it + cy.get('button[title*="Edit"]').first().click() + + // Wait for modal to appear + cy.get('.modal.is-active').should('be.visible') + + // Update the item + const updatedText = ` - Updated ${Date.now()}` + cy.get('input[name="dataListItem"]') + .invoke('val') + .then((originalValue) => { + cy.get('input[name="dataListItem"]') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('.modal.is-active form').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated item appears + cy.contains(updatedText).should('exist') + }) + + it('Can delete a data list item', () => { + // First, add an item to delete + cy.get('.button--addItem').first().click() + const testItemName = `Delete Item ${Date.now()}` + cy.get('input[name="dataListItem"]').type(testItemName) + cy.get('.modal.is-active form').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button for this item + cy.contains(testItemName) + .parents('tr') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the item is removed + cy.contains(testItemName).should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/employees.admin.cy.js b/cypress/e2e/01-admin/employees.admin.cy.js index 76dfecd3..9fecc82b 100644 --- a/cypress/e2e/01-admin/employees.admin.cy.js +++ b/cypress/e2e/01-admin/employees.admin.cy.js @@ -1,15 +1,86 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Employee Management', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Employee Management', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/employees'); cy.location('pathname').should('equal', '/admin/employees'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add an employee', function () { + // Click the Add Employee button + cy.get('#button--addEmployee').click(); + // Wait for modal to appear + cy.get('#modal--addEmployee').should('be.visible'); + // Fill in the employee details + var testEmployeeName = "Test Employee ".concat(Date.now()); + cy.get('#addEmployee--employeeName').type(testEmployeeName); + // Submit the form + cy.get('#form--addEmployee').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the employee appears in the container + cy.get('#container--employees') + .contains(testEmployeeName) + .should('exist'); + }); + it('Can update an employee', function () { + // Find the first edit button and click it + cy.get('#container--employees') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editEmployee').should('be.visible'); + // Update the employee name + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editEmployee--employeeName') + .invoke('val') + .then(function (originalValue) { + cy.get('#editEmployee--employeeName') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editEmployee').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated employee appears + cy.get('#container--employees') + .contains(updatedText) + .should('exist'); + }); + it('Can delete an employee', function () { + // First, add an employee to delete + cy.get('#button--addEmployee').click(); + var testEmployeeName = "Delete Employee ".concat(Date.now()); + cy.get('#addEmployee--employeeName').type(testEmployeeName); + cy.get('#form--addEmployee').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--employees') + .contains(testEmployeeName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Employee') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the employee is removed + cy.get('#container--employees') + .contains(testEmployeeName) + .should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/employees.admin.cy.ts b/cypress/e2e/01-admin/employees.admin.cy.ts index 3cc74bbf..3adac106 100644 --- a/cypress/e2e/01-admin/employees.admin.cy.ts +++ b/cypress/e2e/01-admin/employees.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Employee Management', () => { beforeEach('Loads page', () => { @@ -15,4 +15,91 @@ describe('Admin - Employee Management', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add an employee', () => { + // Click the Add Employee button + cy.get('#button--addEmployee').click() + + // Wait for modal to appear + cy.get('#modal--addEmployee').should('be.visible') + + // Fill in the employee details + const testEmployeeName = `Test Employee ${Date.now()}` + cy.get('#addEmployee--employeeName').type(testEmployeeName) + + // Submit the form + cy.get('#form--addEmployee').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the employee appears in the container + cy.get('#container--employees') + .contains(testEmployeeName) + .should('exist') + }) + + it('Can update an employee', () => { + // Find the first edit button and click it + cy.get('#container--employees') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editEmployee').should('be.visible') + + // Update the employee name + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editEmployee--employeeName') + .invoke('val') + .then((originalValue) => { + cy.get('#editEmployee--employeeName') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editEmployee').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated employee appears + cy.get('#container--employees') + .contains(updatedText) + .should('exist') + }) + + it('Can delete an employee', () => { + // First, add an employee to delete + cy.get('#button--addEmployee').click() + const testEmployeeName = `Delete Employee ${Date.now()}` + cy.get('#addEmployee--employeeName').type(testEmployeeName) + cy.get('#form--addEmployee').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--employees') + .contains(testEmployeeName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Employee') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the employee is removed + cy.get('#container--employees') + .contains(testEmployeeName) + .should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/equipment.admin.cy.js b/cypress/e2e/01-admin/equipment.admin.cy.js index 13ce53cc..3bdcc609 100644 --- a/cypress/e2e/01-admin/equipment.admin.cy.js +++ b/cypress/e2e/01-admin/equipment.admin.cy.js @@ -1,15 +1,86 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Equipment Maintenance', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Equipment Maintenance', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/equipment'); cy.location('pathname').should('equal', '/admin/equipment'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add equipment', function () { + // Click the Add Equipment button + cy.get('#button--addEquipment').click(); + // Wait for modal to appear + cy.get('#modal--addEquipment').should('be.visible'); + // Fill in the equipment details + var testEquipment = "Test Equipment ".concat(Date.now()); + cy.get('#addEquipment--equipmentName').type(testEquipment); + // Submit the form + cy.get('#form--addEquipment').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the equipment appears in the container + cy.get('#container--equipment') + .contains(testEquipment) + .should('exist'); + }); + it('Can update equipment', function () { + // Find the first edit button and click it + cy.get('#container--equipment') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editEquipment').should('be.visible'); + // Update the equipment name + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editEquipment--equipmentName') + .invoke('val') + .then(function (originalValue) { + cy.get('#editEquipment--equipmentName') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editEquipment').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated equipment appears + cy.get('#container--equipment') + .contains(updatedText) + .should('exist'); + }); + it('Can delete equipment', function () { + // First, add equipment to delete + cy.get('#button--addEquipment').click(); + var testEquipment = "Delete Equipment ".concat(Date.now()); + cy.get('#addEquipment--equipmentName').type(testEquipment); + cy.get('#form--addEquipment').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--equipment') + .contains(testEquipment) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Equipment') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the equipment is removed + cy.get('#container--equipment') + .contains(testEquipment) + .should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/equipment.admin.cy.ts b/cypress/e2e/01-admin/equipment.admin.cy.ts index 25f256a1..8268243c 100644 --- a/cypress/e2e/01-admin/equipment.admin.cy.ts +++ b/cypress/e2e/01-admin/equipment.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Equipment Maintenance', () => { beforeEach('Loads page', () => { @@ -15,4 +15,91 @@ describe('Admin - Equipment Maintenance', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add equipment', () => { + // Click the Add Equipment button + cy.get('#button--addEquipment').click() + + // Wait for modal to appear + cy.get('#modal--addEquipment').should('be.visible') + + // Fill in the equipment details + const testEquipment = `Test Equipment ${Date.now()}` + cy.get('#addEquipment--equipmentName').type(testEquipment) + + // Submit the form + cy.get('#form--addEquipment').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the equipment appears in the container + cy.get('#container--equipment') + .contains(testEquipment) + .should('exist') + }) + + it('Can update equipment', () => { + // Find the first edit button and click it + cy.get('#container--equipment') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editEquipment').should('be.visible') + + // Update the equipment name + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editEquipment--equipmentName') + .invoke('val') + .then((originalValue) => { + cy.get('#editEquipment--equipmentName') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editEquipment').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated equipment appears + cy.get('#container--equipment') + .contains(updatedText) + .should('exist') + }) + + it('Can delete equipment', () => { + // First, add equipment to delete + cy.get('#button--addEquipment').click() + const testEquipment = `Delete Equipment ${Date.now()}` + cy.get('#addEquipment--equipmentName').type(testEquipment) + cy.get('#form--addEquipment').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--equipment') + .contains(testEquipment) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Equipment') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the equipment is removed + cy.get('#container--equipment') + .contains(testEquipment) + .should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/locations.admin.cy.js b/cypress/e2e/01-admin/locations.admin.cy.js index fbe4ebd8..5f7b4d1c 100644 --- a/cypress/e2e/01-admin/locations.admin.cy.js +++ b/cypress/e2e/01-admin/locations.admin.cy.js @@ -1,15 +1,88 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Location Maintenance', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Location Maintenance', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/locations'); cy.location('pathname').should('equal', '/admin/locations'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add a location', function () { + // Click the Add Location button + cy.get('#button--addLocation').click(); + // Wait for modal to appear + cy.get('#modal--addLocation').should('be.visible'); + // Fill in the location details + var testAddress = "Test Address ".concat(Date.now()); + cy.get('#addLocation--address1').type(testAddress); + cy.get('#addLocation--address2').type('Suite 100'); + cy.get('#addLocation--cityProvince').type('Test City'); + // Submit the form + cy.get('#form--addLocation').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the location appears in the container + cy.get('#container--locations') + .contains(testAddress) + .should('exist'); + }); + it('Can update a location', function () { + // Find the first edit button and click it + cy.get('#container--locations') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editLocation').should('be.visible'); + // Update the address + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editLocation--address1') + .invoke('val') + .then(function (originalValue) { + cy.get('#editLocation--address1') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editLocation').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated location appears + cy.get('#container--locations') + .contains(updatedText) + .should('exist'); + }); + it('Can delete a location', function () { + // First, add a location to delete + cy.get('#button--addLocation').click(); + var testAddress = "Delete Location ".concat(Date.now()); + cy.get('#addLocation--address1').type(testAddress); + cy.get('#form--addLocation').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--locations') + .contains(testAddress) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Location') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the location is removed + cy.get('#container--locations') + .contains(testAddress) + .should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/locations.admin.cy.ts b/cypress/e2e/01-admin/locations.admin.cy.ts index 1c4e493e..fcc737b8 100644 --- a/cypress/e2e/01-admin/locations.admin.cy.ts +++ b/cypress/e2e/01-admin/locations.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Location Maintenance', () => { beforeEach('Loads page', () => { @@ -15,4 +15,93 @@ describe('Admin - Location Maintenance', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add a location', () => { + // Click the Add Location button + cy.get('#button--addLocation').click() + + // Wait for modal to appear + cy.get('#modal--addLocation').should('be.visible') + + // Fill in the location details + const testAddress = `Test Address ${Date.now()}` + cy.get('#addLocation--address1').type(testAddress) + cy.get('#addLocation--address2').type('Suite 100') + cy.get('#addLocation--cityProvince').type('Test City') + + // Submit the form + cy.get('#form--addLocation').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the location appears in the container + cy.get('#container--locations') + .contains(testAddress) + .should('exist') + }) + + it('Can update a location', () => { + // Find the first edit button and click it + cy.get('#container--locations') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editLocation').should('be.visible') + + // Update the address + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editLocation--address1') + .invoke('val') + .then((originalValue) => { + cy.get('#editLocation--address1') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editLocation').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated location appears + cy.get('#container--locations') + .contains(updatedText) + .should('exist') + }) + + it('Can delete a location', () => { + // First, add a location to delete + cy.get('#button--addLocation').click() + const testAddress = `Delete Location ${Date.now()}` + cy.get('#addLocation--address1').type(testAddress) + cy.get('#form--addLocation').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--locations') + .contains(testAddress) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Location') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the location is removed + cy.get('#container--locations') + .contains(testAddress) + .should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/settings.admin.cy.js b/cypress/e2e/01-admin/settings.admin.cy.js index 10b6dac0..b8218bc8 100644 --- a/cypress/e2e/01-admin/settings.admin.cy.js +++ b/cypress/e2e/01-admin/settings.admin.cy.js @@ -1,15 +1,65 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Application Settings', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Application Settings', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/settings'); cy.location('pathname').should('equal', '/admin/settings'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can update a setting', function () { + // Find the first editable setting (text input) + cy.get('.settingForm') + .has('input.input[type="text"]') + .first() + .within(function () { + // Get the current value + cy.get('input.input[type="text"]') + .invoke('val') + .then(function (originalValue) { + // Change the value + var newValue = "".concat(originalValue, "-test"); + cy.get('input.input[type="text"]').clear().type(newValue); + // Submit the form + cy.get('form').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify success (the warning background should be removed) + cy.get('input.input[type="text"]').should('not.have.class', 'has-background-warning-light'); + // Restore the original value + cy.get('input.input[type="text"]').clear().type(originalValue.toString()); + cy.get('form').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + }); + }); + }); + it('Highlights changed settings', function () { + // Find the first text input setting + cy.get('.settingForm input.input[type="text"]').first().as('settingInput'); + // Change the value + cy.get('@settingInput').type('-changed'); + // Verify the input has the warning background + cy.get('@settingInput').should('have.class', 'has-background-warning-light'); + }); + it('Can filter settings', function () { + // Type in the filter + cy.get('#settingsFilter').type('application'); + // Wait a moment for the filter to apply + cy.wait(200); + // Verify some rows are hidden + cy.get('#settingsTableBody tr.is-hidden').should('exist'); + // Clear the filter + cy.get('#settingsFilter').clear(); + // Wait a moment + cy.wait(200); + // Verify all rows are visible + cy.get('#settingsTableBody tr').should('not.have.class', 'is-hidden'); + }); }); diff --git a/cypress/e2e/01-admin/settings.admin.cy.ts b/cypress/e2e/01-admin/settings.admin.cy.ts index 8e7bd4c4..6cf4fe4b 100644 --- a/cypress/e2e/01-admin/settings.admin.cy.ts +++ b/cypress/e2e/01-admin/settings.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Application Settings', () => { beforeEach('Loads page', () => { @@ -15,4 +15,69 @@ describe('Admin - Application Settings', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can update a setting', () => { + // Find the first editable setting (text input) + cy.get('.settingForm') + .has('input.input[type="text"]') + .first() + .within(() => { + // Get the current value + cy.get('input.input[type="text"]') + .invoke('val') + .then((originalValue) => { + // Change the value + const newValue = `${originalValue}-test` + cy.get('input.input[type="text"]').clear().type(newValue) + + // Submit the form + cy.get('form').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify success (the warning background should be removed) + cy.get('input.input[type="text"]').should( + 'not.have.class', + 'has-background-warning-light' + ) + + // Restore the original value + cy.get('input.input[type="text"]').clear().type(originalValue.toString()) + cy.get('form').submit() + cy.wait(ajaxDelayMillis) + }) + }) + }) + + it('Highlights changed settings', () => { + // Find the first text input setting + cy.get('.settingForm input.input[type="text"]').first().as('settingInput') + + // Change the value + cy.get('@settingInput').type('-changed') + + // Verify the input has the warning background + cy.get('@settingInput').should('have.class', 'has-background-warning-light') + }) + + it('Can filter settings', () => { + // Type in the filter + cy.get('#settingsFilter').type('application') + + // Wait a moment for the filter to apply + cy.wait(200) + + // Verify some rows are hidden + cy.get('#settingsTableBody tr.is-hidden').should('exist') + + // Clear the filter + cy.get('#settingsFilter').clear() + + // Wait a moment + cy.wait(200) + + // Verify all rows are visible + cy.get('#settingsTableBody tr').should('not.have.class', 'is-hidden') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/userGroups.admin.cy.js b/cypress/e2e/01-admin/userGroups.admin.cy.js index 8c8c50a5..6977d943 100644 --- a/cypress/e2e/01-admin/userGroups.admin.cy.js +++ b/cypress/e2e/01-admin/userGroups.admin.cy.js @@ -1,15 +1,86 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - User Group Management', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - User Group Management', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/userGroups'); cy.location('pathname').should('equal', '/admin/userGroups'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add a user group', function () { + // Click the Add User Group button + cy.get('#button--addUserGroup').click(); + // Wait for modal to appear + cy.get('#modal--addUserGroup').should('be.visible'); + // Fill in the user group details + var testGroupName = "Test Group ".concat(Date.now()); + cy.get('#addUserGroup--groupName').type(testGroupName); + // Submit the form + cy.get('#form--addUserGroup').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the user group appears in the container + cy.get('#container--userGroups') + .contains(testGroupName) + .should('exist'); + }); + it('Can update a user group', function () { + // Find the first edit button and click it + cy.get('#container--userGroups') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editUserGroup').should('be.visible'); + // Update the group name + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editUserGroup--groupName') + .invoke('val') + .then(function (originalValue) { + cy.get('#editUserGroup--groupName') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editUserGroup').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated group appears + cy.get('#container--userGroups') + .contains(updatedText) + .should('exist'); + }); + it('Can delete a user group', function () { + // First, add a user group to delete + cy.get('#button--addUserGroup').click(); + var testGroupName = "Delete Group ".concat(Date.now()); + cy.get('#addUserGroup--groupName').type(testGroupName); + cy.get('#form--addUserGroup').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--userGroups') + .contains(testGroupName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Group') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the group is removed + cy.get('#container--userGroups') + .contains(testGroupName) + .should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/userGroups.admin.cy.ts b/cypress/e2e/01-admin/userGroups.admin.cy.ts index 55c055a2..7738bb6e 100644 --- a/cypress/e2e/01-admin/userGroups.admin.cy.ts +++ b/cypress/e2e/01-admin/userGroups.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - User Group Management', () => { beforeEach('Loads page', () => { @@ -15,4 +15,91 @@ describe('Admin - User Group Management', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add a user group', () => { + // Click the Add User Group button + cy.get('#button--addUserGroup').click() + + // Wait for modal to appear + cy.get('#modal--addUserGroup').should('be.visible') + + // Fill in the user group details + const testGroupName = `Test Group ${Date.now()}` + cy.get('#addUserGroup--groupName').type(testGroupName) + + // Submit the form + cy.get('#form--addUserGroup').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the user group appears in the container + cy.get('#container--userGroups') + .contains(testGroupName) + .should('exist') + }) + + it('Can update a user group', () => { + // Find the first edit button and click it + cy.get('#container--userGroups') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editUserGroup').should('be.visible') + + // Update the group name + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editUserGroup--groupName') + .invoke('val') + .then((originalValue) => { + cy.get('#editUserGroup--groupName') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editUserGroup').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated group appears + cy.get('#container--userGroups') + .contains(updatedText) + .should('exist') + }) + + it('Can delete a user group', () => { + // First, add a user group to delete + cy.get('#button--addUserGroup').click() + const testGroupName = `Delete Group ${Date.now()}` + cy.get('#addUserGroup--groupName').type(testGroupName) + cy.get('#form--addUserGroup').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--userGroups') + .contains(testGroupName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Group') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the group is removed + cy.get('#container--userGroups') + .contains(testGroupName) + .should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/users.admin.cy.js b/cypress/e2e/01-admin/users.admin.cy.js index cf457940..f6053493 100644 --- a/cypress/e2e/01-admin/users.admin.cy.js +++ b/cypress/e2e/01-admin/users.admin.cy.js @@ -1,15 +1,74 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - User Management', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - User Management', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/users'); cy.location('pathname').should('equal', '/admin/users'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add a user', function () { + // Click the Add User button + cy.get('#button--addUser').click(); + // Wait for modal to appear + cy.get('#modal--addUser').should('be.visible'); + // Fill in the username + var testUserName = "testuser".concat(Date.now()); + cy.get('#userName').type(testUserName); + // Submit the form + cy.get('#form--addUser').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the user appears in the table + cy.get('#container--users') + .contains('td', testUserName) + .should('exist'); + }); + it('Can delete a user', function () { + // First, add a user to delete + cy.get('#button--addUser').click(); + var testUserName = "deleteuser".concat(Date.now()); + cy.get('#userName').type(testUserName); + cy.get('#form--addUser').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button for this user + cy.get('#container--users') + .contains('tr', testUserName) + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete User') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the user is removed from the table + cy.get('#container--users') + .contains('td', testUserName) + .should('not.exist'); + }); + it('Can toggle user permissions', function () { + // Find the first user in the table and toggle a permission + cy.get('#container--users') + .find('button.permission-toggle') + .first() + .then(function ($button) { + var initialClass = $button.hasClass('is-success') ? 'is-success' : 'is-light'; + // Click the button + cy.wrap($button).click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the button class changed + cy.wrap($button).should('not.have.class', initialClass); + }); + }); }); diff --git a/cypress/e2e/01-admin/users.admin.cy.ts b/cypress/e2e/01-admin/users.admin.cy.ts index e17f1f5d..225536a2 100644 --- a/cypress/e2e/01-admin/users.admin.cy.ts +++ b/cypress/e2e/01-admin/users.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - User Management', () => { beforeEach('Loads page', () => { @@ -15,4 +15,77 @@ describe('Admin - User Management', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add a user', () => { + // Click the Add User button + cy.get('#button--addUser').click() + + // Wait for modal to appear + cy.get('#modal--addUser').should('be.visible') + + // Fill in the username + const testUserName = `testuser${Date.now()}` + cy.get('#userName').type(testUserName) + + // Submit the form + cy.get('#form--addUser').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the user appears in the table + cy.get('#container--users') + .contains('td', testUserName) + .should('exist') + }) + + it('Can delete a user', () => { + // First, add a user to delete + cy.get('#button--addUser').click() + const testUserName = `deleteuser${Date.now()}` + cy.get('#userName').type(testUserName) + cy.get('#form--addUser').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button for this user + cy.get('#container--users') + .contains('tr', testUserName) + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete User') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the user is removed from the table + cy.get('#container--users') + .contains('td', testUserName) + .should('not.exist') + }) + + it('Can toggle user permissions', () => { + // Find the first user in the table and toggle a permission + cy.get('#container--users') + .find('button.permission-toggle') + .first() + .then(($button) => { + const initialClass = $button.hasClass('is-success') ? 'is-success' : 'is-light' + + // Click the button + cy.wrap($button).click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the button class changed + cy.wrap($button).should('not.have.class', initialClass) + }) + }) }) \ No newline at end of file diff --git a/cypress/e2e/01-admin/workOrderTypes.admin.cy.js b/cypress/e2e/01-admin/workOrderTypes.admin.cy.js index 839b5fab..aea29014 100644 --- a/cypress/e2e/01-admin/workOrderTypes.admin.cy.js +++ b/cypress/e2e/01-admin/workOrderTypes.admin.cy.js @@ -1,15 +1,86 @@ -import { testAdmin } from '../../../test/_globals.js'; -import { login, logout } from '../../support/index.js'; -describe('Admin - Work Order Type Maintenance', () => { - beforeEach('Loads page', () => { - logout(); - login(testAdmin); +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Work Order Type Maintenance', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); cy.visit('/admin/workOrderTypes'); cy.location('pathname').should('equal', '/admin/workOrderTypes'); }); - afterEach(logout); - it('Has no detectable accessibility issues', () => { + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { cy.injectAxe(); cy.checkA11y(); }); + it('Can add a work order type', function () { + // Click the Add Work Order Type button + cy.get('#button--addWorkOrderType').click(); + // Wait for modal to appear + cy.get('#modal--addWorkOrderType').should('be.visible'); + // Fill in the work order type details + var testTypeName = "Test Type ".concat(Date.now()); + cy.get('#addWorkOrderType--workOrderType').type(testTypeName); + // Submit the form + cy.get('#form--addWorkOrderType').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the work order type appears in the container + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .should('exist'); + }); + it('Can update a work order type', function () { + // Find the first edit button and click it + cy.get('#container--workOrderTypes') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editWorkOrderType').should('be.visible'); + // Update the work order type + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editWorkOrderType--workOrderType') + .invoke('val') + .then(function (originalValue) { + cy.get('#editWorkOrderType--workOrderType') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editWorkOrderType').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated work order type appears + cy.get('#container--workOrderTypes') + .contains(updatedText) + .should('exist'); + }); + it('Can delete a work order type', function () { + // First, add a work order type to delete + cy.get('#button--addWorkOrderType').click(); + var testTypeName = "Delete Type ".concat(Date.now()); + cy.get('#addWorkOrderType--workOrderType').type(testTypeName); + cy.get('#form--addWorkOrderType').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the work order type is removed + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .should('not.exist'); + }); }); diff --git a/cypress/e2e/01-admin/workOrderTypes.admin.cy.ts b/cypress/e2e/01-admin/workOrderTypes.admin.cy.ts index 37ad9ab1..e90ba59a 100644 --- a/cypress/e2e/01-admin/workOrderTypes.admin.cy.ts +++ b/cypress/e2e/01-admin/workOrderTypes.admin.cy.ts @@ -1,5 +1,5 @@ import { testAdmin } from '../../../test/_globals.js' -import { login, logout } from '../../support/index.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' describe('Admin - Work Order Type Maintenance', () => { beforeEach('Loads page', () => { @@ -15,4 +15,91 @@ describe('Admin - Work Order Type Maintenance', () => { cy.injectAxe() cy.checkA11y() }) + + it('Can add a work order type', () => { + // Click the Add Work Order Type button + cy.get('#button--addWorkOrderType').click() + + // Wait for modal to appear + cy.get('#modal--addWorkOrderType').should('be.visible') + + // Fill in the work order type details + const testTypeName = `Test Type ${Date.now()}` + cy.get('#addWorkOrderType--workOrderType').type(testTypeName) + + // Submit the form + cy.get('#form--addWorkOrderType').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the work order type appears in the container + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .should('exist') + }) + + it('Can update a work order type', () => { + // Find the first edit button and click it + cy.get('#container--workOrderTypes') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editWorkOrderType').should('be.visible') + + // Update the work order type + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editWorkOrderType--workOrderType') + .invoke('val') + .then((originalValue) => { + cy.get('#editWorkOrderType--workOrderType') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editWorkOrderType').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated work order type appears + cy.get('#container--workOrderTypes') + .contains(updatedText) + .should('exist') + }) + + it('Can delete a work order type', () => { + // First, add a work order type to delete + cy.get('#button--addWorkOrderType').click() + const testTypeName = `Delete Type ${Date.now()}` + cy.get('#addWorkOrderType--workOrderType').type(testTypeName) + cy.get('#form--addWorkOrderType').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the work order type is removed + cy.get('#container--workOrderTypes') + .contains(testTypeName) + .should('not.exist') + }) }) \ No newline at end of file diff --git a/cypress/support/index.js b/cypress/support/index.js index 0fc61c27..3f000460 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -1,8 +1,13 @@ -import 'cypress-axe'; -export const logout = () => { +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pdfGenerationDelayMillis = exports.pageLoadDelayMillis = exports.ajaxDelayMillis = exports.login = exports.logout = void 0; +exports.checkA11yLog = checkA11yLog; +require("cypress-axe"); +var logout = function () { cy.visit('/logout'); }; -export const login = (userName) => { +exports.logout = logout; +var login = function (userName) { cy.visit('/login'); /* cy.get('.message').contains('Testing', { @@ -16,15 +21,17 @@ export const login = (userName) => { // Logged in pages have a navbar cy.get('.navbar').should('have.length', 1); }; -export const ajaxDelayMillis = 800; -export const pageLoadDelayMillis = 1200; -export const pdfGenerationDelayMillis = 10_000; -export function checkA11yLog(violations) { +exports.login = login; +exports.ajaxDelayMillis = 800; +exports.pageLoadDelayMillis = 1200; +exports.pdfGenerationDelayMillis = 10000; +function checkA11yLog(violations) { if (violations.length > 0) { cy.log('Accessibility violations found:'); - for (const violation of violations) { - cy.log(`- ${violation.id}: ${violation.description}`); - cy.log(` Context: ${JSON.stringify(violation.nodes)}`); + for (var _i = 0, violations_1 = violations; _i < violations_1.length; _i++) { + var violation = violations_1[_i]; + cy.log("- ".concat(violation.id, ": ").concat(violation.description)); + cy.log(" Context: ".concat(JSON.stringify(violation.nodes))); } } } diff --git a/test/_globals.js b/test/_globals.js index 4038d375..3963b684 100644 --- a/test/_globals.js +++ b/test/_globals.js @@ -1,6 +1,9 @@ +"use strict"; // eslint-disable-next-line @eslint-community/eslint-comments/disable-enable-pair /* eslint-disable @cspell/spellchecker */ -export const testUpdate = '~testuser'; -export const testInquiry = '~testinquiry'; -export const testAdmin = '~administrator'; -export const portNumber = 9000; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.portNumber = exports.testAdmin = exports.testInquiry = exports.testUpdate = void 0; +exports.testUpdate = '~testuser'; +exports.testInquiry = '~testinquiry'; +exports.testAdmin = '~administrator'; +exports.portNumber = 9000; From ea20c39fcc1ac95a467aae8195a7680bb4f6cd55 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 18:22:36 +0000 Subject: [PATCH 3/5] Add Cypress tests for Tags admin interface Co-authored-by: dangowans <19495149+dangowans@users.noreply.github.com> --- cypress/e2e/01-admin/tags.admin.cy.d.ts | 1 + cypress/e2e/01-admin/tags.admin.cy.js | 86 +++++++++++++++++++ cypress/e2e/01-admin/tags.admin.cy.ts | 105 ++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 cypress/e2e/01-admin/tags.admin.cy.d.ts create mode 100644 cypress/e2e/01-admin/tags.admin.cy.js create mode 100644 cypress/e2e/01-admin/tags.admin.cy.ts diff --git a/cypress/e2e/01-admin/tags.admin.cy.d.ts b/cypress/e2e/01-admin/tags.admin.cy.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/cypress/e2e/01-admin/tags.admin.cy.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/cypress/e2e/01-admin/tags.admin.cy.js b/cypress/e2e/01-admin/tags.admin.cy.js new file mode 100644 index 00000000..b2587ae9 --- /dev/null +++ b/cypress/e2e/01-admin/tags.admin.cy.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var _globals_js_1 = require("../../../test/_globals.js"); +var index_js_1 = require("../../support/index.js"); +describe('Admin - Tag Maintenance', function () { + beforeEach('Loads page', function () { + (0, index_js_1.logout)(); + (0, index_js_1.login)(_globals_js_1.testAdmin); + cy.visit('/admin/tags'); + cy.location('pathname').should('equal', '/admin/tags'); + }); + afterEach(index_js_1.logout); + it('Has no detectable accessibility issues', function () { + cy.injectAxe(); + cy.checkA11y(); + }); + it('Can add a tag', function () { + // Click the Add Tag button + cy.get('#button--addTag').click(); + // Wait for modal to appear + cy.get('#modal--addTag').should('be.visible'); + // Fill in the tag details + var testTagName = "Test Tag ".concat(Date.now()); + cy.get('#addTag--tagName').type(testTagName); + // Submit the form + cy.get('#form--addTag').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the tag appears in the container + cy.get('#container--tags') + .contains(testTagName) + .should('exist'); + }); + it('Can update a tag', function () { + // Find the first edit button and click it + cy.get('#container--tags') + .find('button[title*="Edit"]') + .first() + .click(); + // Wait for modal to appear + cy.get('#modal--editTag').should('be.visible'); + // Update the tag name + var updatedText = " - Updated ".concat(Date.now()); + cy.get('#editTag--tagName') + .invoke('val') + .then(function (originalValue) { + cy.get('#editTag--tagName') + .clear() + .type(originalValue + updatedText); + }); + // Submit the form + cy.get('#form--editTag').submit(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the updated tag appears + cy.get('#container--tags') + .contains(updatedText) + .should('exist'); + }); + it('Can delete a tag', function () { + // First, add a tag to delete + cy.get('#button--addTag').click(); + var testTagName = "Delete Tag ".concat(Date.now()); + cy.get('#addTag--tagName').type(testTagName); + cy.get('#form--addTag').submit(); + cy.wait(index_js_1.ajaxDelayMillis); + // Find and click the delete button + cy.get('#container--tags') + .contains(testTagName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click(); + // Wait for confirmation modal + cy.wait(200); + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Tag') + .click(); + // Wait for AJAX response + cy.wait(index_js_1.ajaxDelayMillis); + // Verify the tag is removed + cy.get('#container--tags') + .contains(testTagName) + .should('not.exist'); + }); +}); diff --git a/cypress/e2e/01-admin/tags.admin.cy.ts b/cypress/e2e/01-admin/tags.admin.cy.ts new file mode 100644 index 00000000..a0962e28 --- /dev/null +++ b/cypress/e2e/01-admin/tags.admin.cy.ts @@ -0,0 +1,105 @@ +import { testAdmin } from '../../../test/_globals.js' +import { ajaxDelayMillis, login, logout } from '../../support/index.js' + +describe('Admin - Tag Maintenance', () => { + beforeEach('Loads page', () => { + logout() + login(testAdmin) + cy.visit('/admin/tags') + cy.location('pathname').should('equal', '/admin/tags') + }) + + afterEach(logout) + + it('Has no detectable accessibility issues', () => { + cy.injectAxe() + cy.checkA11y() + }) + + it('Can add a tag', () => { + // Click the Add Tag button + cy.get('#button--addTag').click() + + // Wait for modal to appear + cy.get('#modal--addTag').should('be.visible') + + // Fill in the tag details + const testTagName = `Test Tag ${Date.now()}` + cy.get('#addTag--tagName').type(testTagName) + + // Submit the form + cy.get('#form--addTag').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the tag appears in the container + cy.get('#container--tags') + .contains(testTagName) + .should('exist') + }) + + it('Can update a tag', () => { + // Find the first edit button and click it + cy.get('#container--tags') + .find('button[title*="Edit"]') + .first() + .click() + + // Wait for modal to appear + cy.get('#modal--editTag').should('be.visible') + + // Update the tag name + const updatedText = ` - Updated ${Date.now()}` + cy.get('#editTag--tagName') + .invoke('val') + .then((originalValue) => { + cy.get('#editTag--tagName') + .clear() + .type(originalValue + updatedText) + }) + + // Submit the form + cy.get('#form--editTag').submit() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the updated tag appears + cy.get('#container--tags') + .contains(updatedText) + .should('exist') + }) + + it('Can delete a tag', () => { + // First, add a tag to delete + cy.get('#button--addTag').click() + const testTagName = `Delete Tag ${Date.now()}` + cy.get('#addTag--tagName').type(testTagName) + cy.get('#form--addTag').submit() + cy.wait(ajaxDelayMillis) + + // Find and click the delete button + cy.get('#container--tags') + .contains(testTagName) + .parents('.panel-block') + .find('button[title*="Delete"]') + .click() + + // Wait for confirmation modal + cy.wait(200) + + // Confirm deletion + cy.get('.modal.is-active') + .contains('button', 'Delete Tag') + .click() + + // Wait for AJAX response + cy.wait(ajaxDelayMillis) + + // Verify the tag is removed + cy.get('#container--tags') + .contains(testTagName) + .should('not.exist') + }) +}) From 3f6e271b8b171ddbc8fc4b0a7a60a22baa70a531 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 9 Dec 2025 13:47:23 -0500 Subject: [PATCH 4/5] fix datalists test --- cypress/e2e/01-admin/dataLists.admin.cy.js | 69 ++++++++++--------- cypress/e2e/01-admin/dataLists.admin.cy.ts | 37 ++++++---- cypress/e2e/01-admin/employees.admin.cy.js | 40 +++++------ cypress/e2e/01-admin/equipment.admin.cy.js | 40 +++++------ cypress/e2e/01-admin/locations.admin.cy.js | 40 +++++------ cypress/e2e/01-admin/settings.admin.cy.js | 34 +++++---- cypress/e2e/01-admin/tags.admin.cy.js | 40 +++++------ cypress/e2e/01-admin/userGroups.admin.cy.js | 40 +++++------ cypress/e2e/01-admin/users.admin.cy.js | 40 +++++------ .../e2e/01-admin/workOrderTypes.admin.cy.js | 40 +++++------ 10 files changed, 209 insertions(+), 211 deletions(-) diff --git a/cypress/e2e/01-admin/dataLists.admin.cy.js b/cypress/e2e/01-admin/dataLists.admin.cy.js index fa685b0b..43e7ec92 100644 --- a/cypress/e2e/01-admin/dataLists.admin.cy.js +++ b/cypress/e2e/01-admin/dataLists.admin.cy.js @@ -1,75 +1,78 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Data List Management', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Data List Management', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/dataLists'); cy.location('pathname').should('equal', '/admin/dataLists'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a data list item', function () { + it('Can add a data list item', () => { + cy.get('details').first().get('summary').first().click(); // Click the first Add Item button cy.get('.button--addItem').first().click(); // Wait for modal to appear cy.get('.modal.is-active').should('be.visible'); // Fill in the item details - var testItemName = "Test Item ".concat(Date.now()); - cy.get('input[name="dataListItem"]').type(testItemName); + const testItemName = `Test Item ${Date.now()}`; + cy.get('#input--newItem').type(testItemName); // Submit the form - cy.get('.modal.is-active form').submit(); + cy.get('.modal button[data-cy="ok"]').click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the item appears cy.contains(testItemName).should('exist'); }); - it('Can update a data list item', function () { + it('Can update a data list item', () => { + cy.get('details').first().get('summary').first().click(); // Find the first edit button and click it - cy.get('button[title*="Edit"]').first().click(); + cy.get('.button--editItem').first().click(); // Wait for modal to appear cy.get('.modal.is-active').should('be.visible'); // Update the item - var updatedText = " - Updated ".concat(Date.now()); - cy.get('input[name="dataListItem"]') + const updatedText = ` - Updated ${Date.now()}`; + cy.get('#input--editItem') .invoke('val') - .then(function (originalValue) { - cy.get('input[name="dataListItem"]') + .then((originalValue) => { + cy.get('#input--editItem') .clear() .type(originalValue + updatedText); }); // Submit the form - cy.get('.modal.is-active form').submit(); + cy.get('.modal button[data-cy="ok"]').click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated item appears cy.contains(updatedText).should('exist'); }); - it('Can delete a data list item', function () { + it('Can delete a data list item', () => { + cy.get('details').first().get('summary').first().click(); // First, add an item to delete cy.get('.button--addItem').first().click(); - var testItemName = "Delete Item ".concat(Date.now()); - cy.get('input[name="dataListItem"]').type(testItemName); - cy.get('.modal.is-active form').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + const testItemName = `Delete Item ${Date.now()}`; + cy.get('#input--newItem').type(testItemName); + // Submit the form + cy.get('.modal button[data-cy="ok"]').click(); + cy.wait(ajaxDelayMillis); + // Dismiss the success modal + cy.get('.modal button[data-cy="ok"]').click(); + cy.wait(ajaxDelayMillis); // Find and click the delete button for this item cy.contains(testItemName) .parents('tr') - .find('button[title*="Delete"]') + .find('button.button--deleteItem') .click(); // Wait for confirmation modal cy.wait(200); // Confirm deletion - cy.get('.modal.is-active') - .contains('button', 'Delete') - .click(); + cy.get('.modal.is-active').contains('button', 'Delete').click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the item is removed cy.contains(testItemName).should('not.exist'); }); diff --git a/cypress/e2e/01-admin/dataLists.admin.cy.ts b/cypress/e2e/01-admin/dataLists.admin.cy.ts index 005b43a7..b80a3c50 100644 --- a/cypress/e2e/01-admin/dataLists.admin.cy.ts +++ b/cypress/e2e/01-admin/dataLists.admin.cy.ts @@ -17,6 +17,8 @@ describe('Admin - Data List Management', () => { }) it('Can add a data list item', () => { + cy.get('details').first().get('summary').first().click() + // Click the first Add Item button cy.get('.button--addItem').first().click() @@ -25,10 +27,11 @@ describe('Admin - Data List Management', () => { // Fill in the item details const testItemName = `Test Item ${Date.now()}` - cy.get('input[name="dataListItem"]').type(testItemName) + + cy.get('#input--newItem').type(testItemName) // Submit the form - cy.get('.modal.is-active form').submit() + cy.get('.modal button[data-cy="ok"]').click() // Wait for AJAX response cy.wait(ajaxDelayMillis) @@ -38,24 +41,26 @@ describe('Admin - Data List Management', () => { }) it('Can update a data list item', () => { + cy.get('details').first().get('summary').first().click() + // Find the first edit button and click it - cy.get('button[title*="Edit"]').first().click() + cy.get('.button--editItem').first().click() // Wait for modal to appear cy.get('.modal.is-active').should('be.visible') // Update the item const updatedText = ` - Updated ${Date.now()}` - cy.get('input[name="dataListItem"]') + cy.get('#input--editItem') .invoke('val') .then((originalValue) => { - cy.get('input[name="dataListItem"]') + cy.get('#input--editItem') .clear() .type(originalValue + updatedText) }) // Submit the form - cy.get('.modal.is-active form').submit() + cy.get('.modal button[data-cy="ok"]').click() // Wait for AJAX response cy.wait(ajaxDelayMillis) @@ -65,26 +70,32 @@ describe('Admin - Data List Management', () => { }) it('Can delete a data list item', () => { + cy.get('details').first().get('summary').first().click() + // First, add an item to delete cy.get('.button--addItem').first().click() const testItemName = `Delete Item ${Date.now()}` - cy.get('input[name="dataListItem"]').type(testItemName) - cy.get('.modal.is-active form').submit() + cy.get('#input--newItem').type(testItemName) + + // Submit the form + cy.get('.modal button[data-cy="ok"]').click() + cy.wait(ajaxDelayMillis) + + // Dismiss the success modal + cy.get('.modal button[data-cy="ok"]').click() cy.wait(ajaxDelayMillis) // Find and click the delete button for this item cy.contains(testItemName) .parents('tr') - .find('button[title*="Delete"]') + .find('button.button--deleteItem') .click() // Wait for confirmation modal cy.wait(200) // Confirm deletion - cy.get('.modal.is-active') - .contains('button', 'Delete') - .click() + cy.get('.modal.is-active').contains('button', 'Delete').click() // Wait for AJAX response cy.wait(ajaxDelayMillis) @@ -92,4 +103,4 @@ describe('Admin - Data List Management', () => { // Verify the item is removed cy.contains(testItemName).should('not.exist') }) -}) \ No newline at end of file +}) diff --git a/cypress/e2e/01-admin/employees.admin.cy.js b/cypress/e2e/01-admin/employees.admin.cy.js index 9fecc82b..cb79bf8d 100644 --- a/cypress/e2e/01-admin/employees.admin.cy.js +++ b/cypress/e2e/01-admin/employees.admin.cy.js @@ -1,37 +1,35 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Employee Management', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Employee Management', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/employees'); cy.location('pathname').should('equal', '/admin/employees'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add an employee', function () { + it('Can add an employee', () => { // Click the Add Employee button cy.get('#button--addEmployee').click(); // Wait for modal to appear cy.get('#modal--addEmployee').should('be.visible'); // Fill in the employee details - var testEmployeeName = "Test Employee ".concat(Date.now()); + const testEmployeeName = `Test Employee ${Date.now()}`; cy.get('#addEmployee--employeeName').type(testEmployeeName); // Submit the form cy.get('#form--addEmployee').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the employee appears in the container cy.get('#container--employees') .contains(testEmployeeName) .should('exist'); }); - it('Can update an employee', function () { + it('Can update an employee', () => { // Find the first edit button and click it cy.get('#container--employees') .find('button[title*="Edit"]') @@ -40,10 +38,10 @@ describe('Admin - Employee Management', function () { // Wait for modal to appear cy.get('#modal--editEmployee').should('be.visible'); // Update the employee name - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editEmployee--employeeName') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editEmployee--employeeName') .clear() .type(originalValue + updatedText); @@ -51,19 +49,19 @@ describe('Admin - Employee Management', function () { // Submit the form cy.get('#form--editEmployee').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated employee appears cy.get('#container--employees') .contains(updatedText) .should('exist'); }); - it('Can delete an employee', function () { + it('Can delete an employee', () => { // First, add an employee to delete cy.get('#button--addEmployee').click(); - var testEmployeeName = "Delete Employee ".concat(Date.now()); + const testEmployeeName = `Delete Employee ${Date.now()}`; cy.get('#addEmployee--employeeName').type(testEmployeeName); cy.get('#form--addEmployee').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--employees') .contains(testEmployeeName) @@ -77,7 +75,7 @@ describe('Admin - Employee Management', function () { .contains('button', 'Delete Employee') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the employee is removed cy.get('#container--employees') .contains(testEmployeeName) diff --git a/cypress/e2e/01-admin/equipment.admin.cy.js b/cypress/e2e/01-admin/equipment.admin.cy.js index 3bdcc609..9135338d 100644 --- a/cypress/e2e/01-admin/equipment.admin.cy.js +++ b/cypress/e2e/01-admin/equipment.admin.cy.js @@ -1,37 +1,35 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Equipment Maintenance', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Equipment Maintenance', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/equipment'); cy.location('pathname').should('equal', '/admin/equipment'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add equipment', function () { + it('Can add equipment', () => { // Click the Add Equipment button cy.get('#button--addEquipment').click(); // Wait for modal to appear cy.get('#modal--addEquipment').should('be.visible'); // Fill in the equipment details - var testEquipment = "Test Equipment ".concat(Date.now()); + const testEquipment = `Test Equipment ${Date.now()}`; cy.get('#addEquipment--equipmentName').type(testEquipment); // Submit the form cy.get('#form--addEquipment').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the equipment appears in the container cy.get('#container--equipment') .contains(testEquipment) .should('exist'); }); - it('Can update equipment', function () { + it('Can update equipment', () => { // Find the first edit button and click it cy.get('#container--equipment') .find('button[title*="Edit"]') @@ -40,10 +38,10 @@ describe('Admin - Equipment Maintenance', function () { // Wait for modal to appear cy.get('#modal--editEquipment').should('be.visible'); // Update the equipment name - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editEquipment--equipmentName') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editEquipment--equipmentName') .clear() .type(originalValue + updatedText); @@ -51,19 +49,19 @@ describe('Admin - Equipment Maintenance', function () { // Submit the form cy.get('#form--editEquipment').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated equipment appears cy.get('#container--equipment') .contains(updatedText) .should('exist'); }); - it('Can delete equipment', function () { + it('Can delete equipment', () => { // First, add equipment to delete cy.get('#button--addEquipment').click(); - var testEquipment = "Delete Equipment ".concat(Date.now()); + const testEquipment = `Delete Equipment ${Date.now()}`; cy.get('#addEquipment--equipmentName').type(testEquipment); cy.get('#form--addEquipment').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--equipment') .contains(testEquipment) @@ -77,7 +75,7 @@ describe('Admin - Equipment Maintenance', function () { .contains('button', 'Delete Equipment') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the equipment is removed cy.get('#container--equipment') .contains(testEquipment) diff --git a/cypress/e2e/01-admin/locations.admin.cy.js b/cypress/e2e/01-admin/locations.admin.cy.js index 5f7b4d1c..c289a068 100644 --- a/cypress/e2e/01-admin/locations.admin.cy.js +++ b/cypress/e2e/01-admin/locations.admin.cy.js @@ -1,39 +1,37 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Location Maintenance', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Location Maintenance', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/locations'); cy.location('pathname').should('equal', '/admin/locations'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a location', function () { + it('Can add a location', () => { // Click the Add Location button cy.get('#button--addLocation').click(); // Wait for modal to appear cy.get('#modal--addLocation').should('be.visible'); // Fill in the location details - var testAddress = "Test Address ".concat(Date.now()); + const testAddress = `Test Address ${Date.now()}`; cy.get('#addLocation--address1').type(testAddress); cy.get('#addLocation--address2').type('Suite 100'); cy.get('#addLocation--cityProvince').type('Test City'); // Submit the form cy.get('#form--addLocation').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the location appears in the container cy.get('#container--locations') .contains(testAddress) .should('exist'); }); - it('Can update a location', function () { + it('Can update a location', () => { // Find the first edit button and click it cy.get('#container--locations') .find('button[title*="Edit"]') @@ -42,10 +40,10 @@ describe('Admin - Location Maintenance', function () { // Wait for modal to appear cy.get('#modal--editLocation').should('be.visible'); // Update the address - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editLocation--address1') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editLocation--address1') .clear() .type(originalValue + updatedText); @@ -53,19 +51,19 @@ describe('Admin - Location Maintenance', function () { // Submit the form cy.get('#form--editLocation').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated location appears cy.get('#container--locations') .contains(updatedText) .should('exist'); }); - it('Can delete a location', function () { + it('Can delete a location', () => { // First, add a location to delete cy.get('#button--addLocation').click(); - var testAddress = "Delete Location ".concat(Date.now()); + const testAddress = `Delete Location ${Date.now()}`; cy.get('#addLocation--address1').type(testAddress); cy.get('#form--addLocation').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--locations') .contains(testAddress) @@ -79,7 +77,7 @@ describe('Admin - Location Maintenance', function () { .contains('button', 'Delete Location') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the location is removed cy.get('#container--locations') .contains(testAddress) diff --git a/cypress/e2e/01-admin/settings.admin.cy.js b/cypress/e2e/01-admin/settings.admin.cy.js index b8218bc8..213a2615 100644 --- a/cypress/e2e/01-admin/settings.admin.cy.js +++ b/cypress/e2e/01-admin/settings.admin.cy.js @@ -1,46 +1,44 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Application Settings', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Application Settings', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/settings'); cy.location('pathname').should('equal', '/admin/settings'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can update a setting', function () { + it('Can update a setting', () => { // Find the first editable setting (text input) cy.get('.settingForm') .has('input.input[type="text"]') .first() - .within(function () { + .within(() => { // Get the current value cy.get('input.input[type="text"]') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { // Change the value - var newValue = "".concat(originalValue, "-test"); + const newValue = `${originalValue}-test`; cy.get('input.input[type="text"]').clear().type(newValue); // Submit the form cy.get('form').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify success (the warning background should be removed) cy.get('input.input[type="text"]').should('not.have.class', 'has-background-warning-light'); // Restore the original value cy.get('input.input[type="text"]').clear().type(originalValue.toString()); cy.get('form').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); }); }); }); - it('Highlights changed settings', function () { + it('Highlights changed settings', () => { // Find the first text input setting cy.get('.settingForm input.input[type="text"]').first().as('settingInput'); // Change the value @@ -48,7 +46,7 @@ describe('Admin - Application Settings', function () { // Verify the input has the warning background cy.get('@settingInput').should('have.class', 'has-background-warning-light'); }); - it('Can filter settings', function () { + it('Can filter settings', () => { // Type in the filter cy.get('#settingsFilter').type('application'); // Wait a moment for the filter to apply diff --git a/cypress/e2e/01-admin/tags.admin.cy.js b/cypress/e2e/01-admin/tags.admin.cy.js index b2587ae9..43848d64 100644 --- a/cypress/e2e/01-admin/tags.admin.cy.js +++ b/cypress/e2e/01-admin/tags.admin.cy.js @@ -1,37 +1,35 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Tag Maintenance', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Tag Maintenance', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/tags'); cy.location('pathname').should('equal', '/admin/tags'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a tag', function () { + it('Can add a tag', () => { // Click the Add Tag button cy.get('#button--addTag').click(); // Wait for modal to appear cy.get('#modal--addTag').should('be.visible'); // Fill in the tag details - var testTagName = "Test Tag ".concat(Date.now()); + const testTagName = `Test Tag ${Date.now()}`; cy.get('#addTag--tagName').type(testTagName); // Submit the form cy.get('#form--addTag').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the tag appears in the container cy.get('#container--tags') .contains(testTagName) .should('exist'); }); - it('Can update a tag', function () { + it('Can update a tag', () => { // Find the first edit button and click it cy.get('#container--tags') .find('button[title*="Edit"]') @@ -40,10 +38,10 @@ describe('Admin - Tag Maintenance', function () { // Wait for modal to appear cy.get('#modal--editTag').should('be.visible'); // Update the tag name - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editTag--tagName') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editTag--tagName') .clear() .type(originalValue + updatedText); @@ -51,19 +49,19 @@ describe('Admin - Tag Maintenance', function () { // Submit the form cy.get('#form--editTag').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated tag appears cy.get('#container--tags') .contains(updatedText) .should('exist'); }); - it('Can delete a tag', function () { + it('Can delete a tag', () => { // First, add a tag to delete cy.get('#button--addTag').click(); - var testTagName = "Delete Tag ".concat(Date.now()); + const testTagName = `Delete Tag ${Date.now()}`; cy.get('#addTag--tagName').type(testTagName); cy.get('#form--addTag').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--tags') .contains(testTagName) @@ -77,7 +75,7 @@ describe('Admin - Tag Maintenance', function () { .contains('button', 'Delete Tag') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the tag is removed cy.get('#container--tags') .contains(testTagName) diff --git a/cypress/e2e/01-admin/userGroups.admin.cy.js b/cypress/e2e/01-admin/userGroups.admin.cy.js index 6977d943..5444dc03 100644 --- a/cypress/e2e/01-admin/userGroups.admin.cy.js +++ b/cypress/e2e/01-admin/userGroups.admin.cy.js @@ -1,37 +1,35 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - User Group Management', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - User Group Management', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/userGroups'); cy.location('pathname').should('equal', '/admin/userGroups'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a user group', function () { + it('Can add a user group', () => { // Click the Add User Group button cy.get('#button--addUserGroup').click(); // Wait for modal to appear cy.get('#modal--addUserGroup').should('be.visible'); // Fill in the user group details - var testGroupName = "Test Group ".concat(Date.now()); + const testGroupName = `Test Group ${Date.now()}`; cy.get('#addUserGroup--groupName').type(testGroupName); // Submit the form cy.get('#form--addUserGroup').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the user group appears in the container cy.get('#container--userGroups') .contains(testGroupName) .should('exist'); }); - it('Can update a user group', function () { + it('Can update a user group', () => { // Find the first edit button and click it cy.get('#container--userGroups') .find('button[title*="Edit"]') @@ -40,10 +38,10 @@ describe('Admin - User Group Management', function () { // Wait for modal to appear cy.get('#modal--editUserGroup').should('be.visible'); // Update the group name - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editUserGroup--groupName') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editUserGroup--groupName') .clear() .type(originalValue + updatedText); @@ -51,19 +49,19 @@ describe('Admin - User Group Management', function () { // Submit the form cy.get('#form--editUserGroup').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated group appears cy.get('#container--userGroups') .contains(updatedText) .should('exist'); }); - it('Can delete a user group', function () { + it('Can delete a user group', () => { // First, add a user group to delete cy.get('#button--addUserGroup').click(); - var testGroupName = "Delete Group ".concat(Date.now()); + const testGroupName = `Delete Group ${Date.now()}`; cy.get('#addUserGroup--groupName').type(testGroupName); cy.get('#form--addUserGroup').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--userGroups') .contains(testGroupName) @@ -77,7 +75,7 @@ describe('Admin - User Group Management', function () { .contains('button', 'Delete Group') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the group is removed cy.get('#container--userGroups') .contains(testGroupName) diff --git a/cypress/e2e/01-admin/users.admin.cy.js b/cypress/e2e/01-admin/users.admin.cy.js index f6053493..732b9aee 100644 --- a/cypress/e2e/01-admin/users.admin.cy.js +++ b/cypress/e2e/01-admin/users.admin.cy.js @@ -1,43 +1,41 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - User Management', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - User Management', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/users'); cy.location('pathname').should('equal', '/admin/users'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a user', function () { + it('Can add a user', () => { // Click the Add User button cy.get('#button--addUser').click(); // Wait for modal to appear cy.get('#modal--addUser').should('be.visible'); // Fill in the username - var testUserName = "testuser".concat(Date.now()); + const testUserName = `testuser${Date.now()}`; cy.get('#userName').type(testUserName); // Submit the form cy.get('#form--addUser').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the user appears in the table cy.get('#container--users') .contains('td', testUserName) .should('exist'); }); - it('Can delete a user', function () { + it('Can delete a user', () => { // First, add a user to delete cy.get('#button--addUser').click(); - var testUserName = "deleteuser".concat(Date.now()); + const testUserName = `deleteuser${Date.now()}`; cy.get('#userName').type(testUserName); cy.get('#form--addUser').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button for this user cy.get('#container--users') .contains('tr', testUserName) @@ -50,23 +48,23 @@ describe('Admin - User Management', function () { .contains('button', 'Delete User') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the user is removed from the table cy.get('#container--users') .contains('td', testUserName) .should('not.exist'); }); - it('Can toggle user permissions', function () { + it('Can toggle user permissions', () => { // Find the first user in the table and toggle a permission cy.get('#container--users') .find('button.permission-toggle') .first() - .then(function ($button) { - var initialClass = $button.hasClass('is-success') ? 'is-success' : 'is-light'; + .then(($button) => { + const initialClass = $button.hasClass('is-success') ? 'is-success' : 'is-light'; // Click the button cy.wrap($button).click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the button class changed cy.wrap($button).should('not.have.class', initialClass); }); diff --git a/cypress/e2e/01-admin/workOrderTypes.admin.cy.js b/cypress/e2e/01-admin/workOrderTypes.admin.cy.js index aea29014..abfeef09 100644 --- a/cypress/e2e/01-admin/workOrderTypes.admin.cy.js +++ b/cypress/e2e/01-admin/workOrderTypes.admin.cy.js @@ -1,37 +1,35 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var _globals_js_1 = require("../../../test/_globals.js"); -var index_js_1 = require("../../support/index.js"); -describe('Admin - Work Order Type Maintenance', function () { - beforeEach('Loads page', function () { - (0, index_js_1.logout)(); - (0, index_js_1.login)(_globals_js_1.testAdmin); +import { testAdmin } from '../../../test/_globals.js'; +import { ajaxDelayMillis, login, logout } from '../../support/index.js'; +describe('Admin - Work Order Type Maintenance', () => { + beforeEach('Loads page', () => { + logout(); + login(testAdmin); cy.visit('/admin/workOrderTypes'); cy.location('pathname').should('equal', '/admin/workOrderTypes'); }); - afterEach(index_js_1.logout); - it('Has no detectable accessibility issues', function () { + afterEach(logout); + it('Has no detectable accessibility issues', () => { cy.injectAxe(); cy.checkA11y(); }); - it('Can add a work order type', function () { + it('Can add a work order type', () => { // Click the Add Work Order Type button cy.get('#button--addWorkOrderType').click(); // Wait for modal to appear cy.get('#modal--addWorkOrderType').should('be.visible'); // Fill in the work order type details - var testTypeName = "Test Type ".concat(Date.now()); + const testTypeName = `Test Type ${Date.now()}`; cy.get('#addWorkOrderType--workOrderType').type(testTypeName); // Submit the form cy.get('#form--addWorkOrderType').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the work order type appears in the container cy.get('#container--workOrderTypes') .contains(testTypeName) .should('exist'); }); - it('Can update a work order type', function () { + it('Can update a work order type', () => { // Find the first edit button and click it cy.get('#container--workOrderTypes') .find('button[title*="Edit"]') @@ -40,10 +38,10 @@ describe('Admin - Work Order Type Maintenance', function () { // Wait for modal to appear cy.get('#modal--editWorkOrderType').should('be.visible'); // Update the work order type - var updatedText = " - Updated ".concat(Date.now()); + const updatedText = ` - Updated ${Date.now()}`; cy.get('#editWorkOrderType--workOrderType') .invoke('val') - .then(function (originalValue) { + .then((originalValue) => { cy.get('#editWorkOrderType--workOrderType') .clear() .type(originalValue + updatedText); @@ -51,19 +49,19 @@ describe('Admin - Work Order Type Maintenance', function () { // Submit the form cy.get('#form--editWorkOrderType').submit(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the updated work order type appears cy.get('#container--workOrderTypes') .contains(updatedText) .should('exist'); }); - it('Can delete a work order type', function () { + it('Can delete a work order type', () => { // First, add a work order type to delete cy.get('#button--addWorkOrderType').click(); - var testTypeName = "Delete Type ".concat(Date.now()); + const testTypeName = `Delete Type ${Date.now()}`; cy.get('#addWorkOrderType--workOrderType').type(testTypeName); cy.get('#form--addWorkOrderType').submit(); - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Find and click the delete button cy.get('#container--workOrderTypes') .contains(testTypeName) @@ -77,7 +75,7 @@ describe('Admin - Work Order Type Maintenance', function () { .contains('button', 'Delete') .click(); // Wait for AJAX response - cy.wait(index_js_1.ajaxDelayMillis); + cy.wait(ajaxDelayMillis); // Verify the work order type is removed cy.get('#container--workOrderTypes') .contains(testTypeName) From 6d71c59704489b06871cfde3d436ad4ae6a31a75 Mon Sep 17 00:00:00 2001 From: Dan Gowans Date: Tue, 9 Dec 2025 13:54:33 -0500 Subject: [PATCH 5/5] fix employees test --- cypress/e2e/01-admin/employees.admin.cy.js | 29 +++++++++++------- cypress/e2e/01-admin/employees.admin.cy.ts | 34 +++++++++++++++------- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/cypress/e2e/01-admin/employees.admin.cy.js b/cypress/e2e/01-admin/employees.admin.cy.js index cb79bf8d..ce25a76d 100644 --- a/cypress/e2e/01-admin/employees.admin.cy.js +++ b/cypress/e2e/01-admin/employees.admin.cy.js @@ -18,15 +18,19 @@ describe('Admin - Employee Management', () => { // Wait for modal to appear cy.get('#modal--addEmployee').should('be.visible'); // Fill in the employee details - const testEmployeeName = `Test Employee ${Date.now()}`; - cy.get('#addEmployee--employeeName').type(testEmployeeName); + const testEmployeeNumber = Date.now().toString(); + const testEmployeeFirstName = `Test First ${testEmployeeNumber}`; + const testEmployeeLastName = `Test Last ${testEmployeeNumber}`; + cy.get('#addEmployee--employeeNumber').type(testEmployeeNumber); + cy.get('#addEmployee--firstName').type(testEmployeeFirstName); + cy.get('#addEmployee--lastName').type(testEmployeeLastName); // Submit the form cy.get('#form--addEmployee').submit(); // Wait for AJAX response cy.wait(ajaxDelayMillis); // Verify the employee appears in the container cy.get('#container--employees') - .contains(testEmployeeName) + .contains(testEmployeeNumber) .should('exist'); }); it('Can update an employee', () => { @@ -39,10 +43,10 @@ describe('Admin - Employee Management', () => { cy.get('#modal--editEmployee').should('be.visible'); // Update the employee name const updatedText = ` - Updated ${Date.now()}`; - cy.get('#editEmployee--employeeName') + cy.get('#editEmployee--lastName') .invoke('val') .then((originalValue) => { - cy.get('#editEmployee--employeeName') + cy.get('#editEmployee--lastName') .clear() .type(originalValue + updatedText); }); @@ -58,14 +62,19 @@ describe('Admin - Employee Management', () => { it('Can delete an employee', () => { // First, add an employee to delete cy.get('#button--addEmployee').click(); - const testEmployeeName = `Delete Employee ${Date.now()}`; - cy.get('#addEmployee--employeeName').type(testEmployeeName); + const testEmployeeNumber = Date.now().toString(); + const testEmployeeFirstName = `Delete First ${testEmployeeNumber}`; + const testEmployeeLastName = `Delete Last ${testEmployeeNumber}`; + cy.get('#addEmployee--employeeNumber').type(testEmployeeNumber); + cy.get('#addEmployee--firstName').type(testEmployeeFirstName); + cy.get('#addEmployee--lastName').type(testEmployeeLastName); cy.get('#form--addEmployee').submit(); cy.wait(ajaxDelayMillis); + cy.get('.modal button[data-cy="ok"]').click(); // Find and click the delete button cy.get('#container--employees') - .contains(testEmployeeName) - .parents('.panel-block') + .contains(testEmployeeNumber) + .parents('tr') .find('button[title*="Delete"]') .click(); // Wait for confirmation modal @@ -78,7 +87,7 @@ describe('Admin - Employee Management', () => { cy.wait(ajaxDelayMillis); // Verify the employee is removed cy.get('#container--employees') - .contains(testEmployeeName) + .contains(testEmployeeNumber) .should('not.exist'); }); }); diff --git a/cypress/e2e/01-admin/employees.admin.cy.ts b/cypress/e2e/01-admin/employees.admin.cy.ts index 3adac106..cf571298 100644 --- a/cypress/e2e/01-admin/employees.admin.cy.ts +++ b/cypress/e2e/01-admin/employees.admin.cy.ts @@ -24,8 +24,13 @@ describe('Admin - Employee Management', () => { cy.get('#modal--addEmployee').should('be.visible') // Fill in the employee details - const testEmployeeName = `Test Employee ${Date.now()}` - cy.get('#addEmployee--employeeName').type(testEmployeeName) + const testEmployeeNumber = Date.now().toString() + const testEmployeeFirstName = `Test First ${testEmployeeNumber}` + const testEmployeeLastName = `Test Last ${testEmployeeNumber}` + + cy.get('#addEmployee--employeeNumber').type(testEmployeeNumber) + cy.get('#addEmployee--firstName').type(testEmployeeFirstName) + cy.get('#addEmployee--lastName').type(testEmployeeLastName) // Submit the form cy.get('#form--addEmployee').submit() @@ -35,7 +40,7 @@ describe('Admin - Employee Management', () => { // Verify the employee appears in the container cy.get('#container--employees') - .contains(testEmployeeName) + .contains(testEmployeeNumber) .should('exist') }) @@ -51,10 +56,11 @@ describe('Admin - Employee Management', () => { // Update the employee name const updatedText = ` - Updated ${Date.now()}` - cy.get('#editEmployee--employeeName') + + cy.get('#editEmployee--lastName') .invoke('val') .then((originalValue) => { - cy.get('#editEmployee--employeeName') + cy.get('#editEmployee--lastName') .clear() .type(originalValue + updatedText) }) @@ -74,15 +80,23 @@ describe('Admin - Employee Management', () => { it('Can delete an employee', () => { // First, add an employee to delete cy.get('#button--addEmployee').click() - const testEmployeeName = `Delete Employee ${Date.now()}` - cy.get('#addEmployee--employeeName').type(testEmployeeName) + + const testEmployeeNumber = Date.now().toString() + const testEmployeeFirstName = `Delete First ${testEmployeeNumber}` + const testEmployeeLastName = `Delete Last ${testEmployeeNumber}` + cy.get('#addEmployee--employeeNumber').type(testEmployeeNumber) + cy.get('#addEmployee--firstName').type(testEmployeeFirstName) + cy.get('#addEmployee--lastName').type(testEmployeeLastName) + cy.get('#form--addEmployee').submit() cy.wait(ajaxDelayMillis) + cy.get('.modal button[data-cy="ok"]').click() + // Find and click the delete button cy.get('#container--employees') - .contains(testEmployeeName) - .parents('.panel-block') + .contains(testEmployeeNumber) + .parents('tr') .find('button[title*="Delete"]') .click() @@ -99,7 +113,7 @@ describe('Admin - Employee Management', () => { // Verify the employee is removed cy.get('#container--employees') - .contains(testEmployeeName) + .contains(testEmployeeNumber) .should('not.exist') }) }) \ No newline at end of file