Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for FAT-12145 #3669

Merged
merged 2 commits into from
May 29, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import TitleLevelRequests from '../../support/fragments/settings/circulation/tit
import Location from '../../support/fragments/settings/tenant/locations/newLocation';
import ServicePoints from '../../support/fragments/settings/tenant/servicePoints/servicePoints';
import PatronGroups from '../../support/fragments/settings/users/patronGroups';
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';
Expand All @@ -35,10 +34,6 @@ describe('Title Level Request', () => {
before('Preconditions', () => {
cy.getAdminToken()
.then(() => {
cy.loginAsAdmin({
path: SettingsMenu.circulationTitleLevelRequestsPath,
waiter: TitleLevelRequests.waitLoading,
});
ServicePoints.createViaApi(testData.userServicePoint);
testData.defaultLocation = Location.getDefaultLocation(testData.userServicePoint.id);
Location.createViaApi(testData.defaultLocation);
Expand Down Expand Up @@ -111,7 +106,7 @@ describe('Title Level Request', () => {
);
})
.then(() => {
TitleLevelRequests.changeTitleLevelRequestsStatus('allow');
TitleLevelRequests.enableTLRViaApi();
Requests.createNewRequestViaApi({
fulfillmentPreference: FULFILMENT_PREFERENCES.HOLD_SHELF,
instanceId: instanceData.instanceId,
Expand All @@ -129,10 +124,7 @@ describe('Title Level Request', () => {
});

after('Deleting created entities', () => {
cy.loginAsAdmin({
path: SettingsMenu.circulationTitleLevelRequestsPath,
waiter: TitleLevelRequests.waitLoading,
});
cy.getAdminToken();
Requests.deleteRequestViaApi(testData.requestId);
InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(testData.currentItem);
cy.deleteLoanType(testData.loanTypeId);
Expand All @@ -146,7 +138,6 @@ describe('Title Level Request', () => {
testData.defaultLocation.libraryId,
testData.defaultLocation.id,
);
TitleLevelRequests.changeTitleLevelRequestsStatus('forbid');
});

it(
Expand Down
2 changes: 2 additions & 0 deletions cypress/support/fragments/requests/move-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const rootModal = Modal('Select item');

export default {
waitLoading: () => {
cy.wait(1000);
cy.expect(rootModal.exists());
},

Expand All @@ -21,6 +22,7 @@ export default {
},

checkIsRequestMovedSuccessfully() {
cy.wait(1000);
cy.expect(Pane(including('Request queue on instance')).exists());
InteractorsTools.checkCalloutMessage('Request has been moved successfully');
},
Expand Down
1 change: 1 addition & 0 deletions cypress/support/fragments/requests/requestDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ export default {
},

openActions() {
cy.wait(500);
cy.do(actionsButton.click());
},

Expand Down
2 changes: 2 additions & 0 deletions cypress/support/fragments/requests/requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ export default {

findCreatedRequest(title) {
cy.do(TextField({ id: 'input-request-search' }).fillIn(title));
cy.wait(500);
cy.do(Pane({ title: 'Search & filter' }).find(Button('Search')).click());
cy.wait(500);
},

selectAllOpenRequests() {
Expand Down
11 changes: 8 additions & 3 deletions cypress/support/fragments/settings/circulation/otherSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,20 @@ export default {
isDefaultSearchParamsRequired: false,
})
.then((otherSettingsResp) => {
const newConfig = otherSettingsResp.body.configs.length === 0;
let config = otherSettingsResp.body.configs[0];

if (newConfig) {
if (otherSettingsResp.body.configs.length === 0) {
config = {
value:
'{"audioAlertsEnabled":false,"audioTheme":"classic","checkoutTimeout":true,"checkoutTimeoutDuration":3,"prefPatronIdentifier":"barcode,username","useCustomFieldsAsIdentifiers":false,"wildcardLookupEnabled":false}',
module: 'CHECKOUT',
configName: 'other_settings',
id: uuid(),
};

const newValue = { ...JSON.parse(config.value), ...params };
config.value = JSON.stringify(newValue);

cy.okapiRequest({
method: 'POST',
path: 'configurations/entries',
Expand All @@ -79,6 +82,8 @@ export default {
});
} else {
const newValue = { ...JSON.parse(config.value), ...params };
config.value = JSON.stringify(newValue);

cy.okapiRequest({
method: 'PUT',
path: `configurations/entries/${config.id}`,
Expand All @@ -87,7 +92,7 @@ export default {
module: config.module,
configName: config.configName,
enabled: config.enabled,
value: JSON.stringify(newValue),
value: config.value,
},
isDefaultSearchParamsRequired: false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,38 +94,29 @@ export default {
},

enableTLRViaApi() {
this.updateTLRSettingViaApi(true);
this.updateTLRSettingViaApi({ titleLevelRequestsFeatureEnabled: true });
},

disableTLRViaApi() {
this.updateTLRSettingViaApi(false);
this.updateTLRSettingViaApi({ titleLevelRequestsFeatureEnabled: true });
},

updateTLRSettingViaApi(allow = true) {
updateTLRSettingViaApi(newSettings) {
cy.getConfigByName('TLR').then((body) => {
const newConfig = body.configs.length === 0;
let config = body.configs[0];
if (newConfig) {

if (body.configs.length === 0) {
config = {
value:
'{"titleLevelRequestsFeatureEnabled":true,"createTitleLevelRequestsByDefault":false,"tlrHoldShouldFollowCirculationRules":false,"confirmationPatronNoticeTemplateId":null,"cancellationPatronNoticeTemplateId":null,"expirationPatronNoticeTemplateId":null}',
module: 'SETTINGS',
configName: 'TLR',
id: uuid(),
};
}
if (allow) {
config.value = config.value.replace(
'"titleLevelRequestsFeatureEnabled":false,',
'"titleLevelRequestsFeatureEnabled":true,',
);
} else {
config.value = config.value.replace(
'"titleLevelRequestsFeatureEnabled":true,',
'"titleLevelRequestsFeatureEnabled":false,',
);
}
if (newConfig) {

const newValue = { ...JSON.parse(config.value), ...newSettings };
config.value = JSON.stringify(newValue);

cy.okapiRequest({
method: 'POST',
path: 'configurations/entries',
Expand All @@ -134,6 +125,9 @@ export default {
body: config,
});
} else {
const newValue = { ...JSON.parse(config.value), ...newSettings };
config.value = JSON.stringify(newValue);

cy.okapiRequest({
method: 'PUT',
path: `configurations/entries/${config.id}`,
Expand Down
Loading