Skip to content

Commit

Permalink
C404421: Apply "Shared" facet to the search result list in "Member" t…
Browse files Browse the repository at this point in the history
…enant when search was executed (consortia) (#3154)

* Add a test case

* Refactor the test case

* Replace method
  • Loading branch information
sviatlana-stsiapanava committed Feb 5, 2024
1 parent 862635f commit 04b121e
Show file tree
Hide file tree
Showing 6 changed files with 309 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
import Permissions from '../../../../../support/dictionary/permissions';
import Affiliations, { tenantNames } from '../../../../../support/dictionary/affiliations';
import Users from '../../../../../support/fragments/users/users';
import TopMenu from '../../../../../support/fragments/topMenu';
import ConsortiumManager from '../../../../../support/fragments/settings/consortium-manager/consortium-manager';
import { JOB_STATUS_NAMES, MARC_AUTHORITY_SEARCH_OPTIONS } from '../../../../../support/constants';
import getRandomPostfix from '../../../../../support/utils/stringTools';
import DataImport from '../../../../../support/fragments/data_import/dataImport';
import JobProfiles from '../../../../../support/fragments/data_import/job_profiles/jobProfiles';
import Logs from '../../../../../support/fragments/data_import/logs/logs';
import MarcAuthority from '../../../../../support/fragments/marcAuthority/marcAuthority';
import MarcAuthorities from '../../../../../support/fragments/marcAuthority/marcAuthorities';
import MarcAuthoritiesSearch from '../../../../../support/fragments/marcAuthority/marcAuthoritiesSearch';

describe('MARC', () => {
describe('MARC Authority', () => {
describe('Search', () => {
const marcFiles = [
{
marc: 'marcAuthFileForC404421Central.mrc',
fileName: `C404421 Central testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
tenant: tenantNames.central,
affiliation: Affiliations.Consortia,
},
{
marc: 'marcAuthFileForC404421LocalMember1.mrc',
fileName: `C404421 Local testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
tenant: tenantNames.college,
affiliation: Affiliations.College,
},
{
marc: 'marcAuthFileForC404421LocalMember2.mrc',
fileName: `C404421 Local testMarcFile${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
tenant: tenantNames.university,
affiliation: Affiliations.University,
},
];
const sharedAuthorityFromCentralTenant = {
authRefType: 'Authorized',
heading: 'C404421 MARC authority 1st record from Central tenant',
typeOfHeading: 'Genre',
};
const localAuthorityFromMember1Tenant = {
authRefType: 'Authorized',
heading: 'C404421 MARC authority 2nd record from Member 1 tenant title',
typeOfHeading: 'Personal Name',
};
const searchValue = 'C404421 MARC authority';
const Dropdowns = {
SHARED: 'Shared',
YES: 'Yes',
NO: 'No',
};
const users = {};

function verifySharedAndLocalRecordsFoundCheckBoxesUnchecked() {
MarcAuthorities.verifyResultsRowContent(
localAuthorityFromMember1Tenant.heading,
localAuthorityFromMember1Tenant.authRefType,
localAuthorityFromMember1Tenant.typeOfHeading,
);
MarcAuthorities.verifyResultsRowContent(
sharedAuthorityFromCentralTenant.heading,
sharedAuthorityFromCentralTenant.authRefType,
sharedAuthorityFromCentralTenant.typeOfHeading,
);
MarcAuthorities.checkRowsCount(2);
MarcAuthorities.verifyResultRowContentSharedIcon(
localAuthorityFromMember1Tenant.heading,
false,
);
MarcAuthorities.verifyResultRowContentSharedIcon(
sharedAuthorityFromCentralTenant.heading,
true,
);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.YES, false);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, false);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.YES, 1);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.NO, 1);
}

before('Create users, data', () => {
cy.getAdminToken();
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui])
.then((userProperties) => {
users.userProperties = userProperties;

cy.assignAffiliationToUser(Affiliations.University, users.userProperties.userId);
cy.assignAffiliationToUser(Affiliations.College, users.userProperties.userId);
cy.setTenant(Affiliations.University);
cy.assignPermissionsToExistingUser(users.userProperties.userId, [
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
]);
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(users.userProperties.userId, [
Permissions.uiMarcAuthoritiesAuthorityRecordView.gui,
]);
})
.then(() => {
cy.loginAsAdmin({
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
})
.then(() => {
marcFiles.forEach((marcFile, index) => {
if (marcFile.tenant !== tenantNames.central) {
ConsortiumManager.switchActiveAffiliation(
marcFiles[index - 1].tenant,
marcFile.tenant,
);
DataImport.waitLoading();
ConsortiumManager.checkCurrentTenantInTopMenu(marcFile.tenant);
}

DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileName);
JobProfiles.waitLoadingList();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
JobProfiles.waitFileIsImported(marcFile.fileName);
Logs.checkJobStatus(marcFile.fileName, JOB_STATUS_NAMES.COMPLETED);
Logs.openFileDetails(marcFile.fileName);
Logs.getCreatedItemsID().then((link) => {
marcFile.createdAuthorityID = link.split('/')[5];
});
});
})
.then(() => {
cy.resetTenant();
cy.login(users.userProperties.username, users.userProperties.password, {
path: TopMenu.marcAuthorities,
waiter: MarcAuthorities.waitLoading,
}).then(() => {
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);
});
});
});

after('Delete users, data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(users.userProperties.userId);
marcFiles.forEach((marcFile) => {
cy.setTenant(marcFile.affiliation);
MarcAuthority.deleteViaAPI(marcFile.createdAuthorityID);
});
});

it(
'C404421 Apply "Shared" facet to the search result list in "Member" tenant when search was executed (consortia) (spitfire)',
{ tags: ['criticalPathECS', 'spitfire'] },
() => {
MarcAuthorities.verifyExistanceOfSharedAccordion();
MarcAuthorities.verifySharedAccordionOpen(false);

MarcAuthorities.clickAccordionByName(Dropdowns.SHARED);
MarcAuthorities.verifySharedAccordionOpen(true);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.YES, false);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, false);

MarcAuthorities.searchBy('Keyword', searchValue);
verifySharedAndLocalRecordsFoundCheckBoxesUnchecked();

MarcAuthoritiesSearch.selectAuthorityByIndex(1);
MarcAuthority.verifySharedAuthorityDetailsHeading(
sharedAuthorityFromCentralTenant.heading,
);

MarcAuthorities.actionsSelectCheckbox(Dropdowns.NO);
MarcAuthorities.verifyResultsRowContent(
localAuthorityFromMember1Tenant.heading,
localAuthorityFromMember1Tenant.authRefType,
localAuthorityFromMember1Tenant.typeOfHeading,
);
MarcAuthorities.checkRowsCount(1);

MarcAuthorities.verifyResultRowContentSharedIcon(
localAuthorityFromMember1Tenant.heading,
false,
);
MarcAuthority.verifyLocalAuthorityDetailsHeading(localAuthorityFromMember1Tenant.heading);
MarcAuthorities.verifySharedAccordionOpen(true);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.YES, false);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, true);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.YES, 1);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.NO, 1);

MarcAuthorities.actionsSelectCheckbox(Dropdowns.NO);
verifySharedAndLocalRecordsFoundCheckBoxesUnchecked();

MarcAuthorities.actionsSelectCheckbox(Dropdowns.YES);
MarcAuthorities.verifyResultsRowContent(
sharedAuthorityFromCentralTenant.heading,
sharedAuthorityFromCentralTenant.authRefType,
sharedAuthorityFromCentralTenant.typeOfHeading,
);
MarcAuthorities.checkRowsCount(1);

MarcAuthorities.verifyResultRowContentSharedIcon(
sharedAuthorityFromCentralTenant.heading,
true,
);
MarcAuthority.verifySharedAuthorityDetailsHeading(
sharedAuthorityFromCentralTenant.heading,
);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.YES, 1);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.NO, 1);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.YES, true);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, false);

MarcAuthorities.actionsSelectCheckbox(Dropdowns.YES);
verifySharedAndLocalRecordsFoundCheckBoxesUnchecked();

MarcAuthorities.actionsSelectCheckbox(Dropdowns.YES);
MarcAuthorities.actionsSelectCheckbox(Dropdowns.NO);
MarcAuthorities.verifyResultsRowContent(
localAuthorityFromMember1Tenant.heading,
localAuthorityFromMember1Tenant.authRefType,
localAuthorityFromMember1Tenant.typeOfHeading,
);
MarcAuthorities.verifyResultsRowContent(
sharedAuthorityFromCentralTenant.heading,
sharedAuthorityFromCentralTenant.authRefType,
sharedAuthorityFromCentralTenant.typeOfHeading,
);
MarcAuthorities.checkRowsCount(2);
MarcAuthorities.verifyResultRowContentSharedIcon(
sharedAuthorityFromCentralTenant.heading,
true,
);
MarcAuthorities.verifyResultRowContentSharedIcon(
localAuthorityFromMember1Tenant.heading,
false,
);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.YES, true);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, true);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.YES, 1);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.NO, 1);

MarcAuthorities.selectSearchOptionInDropdown(MARC_AUTHORITY_SEARCH_OPTIONS.NAME_TITLE);
MarcAuthorities.checkSelectOptionFieldContent(MARC_AUTHORITY_SEARCH_OPTIONS.NAME_TITLE);

MarcAuthoritiesSearch.clickSearchButton();
MarcAuthorities.verifyResultsRowContent(
localAuthorityFromMember1Tenant.heading,
localAuthorityFromMember1Tenant.authRefType,
localAuthorityFromMember1Tenant.typeOfHeading,
);
MarcAuthorities.checkRowsCount(1);
MarcAuthorities.verifyResultRowContentSharedIcon(
localAuthorityFromMember1Tenant.heading,
false,
);
MarcAuthorities.verifyCheckboxInAccordion(Dropdowns.SHARED, Dropdowns.NO, true);
MarcAuthorities.verifyFilterOptionCount(Dropdowns.SHARED, Dropdowns.NO, 1);
},
);
});
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC404421Central.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03020cz a2200301n 4500001001300000003000400013008004100017005001700058010003100075040003500106155005800141455002000199455002000219455002800239455004500267455004100312455004500353455004500398555002300443670021200466670041900678670009601097670101901193670013002212670009702342670019902439680008002638gf2011026439DLC110507|| anznnbabn |a ana 20220830075325.6 agf2011026439zsh2007025255 aDLCbengcDLCflcgftdDLCdWaU aC404421 MARC authority 1st record from Central tenant aGladiator films aMuscleman films aPepla (Motion pictures) aSandal-and-spear epics (Motion pictures) aSex-and-sand epics (Motion pictures) aSpear-and-sandal epics (Motion pictures) aSword-and-sandal epics (Motion pictures) wgaMotion pictures aWork cat.: Gladiator (Motion picture : 2000). Gladiator, 2003b(summary: When a Roman general is betrayed and his family murdered by an emperor's corrupt son, he comes to Rome as a gladiator to seek revenge) aLópez, D. Films by genre, ©1993b(Peplum (Sex-and-Sand Epic, S & S Movie); Peplums are minor epics featuring mythological, biblical, and Italian-created strongmen elevated to the category of popular heroes: Hercules, Maciste, Ursus, Samson, Goliath, Taur; has also been referred to as sword-and-sandal epic, sandal-and-spear/s epic, spear-and-sandal epic, cloak-and sandal, gladiator, and muscle/muscleman epic) aMoving image genre-form guide via WWW, July 19, 2007:b(peplum: see Ancient world; Fantasy) aThe Mondo-Esoterica guide to the peplum, via WWW, May 2, 2018b(term Peplum most commonly applied to the mass of muscle-man movies that sprung up in the 1960s after the success of Hercules (1958). However, like most euro-cult expressions it has become confused and re-used heavily down the years, most often interchangably with the generic term "Sword and Sandal" leading to many American made films being rather incorrectly classified as Pepla; incorporating the traditional muscleman films as well as historical epics and adventure pictures with a classical/ancient setting (from Ancient Egypt through to around 700 AD) but not including more modern-set historical epics and muscleman films or the Biblical epics of which the Italians shot many during the 1960s; The Peplum should also not be confused with the later "Sword and Scorcery" genre that arose from the success of Conan the Barbarian (1982) and although there is a lot of overlap, the latter distinctly employed more high fantasy and magical elements) aOf muscles and men : essays on the sword and sandal film, ©2011:bp. 5 (the peplum; pepla; peplum or sword and sandal films) aGünsberg, M. Italian cinema : gender and genre, 2005:bp. 17 (peplum films) p. 103 (pepla) aGoogle, July 14, 2018:b(peplum films: 18,100 hits; cloak-and-sandal films: 2 hits; muscleman films: 419 hits; pepla: 28,500 hits; sex-and-sand epics: 213 hits; Spear-and-sandal epics: 197 hits) iFilms that feature mythological, biblical, or invented strongmen as heroes.
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC404421LocalMember1.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
03735cz a2200493n 450000100070000000500170000700800410002401000310006502400620009602400630015802400560022102400440027702401170032102400550043803500230049304000430051604600150055910000660057437001100064038000690075038000730081938000950089238000840098738000790107138000680115038000770121838600820129538600760137740000840145340000570153740000470159440000780164150001650171950001570188453001880204153001870222966700970241667001340251367000790264767000420272667003980276867000600316695300150322650080420200229074540.0791115n| azannaabn |a aaa  an 79132705 zn 79125030 7 aQ2154102wikidata1http://www.wikidata.org/entity/Q2154108 1http://dbpedia.org/resource/Adventures_of_Huckleberry_Finn7 a1788061362viaf1http://www.viaf.org/viaf/1788061368 1http://worldcat.org/entity/work/id/61327 acdd30e78-a598-45b0-b2ec-6f72c5b41a3c2musicb1http://musicbrainz.org/work/cdd30e78-a598-45b0-b2ec-6f72c5b41a3c#_7 a13561102fast0http://id.worldcat.org/fast/1356110 a(OCoLC)oca00364098 aDLCbengerdacDLCdDLCdOrUdDLCdWaU k18842edtf1 aC404421 MARC authority 2nd record from Member 1 tenantttitle gUnited States2naf0http://id.loc.gov/authorities/names/n780953301http://id.loc.gov/rwo/agents/n78095330 aFiction2lcsh0http://id.loc.gov/authorities/subjects/sh85048050 aNovels2lcgft0http://id.loc.gov/authorities/genreForms/gf2015026020 aAction and adventure fiction2lcgft0http://id.loc.gov/authorities/genreForms/gf2014026217 aSatirical fiction2lcgft0http://id.loc.gov/authorities/genreForms/gf2018026115 aAdventure stories2lcsh0http://id.loc.gov/authorities/subjects/sh85001072 aSatire2lcsh0http://id.loc.gov/authorities/subjects/sh85117645 aSocial satire2lcsh0http://id.loc.gov/authorities/subjects/sh2008009879 aAmericans2lcdgt0http://id.loc.gov/authorities/demographicTerms/dg2015060001 aMen2lcdgt0http://id.loc.gov/authorities/demographicTerms/dg20150603591 aTwain, Mark,d1835-1910.tAdventures of Huckleberry Finn (Tom Sawyer's comrade)1 aTwain, Mark,d1835-1910.tAnnotated Huckleberry Finn1 aTwain, Mark,d1835-1910.tHuckleberry Finn1 aTwain, Mark,d1835-1910.tMark Twain's The adventures of Huckleberry Finn1 wriAuthor:aTwain, Mark,d1835-19100http://id.loc.gov/authorities/names/n790211641http://id.loc.gov/rwo/agents/n790211641http://www.wikidata.org/entity/Q72451 wriSequel to:aTwain, Mark,d1835-1910.tAdventures of Tom Sawyer0http://id.loc.gov/authorities/names/n791327041http://www.wikidata.org/entity/Q326914 0wriAdapted as motion picture (work):aAdventures of Huckleberry Finn (Motion picture : 1939)0http://id.loc.gov/authorities/names/no20141119841http://www.wikidata.org/entity/Q2472318 0wriAdapted as motion picture (work):aAdventures of Huckleberry Finn (Motion picture : 1960)0http://id.loc.gov/authorities/names/no20141115351http://www.wikidata.org/entity/Q319115 aURIs added to this record for the PCC URI MARC Pilot. Please do not remove or edit the URIs. aHis Tom Sawyer and Huckleberry Finn, 1979, c1980:bt.p. (containing the complete texts of ... The adventures of Huckleberry Finn) aTwain, M. The adventures of Huckleberry Finn (Tom Sawyer's comrade), 1884. aThe annotated Huckleberry Finn, 1981. aWikipedia, August 22, 2014b(Adventures of Huckleberry Finn (or, in more recent editions, The Adventures of Huckleberry Finn) is a novel by Mark Twain, first published in the United Kingdom in December 1884 and in the United States in February 1885; a direct sequel to The Adventures of Tom Sawyer; genre: Satirical novel; an often scathing satire on entrenched attitudes, particularly racism) aMark Twain's The adventures of Huckleberry Finn, c1975. abe20blk19
Loading

0 comments on commit 04b121e

Please sign in to comment.