Skip to content

Commit

Permalink
Merge branch 'master' into eureka-test-snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
zentestuken committed Dec 20, 2024
2 parents 5615aa9 + 39a0c03 commit f41fa41
Show file tree
Hide file tree
Showing 14 changed files with 744 additions and 12 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ let centralSharedNoteTypeData;
const callNumberStarts = `${randomFourDigitNumber()}`;
const folioInstance = {
title: `C477646 folio instance testBulkEdit_${getRandomPostfix()}`,
barcodeInCollege: `Item_College${getRandomPostfix()}`,
barcodeInUniversity: `Item_University${getRandomPostfix()}`,
holdingCallNumberInCollege: `${callNumberStarts}${randomFourDigitNumber()}`,
holdingCallNumberInUniversity: `${callNumberStarts}${randomFourDigitNumber()}`,
holdingIds: [],
holdingHrids: [],
};
const marcInstance = {
title: `C477646 marc instance testBulkEdit_${getRandomPostfix()}`,
barcodeInCollege: `Item_College${getRandomPostfix()}`,
barcodeInUniversity: `Item_University${getRandomPostfix()}`,
holdingCallNumberInCollege: `${callNumberStarts}${randomFourDigitNumber()}`,
holdingCallNumberInUniversity: `${callNumberStarts}${randomFourDigitNumber()}`,
holdingIds: [],
Expand Down
10 changes: 4 additions & 6 deletions cypress/e2e/fse/ui/copycat-ui.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import TopMenu from '../../../support/fragments/topMenu';
import SettingsInventory, {
INVENTORY_SETTINGS_TABS,
} from '../../../support/fragments/settings/inventory/settingsInventory';
import SettingsInventory from '../../../support/fragments/settings/inventory/settingsInventory';
import Z3950TargetProfiles from '../../../support/fragments/settings/inventory/integrations/z39.50TargetProfiles';

describe('fse-copycat - UI for productions tenants', () => {
Expand All @@ -17,9 +15,9 @@ describe('fse-copycat - UI for productions tenants', () => {
{ tags: ['sanity', 'fse', 'ui', 'copycat'] },
() => {
cy.visit(TopMenu.settingsPath);
SettingsInventory.goToSettingsInventory();
SettingsInventory.selectSettingsTab(INVENTORY_SETTINGS_TABS.TARGET_PROFILES);
Z3950TargetProfiles.verifyTargetProfilesListDisplayed();
SettingsInventory.goToSettingsInventoryNoInteractors();
SettingsInventory.selectz3950ProfilesNoInteractors();
Z3950TargetProfiles.verifyTargetProfilesListDisplayedNoIntearctors();
},
);
});
2 changes: 1 addition & 1 deletion cypress/e2e/fse/ui/data-import-ui.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('fse-data-import - UI', () => {
{ tags: ['sanity', 'fse', 'ui', 'data-import'] },
() => {
cy.visit(TopMenu.dataImportPath);
DataImport.waitLoading();
DataImport.waitLoadingNoInteractors();
},
);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import getRandomPostfix from '../../../support/utils/stringTools';
import InstanceRecordEdit from '../../../support/fragments/inventory/instanceRecordEdit';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances';
import TopMenu from '../../../support/fragments/topMenu';
import { INSTANCE_DATE_TYPES } from '../../../support/constants';
import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView';
import Users from '../../../support/fragments/users/users';
import Permissions from '../../../support/dictionary/permissions';

describe('Inventory', () => {
describe('Instance', () => {
const testData = {
instanceTitle: `C552531 Auto ${getRandomPostfix()}`,
date1set: ['1999u', '1', '12', '12b', '12b6', '12b6', '12b6'],
date2set: ['20b27', '9', '199u', '199u', '19', '199', '199u'],
dateType: INSTANCE_DATE_TYPES.RANGE,
};

before('Login', () => {
cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then(
(userProperties) => {
testData.user = userProperties;
InventoryInstance.createInstanceViaApi({ instanceTitle: testData.instanceTitle }).then(
({ instanceData }) => {
testData.instanceId = instanceData.instanceId;
cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
InventoryInstances.searchByTitle(testData.instanceId);
InventoryInstances.selectInstanceById(testData.instanceId);
},
);
},
);
});

after('Delete test data', () => {
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(testData.instanceId);
Users.deleteViaApi(testData.user.userId);
});

it(
'C552531 Cannot update Instance with more or less than 4 characters in "Date 1" and "Date 2" fields (spitfire)',
{ tags: ['criticalPath', 'spitfire', 'C552531'] },
() => {
InstanceRecordView.verifyInstancePaneExists();
InstanceRecordView.edit();
InstanceRecordEdit.waitLoading();
InstanceRecordEdit.verifyDateFieldsValues();
InstanceRecordEdit.fillDates(
testData.date1set[0],
testData.date2set[0],
testData.dateType,
true,
);
InstanceRecordEdit.clickSaveAndKeepEditingButton();
InstanceRecordEdit.verifySuccessfulMessage();
InstanceRecordEdit.waitLoading();
InstanceRecordEdit.verifyDateFieldsValues(
testData.date1set[0].slice(0, 4),
testData.date2set[0].slice(0, 4),
testData.dateType,
);

InstanceRecordEdit.fillDates(testData.date1set[1], testData.date2set[1]);
InstanceRecordEdit.clickSaveAndCloseButton();
InstanceRecordEdit.verifyDateFieldsValidationErrors(true, true);

InstanceRecordEdit.fillDates(testData.date1set[2], testData.date2set[2]);
InstanceRecordEdit.clickSaveAndCloseButton();
InstanceRecordEdit.verifyDateFieldsValidationErrors(true, false);

InstanceRecordEdit.fillDates(testData.date1set[3], testData.date2set[3]);
InstanceRecordEdit.clickSaveAndCloseButton();
InstanceRecordEdit.verifyDateFieldsValidationErrors(true, false);

InstanceRecordEdit.fillDates(testData.date1set[4], testData.date2set[4]);
InstanceRecordEdit.clickSaveAndCloseButton();
InstanceRecordEdit.verifyDateFieldsValidationErrors(false, true);

InstanceRecordEdit.fillDates(testData.date1set[5], testData.date2set[5]);
InstanceRecordEdit.clickSaveAndCloseButton();
InstanceRecordEdit.verifyDateFieldsValidationErrors(false, true);

InstanceRecordEdit.fillDates(testData.date1set[6], testData.date2set[6]);
InstanceRecordEdit.saveAndClose();
InstanceRecordEdit.verifySuccessfulMessage();
InstanceRecordView.verifyInstanceIsOpened(testData.instanceTitle);
InstanceRecordView.verifyDates(
testData.date1set[6],
testData.date2set[6],
testData.dateType,
);
},
);
});
});
60 changes: 60 additions & 0 deletions cypress/e2e/inventory/instance/edit-instance-no-date2.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import getRandomPostfix from '../../../support/utils/stringTools';
import InstanceRecordEdit from '../../../support/fragments/inventory/instanceRecordEdit';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances';
import TopMenu from '../../../support/fragments/topMenu';
import { INSTANCE_DATE_TYPES } from '../../../support/constants';
import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView';
import Users from '../../../support/fragments/users/users';
import Permissions from '../../../support/dictionary/permissions';

describe('Inventory', () => {
describe('Instance', () => {
const testData = {
instanceTitle: `C552528 Auto ${getRandomPostfix()}`,
date1: '0981',
dateType: INSTANCE_DATE_TYPES.QUESTIONABLE,
};

before('Login', () => {
cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then(
(userProperties) => {
testData.user = userProperties;
InventoryInstance.createInstanceViaApi({ instanceTitle: testData.instanceTitle }).then(
({ instanceData }) => {
testData.instanceId = instanceData.instanceId;
cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
InventoryInstances.searchByTitle(testData.instanceId);
InventoryInstances.selectInstanceById(testData.instanceId);
},
);
},
);
});

after('Delete test data', () => {
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(testData.instanceId);
Users.deleteViaApi(testData.user.userId);
});

it(
'C552528 Edit Instance with selected "Date type" and field "Date 1" filled only (spitfire)',
{ tags: ['criticalPath', 'spitfire', 'C552528'] },
() => {
InstanceRecordView.verifyInstancePaneExists();
InstanceRecordView.edit();
InstanceRecordEdit.waitLoading();
InstanceRecordEdit.verifyDateFieldsValues();
InstanceRecordEdit.fillDates(testData.date1, undefined, testData.dateType);
InstanceRecordEdit.saveAndClose();
InstanceRecordEdit.verifySuccessfulMessage();
InstanceRecordView.verifyInstanceIsOpened(testData.instanceTitle);
InstanceRecordView.verifyDates(testData.date1, undefined, testData.dateType);
},
);
});
});
8 changes: 8 additions & 0 deletions cypress/support/fragments/bulk-edit/bulk-edit-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,14 @@ export default {
]);
},

replaceWithAction(option, newValue, rowIndex = 0) {
this.selectOption(option, rowIndex);
this.selectSecondAction('Replace with', rowIndex);
this.verifySecondActionSelected('Replace with', rowIndex);
this.fillInSecondTextArea(newValue, rowIndex);
this.verifyValueInSecondTextArea(newValue, rowIndex);
},

noteReplaceWith(noteType, oldNote, newNote, rowIndex = 0) {
this.findValue(noteType, rowIndex);
this.fillInFirstTextArea(oldNote, rowIndex);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import uuid from 'uuid';
import { REQUEST_METHOD } from '../../../../constants';

const id = uuid();

export default {
createViaApi(type) {
return cy.getConsortiaId().then((consortiaId) => {
cy.okapiRequest({
method: REQUEST_METHOD.POST,
path: `consortia/${consortiaId}/sharing/settings`,
body: {
url: '/electronic-access-relationships',
settingId: id,
payload: {
id,
name: type.payload.name,
},
},
}).then(() => {
type.url = '/electronic-access-relationships';
type.settingId = id;
return type;
});
});
},

deleteViaApi(type) {
cy.getConsortiaId().then((consortiaId) => {
cy.okapiRequest({
method: REQUEST_METHOD.DELETE,
path: `consortia/${consortiaId}/sharing/settings/${type.settingId}`,
body: type,
});
});
},
};
5 changes: 5 additions & 0 deletions cypress/support/fragments/data_import/dataImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -952,4 +952,9 @@ export default {
verifyUploadSectionHasNoUplodedFiles() {
cy.expect(sectionPaneJobsTitle.find(Button('or choose files')).exists());
},

waitLoadingNoInteractors() {
cy.expect(sectionPaneJobsTitle.exists());
cy.expect(logsPaneHeader.exists());
},
};
7 changes: 7 additions & 0 deletions cypress/support/fragments/inventory/instanceRecordEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const date1Field = descriptiveDataAccordion.find(TextField({ name: 'dates.date1'
const date2Field = descriptiveDataAccordion.find(TextField({ name: 'dates.date2' }));
const dateTypePlaceholderOption = 'Select date type';
const dateValueLengthErrorText = 'Date must contain four characters.';
const saveAndKeepEditing = Button('Save & keep editing');

const checkboxes = {
'Suppress from discovery': supressFromDiscoveryCheckbox,
Expand Down Expand Up @@ -295,6 +296,7 @@ export default {
InteractorsTools.checkCalloutMessage(
matching(new RegExp(InstanceStates.instanceSavedSuccessfully)),
);
InteractorsTools.dismissCallout(matching(new RegExp(InstanceStates.instanceSavedSuccessfully)));
},
checkCheckboxConditions(fields = []) {
fields.forEach(({ label, conditions }) => {
Expand Down Expand Up @@ -476,4 +478,9 @@ export default {
);
} else cy.expect(date2Field.has({ errorBorder: false, error: undefined }));
},

clickSaveAndKeepEditingButton(saved = true) {
cy.do(saveAndKeepEditing.click());
if (saved) cy.expect(saveAndKeepEditing.has({ disabled: true }));
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ export default {
},

resetAll() {
cy.do(resetAllBtn.click());
cy.do(resetAllButton.click());
cy.wait(1000);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ function getListOfURLRelationship() {
export default {
getListOfURLRelationship,

createViaApi(type) {
return cy
.okapiRequest({
method: 'POST',
path: 'electronic-access-relationships',
body: type,
isDefaultSearchParamsRequired: false,
})
.then((response) => {
return response.body;
});
},

deleteViaApi(id) {
return cy.okapiRequest({
method: 'DELETE',
path: `electronic-access-relationships/${id}`,
isDefaultSearchParamsRequired: false,
failOnStatusCode: false,
});
},

openTabFromInventorySettingsList() {
cy.do(NavListItem('Inventory').click());
cy.do(NavListItem('URL relationship').click());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,8 @@ export default {
isDefaultSearchParamsRequired: false,
});
},

verifyTargetProfilesListDisplayedNoIntearctors() {
cy.xpath("//span[contains(text(), 'Z39.50')]").should('be.visible');
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ export default {
cy.do(NavListItem('Inventory').click());
cy.expect(inventoryPane.exists());
},

goToSettingsInventoryNoInteractors() {
cy.xpath("//a[contains(@href, '/settings/inventory')]").click();
cy.xpath("//div[@id='paneHeaderapp-settings-nav-pane']").should('be.visible');
},

selectz3950ProfilesNoInteractors() {
cy.xpath("//a[contains(@href, '/settings/inventory/targetProfiles')]").click();
},
};

0 comments on commit f41fa41

Please sign in to comment.