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 Jan 23, 2025
2 parents 519d812 + 3d62eba commit 3fdd14e
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import {
APPLICATION_NAMES,
FOLIO_RECORD_TYPE,
JOB_STATUS_NAMES,
RECORD_STATUSES,
} from '../../../support/constants';
import { Permissions } from '../../../support/dictionary';
import ActionProfiles from '../../../support/fragments/data_import/action_profiles/actionProfiles';
import DataImport from '../../../support/fragments/data_import/dataImport';
import JobProfiles from '../../../support/fragments/data_import/job_profiles/jobProfiles';
import NewJobProfile from '../../../support/fragments/data_import/job_profiles/newJobProfile';
import FileDetails from '../../../support/fragments/data_import/logs/fileDetails';
import JsonScreenView from '../../../support/fragments/data_import/logs/jsonScreenView';
import Logs from '../../../support/fragments/data_import/logs/logs';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import {
ActionProfiles as SettingsActionProfiles,
FieldMappingProfiles as SettingsFieldMappingProfiles,
JobProfiles as SettingsJobProfiles,
} from '../../../support/fragments/settings/dataImport';
import FieldMappingProfileView from '../../../support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfileView';
import FieldMappingProfiles from '../../../support/fragments/settings/dataImport/fieldMappingProfile/fieldMappingProfiles';
import NewFieldMappingProfile from '../../../support/fragments/settings/dataImport/fieldMappingProfile/newFieldMappingProfile';
import SettingsDataImport, {
SETTINGS_TABS,
} from '../../../support/fragments/settings/dataImport/settingsDataImport';
import SettingsMenu from '../../../support/fragments/settingsMenu';
import TopMenuNavigation from '../../../support/fragments/topMenuNavigation';
import Users from '../../../support/fragments/users/users';
import getRandomPostfix from '../../../support/utils/stringTools';

