Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 72 additions & 1 deletion cypress/e2e/01-admin/locations.admin.cy.js
Original file line number Diff line number Diff line change
@@ -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', () => {
logout();
Expand All @@ -12,4 +12,75 @@ 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');
});
});
91 changes: 90 additions & 1 deletion cypress/e2e/01-admin/locations.admin.cy.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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')
})
})
50 changes: 49 additions & 1 deletion cypress/e2e/01-admin/settings.admin.cy.js
Original file line number Diff line number Diff line change
@@ -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', () => {
logout();
Expand All @@ -12,4 +12,52 @@ 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');
});
});
67 changes: 66 additions & 1 deletion cypress/e2e/01-admin/settings.admin.cy.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand All @@ -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')
})
})
1 change: 1 addition & 0 deletions cypress/e2e/01-admin/tags.admin.cy.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
Loading