Skip to content

Commit

Permalink
implemented test C468256 (#4239)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sherzod-Kenjaev authored Sep 25, 2024
1 parent a347347 commit d041e14
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { DEFAULT_JOB_PROFILE_NAMES } from '../../../support/constants';
import Permissions from '../../../support/dictionary/permissions';
import DataImport from '../../../support/fragments/data_import/dataImport';
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';

describe('Inventory', () => {
describe('Instance classification browse', () => {
const testData = {
classificationOption: 'Library of Congress classification',
searchQueries: ['HD1691 .I5 1967', 'hd1691 .i5 1967'],
searchResults: ['hd1691 .i5 1967', 'HD1691 .I5 1967'],
instanceTitles: [
'C468256 Search by Classification (case insensitive check) Instance 3 - LC UPPER case',
'C468256 Search by Classification (case insensitive check) Instance 4 - LC lower case',
],
};

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

const createdRecordIDs = [];

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

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

cy.createTempUser([Permissions.inventoryAll.gui]).then((userProperties) => {
testData.user = userProperties;

cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
InventorySearchAndFilter.switchToBrowseTab();
InventorySearchAndFilter.checkBrowseOptionDropdownInFocus();
InventorySearchAndFilter.verifyCallNumberBrowsePane();
});
});

after(() => {
cy.getAdminToken();
createdRecordIDs.forEach((id) => {
InventoryInstance.deleteInstanceViaApi(id);
});
Users.deleteViaApi(testData.preconditionUserId);
Users.deleteViaApi(testData.user.userId);
});

it(
'C468256 Browse for classification using "Library of Congress classification" option is case-insensitive (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
testData.searchQueries.forEach((query) => {
InventorySearchAndFilter.selectBrowseOptionFromClassificationGroup(
testData.classificationOption,
);
InventorySearchAndFilter.browseSearch(query);
testData.searchResults.forEach((expectedResult) => {
InventorySearchAndFilter.verifySearchResultIncludingValue(expectedResult);
});
});
InventorySearchAndFilter.selectFoundItemFromBrowse(testData.searchResults[0]);
InventorySearchAndFilter.verifySearchOptionAndQuery(
'Query search',
'classifications.classificationNumber=="hd1691 .i5 1967"',
);
testData.instanceTitles.forEach((title) => {
InventorySearchAndFilter.verifyInstanceDisplayed(title);
});
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcBibFileForC468256.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
01235cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021808200110023324500920024426000470033626500380038330000150042131000220043632100250045836200230048357000290050665000330053565000450056865500420061370000450065585300180070086300230071890200160074190500210075794800370077895000340081536683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 aM1 33A0 aC468256 Search by Classification (case insensitive check) Instance 1 - Dewey UPPER case aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N01235cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021808200110023324500920024426000470033626500380038330000150042131000220043632100250045836200230048357000290050665000330053565000450056865500420061370000450065585300180070086300230071890200160074190500210075794800370077895000340081536683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 am1 33a0 aC468256 Search by Classification (case insensitive check) Instance 2 - Dewey lower case aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N01241cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021809000200023324500890025326000470034226500380038930000150042731000220044232100250046436200230048957000290051265000330054165000450057465500420061970000450066185300180070686300230072490200160074790500210076394800370078495000340082136683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 aHD1691 .I5 19670 aC468256 Search by Classification (case insensitive check) Instance 3 - LC UPPER case aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N01241cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021809000200023324500890025326000470034226500380038930000150042731000220044232100250046436200230048957000290051265000330054165000450057465500420061970000450066185300180070686300230072490200160074790500210076394800370078495000340082136683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 ahd1691 .i5 19670 aC468256 Search by Classification (case insensitive check) Instance 4 - LC lower case aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N01247cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021806000240023324500910025726000470034826500380039530000150043331000220044832100250047036200230049557000290051865000330054765000450058065500420062570000450066785300180071286300230073090200160075390500210076994800370079095000340082736683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 aQS 11 .GA1 E53 20060 aC468256 Search by Classification (case insensitive check) Instance 5 - NLM UPPER case  aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N01247cas a2200385 450000100070000000500170000700800410002401000170006502200140008203500260009603500220012203500110014403500190015504000440017405000150021806000240023324500910025726000470034826500380039530000150043331000220044832100250047036200230049557000290051865000330054765000450058065500420062570000450066785300180071286300230073090200160075390500210076994800370079095000340082736683220141106221425.0750907c19509999enkqr p 0 a0eng d a 58020553  a0022-0469 a(CStRLIN)NYCX1604275S a(NIC)notisABP6388 a366832 a(OCoLC)1604275 dCtYdMBTIdCtYdMBTIdNICdCStRLINdNIC0 aBR140b.J6 aqs 11 .ga1 e53 20060 aC468256 Search by Classification (case insensitive check) Instance 6 - NLM lower case  aLondon,bCambridge University Press [etc.] a32 East 57th St., New York, 10022 av.b25 cm. aQuarterly,b1970- aSemiannual,b1950-690 av. 1- Apr. 1950- aEditor: C. W. Dugmore. 0aChurch historyxPeriodicals. 7aChurch history2fast0(OCoLC)fst00860740 7aPeriodicals2fast0(OCoLC)fst014116411 aDugmore, C. W.q(Clifford William),eed.0381av.i(year)4081a1-49i1950-1998 apfndbLintz a19890510120000.02 a20141106bmdbatcheltsxaddfast lOLINaBR140b.J86h01/01/01 N
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,14 @@ export default {
});
},

selectBrowseOptionFromClassificationGroup(option) {
cy.get('optgroup[label="Classification (instance)"]')
.contains('option', option)
.then((optionToSelect) => {
cy.get('select').select(optionToSelect.val());
});
},

checkSearchQueryText(text) {
cy.expect(keywordInput.has({ value: text }));
},
Expand Down

0 comments on commit d041e14

Please sign in to comment.