From 37ccc939563af584e423469a16e51d6b8dc56337 Mon Sep 17 00:00:00 2001 From: Adeliona Date: Thu, 19 Feb 2026 18:06:17 +0200 Subject: [PATCH] Added new tests C5555 C488 C524 C533 C536 --- .../verify-patron-blocks-newest-first.cy.js | 82 ++++++++++++++ .../permissions/checkin-all-permissions.cy.js | 107 ++++++++++++++++++ cypress/support/fragments/users/usersCard.js | 4 + 3 files changed, 193 insertions(+) create mode 100644 cypress/e2e/fees-&-fines/verify-patron-blocks-newest-first.cy.js create mode 100644 cypress/e2e/permissions/checkin-all-permissions.cy.js diff --git a/cypress/e2e/fees-&-fines/verify-patron-blocks-newest-first.cy.js b/cypress/e2e/fees-&-fines/verify-patron-blocks-newest-first.cy.js new file mode 100644 index 0000000000..3ea40b10af --- /dev/null +++ b/cypress/e2e/fees-&-fines/verify-patron-blocks-newest-first.cy.js @@ -0,0 +1,82 @@ +import { Permissions } from '../../support/dictionary'; +import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints'; +import TopMenu from '../../support/fragments/topMenu'; +import UserEdit from '../../support/fragments/users/userEdit'; +import Users from '../../support/fragments/users/users'; +import UsersCard from '../../support/fragments/users/usersCard'; +import UsersSearchPane from '../../support/fragments/users/usersSearchPane'; + +function addPatronBlock(description, user) { + return cy.createBlockApi({ + desc: description, + borrowing: true, + renewals: true, + requests: true, + type: 'Manual', + userId: user.userId, + }); +} + +describe('Fees&Fines', () => { + describe('Manual Patron Blocks', () => { + const testData = { + servicePoint: ServicePoints.getDefaultServicePointWithPickUpLocation(), + }; + const userData = {}; + const blockIds = {}; + const blockDescriptions = { + firstBlock: 'Manual block created first', + secondBlock: 'Manual block created second', + }; + + before('Create test data', () => { + cy.getAdminToken().then(() => { + ServicePoints.createViaApi(testData.servicePoint); + }); + + cy.createTempUser([ + Permissions.checkoutAll.gui, + Permissions.uiUsersPatronBlocks.gui, + Permissions.uiUsersView.gui, + ]) + .then((userProperties) => { + userData.user = userProperties; + }) + .then(() => { + UserEdit.addServicePointViaApi(testData.servicePoint.id, userData.user.userId); + addPatronBlock(blockDescriptions.firstBlock, userData.user).then((body) => { + blockIds.id1 = body.id; + }); + cy.wait(2000); + addPatronBlock(blockDescriptions.secondBlock, userData.user).then((body) => { + blockIds.id2 = body.id; + }); + }); + }); + + after('Delete test data', () => { + cy.getAdminToken(); + UserEdit.changeServicePointPreferenceViaApi(userData.user.userId, [testData.servicePoint.id]); + ServicePoints.deleteViaApi(testData.servicePoint.id); + cy.deleteBlockApi(blockIds.id1); + cy.deleteBlockApi(blockIds.id2); + Users.deleteViaApi(userData.user.userId); + }); + + it( + 'C5555 Verify that "User Information" displays newest manual patron block first when more than one exists (vega)', + { tags: ['extendedPath', 'vega', 'C5555'] }, + () => { + cy.login(userData.user.username, userData.user.password, { + path: TopMenu.usersPath, + waiter: UsersSearchPane.waitLoading, + }); + UsersSearchPane.searchByKeywords(userData.user.barcode); + UsersCard.waitLoading(); + UsersCard.openPatronBlocks(); + UsersCard.verifyPatronBlockDescription(1, blockDescriptions.secondBlock); + UsersCard.verifyPatronBlockDescription(2, blockDescriptions.firstBlock); + }, + ); + }); +}); diff --git a/cypress/e2e/permissions/checkin-all-permissions.cy.js b/cypress/e2e/permissions/checkin-all-permissions.cy.js new file mode 100644 index 0000000000..20487a2a32 --- /dev/null +++ b/cypress/e2e/permissions/checkin-all-permissions.cy.js @@ -0,0 +1,107 @@ +import { PaneHeader } from '../../../interactors'; +import Permissions from '../../support/dictionary/permissions'; +import CheckInActions from '../../support/fragments/check-in-actions/checkInActions'; +import Requests from '../../support/fragments/requests/requests'; +import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints'; +import SettingsMenu from '../../support/fragments/settingsMenu'; +import TopMenu from '../../support/fragments/topMenu'; +import UserEdit from '../../support/fragments/users/userEdit'; +import Users from '../../support/fragments/users/users'; +import UsersCard from '../../support/fragments/users/usersCard'; +import UsersSearchPane from '../../support/fragments/users/usersSearchPane'; + +describe('Permissions', () => { + const testData = { + checkin: {}, + requests: {}, + feefines: {}, + viewRequests: {}, + }; + let servicePoint; + + before('Create test data', () => { + cy.getAdminToken().then(() => { + servicePoint = ServicePoints.getDefaultServicePointWithPickUpLocation(); + ServicePoints.createViaApi(servicePoint); + }); + + cy.createTempUser([Permissions.checkinAll.gui]).then((userProperties) => { + testData.checkin.user = userProperties; + UserEdit.addServicePointViaApi( + servicePoint.id, + testData.checkin.user.userId, + servicePoint.id, + ); + }); + + cy.createTempUser([Permissions.uiRequestsAll.gui]).then((userProperties) => { + testData.requests.user = userProperties; + UserEdit.addServicePointViaApi( + servicePoint.id, + testData.requests.user.userId, + servicePoint.id, + ); + }); + + cy.createTempUser([Permissions.uiUsersSettingsAllFeeFinesRelated.gui]).then( + (userProperties) => { + testData.feefines.user = userProperties; + }, + ); + + cy.createTempUser([Permissions.usersViewRequests.gui, Permissions.uiUsersView.gui]).then( + (userProperties) => { + testData.viewRequests.user = userProperties; + }, + ); + }); + + after('Delete test data', () => { + cy.getAdminToken(); + UserEdit.changeServicePointPreferenceViaApi(testData.checkin.user.userId, [servicePoint.id]); + UserEdit.changeServicePointPreferenceViaApi(testData.requests.user.userId, [servicePoint.id]); + ServicePoints.deleteViaApi(servicePoint.id); + Users.deleteViaApi(testData.checkin.user.userId); + Users.deleteViaApi(testData.requests.user.userId); + Users.deleteViaApi(testData.feefines.user.userId); + Users.deleteViaApi(testData.viewRequests.user.userId); + }); + + it('C488 Check in: All permissions (vega)', { tags: ['extendedPath', 'vega', 'C488'] }, () => { + cy.login(testData.checkin.user.username, testData.checkin.user.password, { + path: TopMenu.checkInPath, + waiter: CheckInActions.waitLoading, + }); + CheckInActions.waitLoading(); + }); + + it('C524 Requests: All permissions (vega)', { tags: ['extendedPath', 'vega', 'C524'] }, () => { + cy.login(testData.requests.user.username, testData.requests.user.password, { + path: TopMenu.requestsPath, + waiter: Requests.waitLoading, + }); + Requests.waitLoading(); + }); + + it( + 'C533 Settings (Users): Can create, edit and remove all feefines-related entries (vega)', + { tags: ['extendedPath', 'vega', 'C533'] }, + () => { + cy.login(testData.feefines.user.username, testData.feefines.user.password, { + path: SettingsMenu.usersOwnersPath, + waiter: PaneHeader('Fee/fine: Owners').exists, + }); + }, + ); + + it('C536 Users: View requests (vega)', { tags: ['extendedPath', 'vega', 'C536'] }, () => { + cy.login(testData.viewRequests.user.username, testData.viewRequests.user.password, { + path: TopMenu.usersPath, + waiter: UsersSearchPane.waitLoading, + }); + UsersSearchPane.searchByUsername(testData.viewRequests.user.username); + UsersSearchPane.selectUserFromList(testData.viewRequests.user.username); + UsersCard.waitLoading(); + UsersCard.verifyRequestsAccordionExists(); + }); +}); diff --git a/cypress/support/fragments/users/usersCard.js b/cypress/support/fragments/users/usersCard.js index da9f4ec10d..4e7ae19f88 100644 --- a/cypress/support/fragments/users/usersCard.js +++ b/cypress/support/fragments/users/usersCard.js @@ -680,6 +680,10 @@ export default { cy.expect(userRolesAccordion.find(HTML(userRolesEmptyText)).exists()); }, + verifyRequestsAccordionExists() { + cy.expect(requestsAccordion.exists()); + }, + verifyProfilePictureIsPresent(url) { cy.expect(rootSection.find(profilePictureCard).has({ src: including(url) })); },