Skip to content

Commit

Permalink
implemented test C584445 (#4422)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev authored Nov 1, 2024
1 parent b9d8110 commit d20cfd4
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { DEFAULT_JOB_PROFILE_NAMES } from '../../../support/constants';
import Permissions from '../../../support/dictionary/permissions';
import DataImport from '../../../support/fragments/data_import/dataImport';
import MarcAuthorities from '../../../support/fragments/marcAuthority/marcAuthorities';
import MarcAuthority from '../../../support/fragments/marcAuthority/marcAuthority';
import TopMenu from '../../../support/fragments/topMenu';
import Users from '../../../support/fragments/users/users';
import getRandomPostfix from '../../../support/utils/stringTools';

describe('MARC', () => {
describe('MARC Authority', () => {
const testData = {
searchOptions: ['Keyword', 'Geographic name'],
recordType: 'Authorized',
marcValue: 'C584445 Greenwich Village (New York, N.Y.) Maps',
searchQueries: [
'Greenwich Village (New York, N.Y.) Maps',
'Maps Greenwich New York Village (N.Y.)',
'Maps New York Village (N.Y.)',
'Maps New York Brooklyn Village (N.Y.)',
],
invalidQuery: 'Maps New York Brooklyn Village (N.Y.)',
};
const marcFiles = [
{
marc: 'marcAuthFileForC584445.mrc',
fileName: `testMarcFileC584445.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY,
propertyName: 'authority',
},
];
const createdAuthorityIDs = [];
let user;

before('Create user, test data', () => {
cy.getAdminToken();
// make sure there are no duplicate authority records in the system
MarcAuthorities.deleteMarcAuthorityByTitleViaAPI('C584445*');

cy.createTempUser([Permissions.moduleDataImportEnabled.gui]).then((userProperties) => {
testData.preconditionUserId = userProperties.userId;

cy.getUserToken(userProperties.username, userProperties.password);
marcFiles.forEach((marcFile) => {
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.fileName,
marcFile.jobProfileToRun,
).then((response) => {
response.forEach((record) => {
createdAuthorityIDs.push(record[marcFile.propertyName].id);
});
});
});
});

cy.getAdminToken();
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui]).then(
(createdUserProperties) => {
user = createdUserProperties;

cy.login(user.username, user.password, {
path: TopMenu.marcAuthorities,
waiter: MarcAuthorities.waitLoading,
});
MarcAuthorities.switchToSearch();
},
);
});

after('Delete user, test data', () => {
cy.getAdminToken();
Users.deleteViaApi(testData.preconditionUserId);
Users.deleteViaApi(user.userId);
createdAuthorityIDs.forEach((id) => {
MarcAuthority.deleteViaAPI(id);
});
});

it(
'C584445 Verify that "Geographic name" search option uses "all" search operator ("Greenwich Village (New York, N.Y.) Maps" case) (spitfire)',
{ tags: ['criticalPath', 'spitfire', 'C584445'] },
() => {
// execute search by "Keyword" option
testData.searchOptions.forEach((option) => {
testData.searchQueries.forEach((query) => {
MarcAuthorities.searchByParameter(option, query);
cy.wait(1000);
if (query === testData.invalidQuery) {
MarcAuthorities.verifyEmptySearchResults(query);
} else {
MarcAuthorities.checkAfterSearch(testData.recordType, testData.marcValue);
}
MarcAuthorities.clickResetAndCheck(query);
cy.wait(500);
});
});
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC584445.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00511cz a2200169n 4500001000800000005001700008008004100025010001700066035001600083035002200099040002300121151005300144667005400197670006300251906001800314953000900332806019620110729162706.0091020|| anannbabn |n ana  ash2009125702 a(DLC)442070 a(DLC)sh2009125702 aDLCbengcDLCdDLC aC584445 Greenwich Village (New York, N.Y.)vMaps aC584445 Record generated for validation purposes. aC584445 Work cat.: Gay & lesbian "FunMap" Manhattan, c1990 t8888utc00v0 atc00

0 comments on commit d20cfd4

Please sign in to comment.