describe('Data Import', () => {
describe('Log details', () => {
let user;
let instanceHrid;
const filePath = 'oneMarcBib.mrc';
const marcFileName = `C594482 autotestFile${getRandomPostfix()}.mrc`;
const mappingProfile = {
typeValue: FOLIO_RECORD_TYPE.INSTANCE,
name: `C594482 instance mapping profile ${getRandomPostfix()}`,
suppressFromDiscavery: 'Mark for all affected records',
};
const actionProfile = {
typeValue: FOLIO_RECORD_TYPE.INSTANCE,
name: `C594482 instance action profile ${getRandomPostfix()}`,
};
const jobProfile = {
...NewJobProfile.defaultJobProfile,
profileName: `C594482 job profile ${getRandomPostfix()}`,
};
const instanceTitle =
'Anglo-Saxon manuscripts in microfiche facsimile Volume 25 Corpus Christi College, Cambridge II, MSS 12, 144, 162, 178, 188, 198, 265, 285, 322, 326, 449 microform A. N. Doane (editor and director), Matthew T. Hussey (associate editor), Phillip Pulsiano (founding editor)';

before('Create test user and login', () => {
cy.createTempUser([
Permissions.settingsDataImportEnabled.gui,
Permissions.moduleDataImportEnabled.gui,
]).then((userProperties) => {
user = userProperties;

cy.login(user.username, user.password, {
path: SettingsMenu.mappingProfilePath,
waiter: FieldMappingProfiles.waitLoading,
});
});
});

after('Delete test data', () => {
cy.getAdminToken().then(() => {
SettingsJobProfiles.deleteJobProfileByNameViaApi(jobProfile.profileName);
SettingsActionProfiles.deleteActionProfileByNameViaApi(actionProfile.name);
SettingsFieldMappingProfiles.deleteMappingProfileByNameViaApi(mappingProfile.name);
});
Users.deleteViaApi(user.userId);
cy.getInstance({ limit: 1, expandAll: true, query: `"hrid"=="${instanceHrid}"` }).then(
(instance) => {
InventoryInstance.deleteInstanceViaApi(instance.id);
},
);
});

it(
'C594482 Suppress from discovery = TRUE in JSON after create import (folijet)',
{ tags: ['criticalPath', 'folijet', 'C594482'] },
() => {
// create mapping profiles
FieldMappingProfiles.openNewMappingProfileForm();
NewFieldMappingProfile.fillSummaryInMappingProfile(mappingProfile);
NewFieldMappingProfile.addSuppressFromDiscovery(mappingProfile.suppressFromDiscavery);
NewFieldMappingProfile.save();
FieldMappingProfileView.closeViewMode(mappingProfile.name);

// create action profiles
SettingsDataImport.selectSettingsTab(SETTINGS_TABS.ACTION_PROFILES);
ActionProfiles.create(actionProfile, mappingProfile.name);
ActionProfiles.checkActionProfilePresented(actionProfile.name);

// create job profile
SettingsDataImport.selectSettingsTab(SETTINGS_TABS.JOB_PROFILES);
JobProfiles.createJobProfile(jobProfile);
NewJobProfile.linkActionProfile(actionProfile);
NewJobProfile.saveAndClose();
JobProfiles.checkJobProfilePresented(jobProfile.profileName);

// upload a marc file for creating of the new instance, holding and item
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT);
DataImport.verifyUploadState();
DataImport.uploadFile(filePath, marcFileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.search(jobProfile.profileName);
JobProfiles.runImportFile();
Logs.waitFileIsImported(marcFileName);
Logs.checkJobStatus(marcFileName, JOB_STATUS_NAMES.COMPLETED);
Logs.openFileDetails(marcFileName);
[
FileDetails.columnNameInResultList.srsMarc,
FileDetails.columnNameInResultList.instance,
].forEach((columnName) => {
FileDetails.checkStatusInColumn(RECORD_STATUSES.CREATED, columnName);
});
FileDetails.openJsonScreen(instanceTitle);
JsonScreenView.verifyJsonScreenIsOpened();
JsonScreenView.openMarcSrsTab();
JsonScreenView.verifyContentInTab('"suppressDiscovery": true');
JsonScreenView.getInstanceHrid().then((initialInstanceHrId) => {
instanceHrid = initialInstanceHrId;
});
},
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import { DEFAULT_JOB_PROFILE_NAMES, INSTANCE_DATE_TYPES } from '../../../support/constants';
import { Permissions } from '../../../support/dictionary';
import DataImport from '../../../support/fragments/data_import/dataImport';
import FilterItems from '../../../support/fragments/inventory/filterItems';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../support/fragments/inventory/inventoryInstances';
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import getRandomPostfix from '../../../support/utils/stringTools';
import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView';

const testData = {
dateColumnName: 'Date',
searchQuery: 'C552488 Auto',
instances: [
{
title: 'C552488 Auto (first date only) Instance 01: No dates given; BC date involved',
dateType: INSTANCE_DATE_TYPES.BC,
date1: '1921',
},
{
title: 'C552488 Auto (first date only) Instance 02: Continuing resource currently published',
dateType: INSTANCE_DATE_TYPES.CONTINUING_PUBLISHED,
date1: '1922-',
},
{
title: 'C552488 Auto (first date only) Instance 03: Continuing resource ceased publication',
dateType: INSTANCE_DATE_TYPES.CONTINUING_CEASED,
date1: '1923-',
},
{
title: 'C552488 Auto (first date only) Instance 04: Detailed date',
dateType: INSTANCE_DATE_TYPES.DETAILED,
date1: '1924',
},
{
title: 'C552488 Auto (first date only) Instance 05: Inclusive dates of collection',
dateType: INSTANCE_DATE_TYPES.INCLUSIVE,
date1: '1925-',
},
{
title: 'C552488 Auto (first date only) Instance 06: Range of years of bulk of collection',
dateType: INSTANCE_DATE_TYPES.RANGE,
date1: '1926-',
},
{
title: 'C552488 Auto (first date only) Instance 07: Multiple dates',
dateType: INSTANCE_DATE_TYPES.MULTIPLE,
date1: '1927',
},
{
title: 'C552488 Auto (first date only) Instance 08: Dates unknown',
dateType: INSTANCE_DATE_TYPES.UNKNOWN,
date1: '1928',
},
{
title:
'C552488 Auto (first date only) Instance 09: Date of distribution/release/issue and production/recording session when different',
dateType: INSTANCE_DATE_TYPES.DISTRIBUTION,
date1: '1929',
},
{
title: 'C552488 Auto (first date only) Instance 10: Questionable date',
dateType: INSTANCE_DATE_TYPES.QUESTIONABLE,
date1: '1930',
},
{
title: 'C552488 Auto (first date only) Instance 11: Reprint/reissue date and original date',
dateType: INSTANCE_DATE_TYPES.REPRINT,
date1: '1931',
},
{
title: 'C552488 Auto (first date only) Instance 12: Single known date/probable date',
dateType: INSTANCE_DATE_TYPES.SINGLE,
date1: '1932',
},
{
title: 'C552488 Auto (first date only) Instance 13: Publication date and copyright date',
dateType: INSTANCE_DATE_TYPES.PUBLICATION,
date1: '1933',
},
{
title: 'C552488 Auto (first date only) Instance 14: Continuing resource status unknown',
dateType: INSTANCE_DATE_TYPES.CONTINUING_UNKNOWN,
date1: '1934-',
},
{
title: 'C552488 Auto (first date only) Instance 15: No attempt to code',
dateType: INSTANCE_DATE_TYPES.NO,
date1: '1935',
},
{
title: 'C552488 Auto (first date only) Instance 16: Not specified',
dateType: INSTANCE_DATE_TYPES.NO,
date1: '1936',
},
],
};

const marcFile = {
marc: 'marcBibFileC552488.mrc',
fileName: `testMarcFileC552488.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
propertyName: 'instance',
};

const createdInstanceIds = [];
let testUser;
let userForImport;

describe('Inventory', () => {
describe('Search in Inventory', () => {
before('Create test data', () => {
cy.getAdminToken();
InventoryInstances.getInstancesViaApi({
limit: 100,
query: `title="${testData.searchQuery}*"`,
}).then((instances) => {
if (instances) {
instances.forEach(({ id }) => {
InventoryInstance.deleteInstanceViaApi(id);
});
}
});

cy.createTempUser([
Permissions.moduleDataImportEnabled.gui,
Permissions.dataImportUploadAll.gui,
]).then((userProperties) => {
userForImport = userProperties;
cy.getToken(userForImport.username, userForImport.password, false);
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.fileName,
marcFile.jobProfileToRun,
).then((response) => {
response.forEach((record) => {
createdInstanceIds.push(record[marcFile.propertyName].id);
});
});
});
});

before('Create user, login', () => {
cy.createTempUser([Permissions.uiInventoryViewInstances.gui]).then((userProperties) => {
testUser = userProperties;
cy.login(userProperties.username, userProperties.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
});
});

after('Delete test data', () => {
cy.getAdminToken();
Users.deleteViaApi(testUser.userId);
Users.deleteViaApi(userForImport.userId);
createdInstanceIds.forEach((id) => {
InventoryInstance.deleteInstanceViaApi(id);
});
});

it(
'C552488 Check "Date" column in the result list, and instance detail view for each date type when only Date 1 is specified in MARC bib record (spitfire)',
{ tags: ['criticalPath', 'spitfire', 'C552488'] },
() => {
InventoryInstances.searchByTitle(testData.searchQuery);
testData.instances.forEach((instance) => {
InventoryInstances.verifyValueInColumnForTitle(
instance.title,
testData.dateColumnName,
instance.date1,
);
FilterItems.selectInstance(instance.title);
InventoryInstance.waitInventoryLoading();
InstanceRecordView.verifyDates(
instance.date1.replace('-', ''),
undefined,
instance.dateType,
);
InventorySearchAndFilter.closeInstanceDetailPane();
});
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileC552488.mrc

Large diffs are not rendered by default.

0 comments on commit 3fdd14e

Please sign in to comment.