Skip to content

Commit

Permalink
C353607 The search result list is sorted by clicking on the titles of…
Browse files Browse the repository at this point in the history
… columns (TaaS) (spitfire) (#2506)
  • Loading branch information
elen2345 committed Dec 1, 2023
1 parent 21ca363 commit ba484e9
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import getRandomPostfix from '../../../support/utils/stringTools';
import Permissions from '../../../support/dictionary/permissions';
import TopMenu from '../../../support/fragments/topMenu';
import DataImport from '../../../support/fragments/data_import/dataImport';
import MarcAuthority from '../../../support/fragments/marcAuthority/marcAuthority';
import Users from '../../../support/fragments/users/users';
import JobProfiles from '../../../support/fragments/data_import/job_profiles/jobProfiles';
import Logs from '../../../support/fragments/data_import/logs/logs';
import MarcAuthorities from '../../../support/fragments/marcAuthority/marcAuthorities';

describe('MARC -> MARC Authority', () => {
const testData = {
authority: {
title: 'Type of heading test',
searchOption: 'Keyword',
all: '*',
},

columnHeaders: [
{ header: 'Authorized/Reference', index: 1 },
{ header: 'Heading/Reference', index: 2 },
{ header: 'Type of heading', index: 3 },
],
};
const marcFiles = [
{
marc: 'marcFileForC353607.mrc',
fileName: `testMarcFile.${getRandomPostfix()}.mrc`,
jobProfileToRun: 'Default - Create SRS MARC Authority',
numOfRecords: 19,
},
];

const createdAuthorityIDs = [];

before(() => {
cy.createTempUser([Permissions.uiMarcAuthoritiesAuthorityRecordView.gui]).then(
(createdUserProperties) => {
testData.userProperties = createdUserProperties;
},
);

marcFiles.forEach((marcFile) => {
cy.loginAsAdmin({ path: TopMenu.dataImportPath, waiter: DataImport.waitLoading }).then(() => {
DataImport.verifyUploadState();
DataImport.uploadFileAndRetry(marcFile.marc, marcFile.fileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.waitLoadingList();
JobProfiles.search(marcFile.jobProfileToRun);
JobProfiles.runImportFile();
JobProfiles.waitFileIsImported(marcFile.fileName);
Logs.checkStatusOfJobProfile('Completed');
Logs.openFileDetails(marcFile.fileName);
for (let i = 0; i < marcFile.numOfRecords; i++) {
Logs.getCreatedItemsID(i).then((link) => {
createdAuthorityIDs.push(link.split('/')[5]);
});
}

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

after(() => {
cy.getAdminToken();
createdAuthorityIDs.forEach((id) => {
MarcAuthority.deleteViaAPI(id);
});
Users.deleteViaApi(testData.userProperties.userId);
});

it(
'C353607 The search result list is sorted by clicking on the titles of columns (TaaS) (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
MarcAuthorities.checkSearchOptions();
MarcAuthorities.searchBy(testData.authority.searchOption, testData.authority.all);

MarcAuthorities.clickActionsButton();
MarcAuthorities.verifyActionsSortedBy('Relevance');
testData.columnHeaders.forEach(({ header, index }) => {
MarcAuthorities.clickOnColumnHeader(header);
// wait for result list to be sorted
cy.wait(2000);
MarcAuthorities.checkResultListSortedByColumn(index);
MarcAuthorities.clickOnColumnHeader(header);
// wait for result list to be sorted
cy.wait(2000);
MarcAuthorities.checkResultListSortedByColumn(index, false);
MarcAuthorities.verifyActionsSortedBy(header);
});
},
);
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcFileForC353607.mrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
00533nz a2200169n 4500001000800000005001700008008004100025010001700066035002100083040001300104110005900117410003200176410002900208670010300237953000900340985001400349321927819980528051132.6980415n| acannaab |a ana c anr 98013926  a(DLC)nr 98013926 aCStcCSt20aApple & Honey Productions (with "nr" in the 010 field)20aApple and Honey Productions20aApple & Honey Film Corp. aThe Quarrel, c1996:bcredits (Apple & Honey Productions) cassette label (Apple & Honey Film Corp.) axx00 cRLGeLSPC00445nz a2200145n 4500001000800000005001700008008004100025010001500066035002100081040001300102110005800115670010300173953000900276985001400285321927819980528051132.6980415n| acannaab |a ana c an 98013331 a(DLC)nr 98013926 aCStcCSt20aApple & Honey Productions (with "n" in the 010 field) aThe Quarrel, c1996:bcredits (Apple & Honey Productions) cassette label (Apple & Honey Film Corp.) axx00 cRLGeLSPC00446nz a2200145n 4500001000800000005001700008008004100025010001500066035002100081040001300102110005900115670010300174953000900277985001400286321927819980528051132.6980415n| acannaab |a ana c anb98013332 a(DLC)nr 98013926 aCStcCSt20aApple & Honey Productions (with "nb" in the 010 field) aThe Quarrel, c1996:bcredits (Apple & Honey Productions) cassette label (Apple & Honey Film Corp.) axx00 cRLGeLSPC00446nz a2200145n 4500001000800000005001700008008004100025010001500066035002100081040001300102110005900115670010300174953000900277985001400286321927819980528051132.6980415n| acannaab |a ana c ano98013333 a(DLC)nr 98013926 aCStcCSt20aApple & Honey Productions (with "no" in the 010 field) aThe Quarrel, c1996:bcredits (Apple & Honey Productions) cassette label (Apple & Honey Film Corp.) axx00 cRLGeLSPC00446nz a2200145n 4500001000800000005001700008008004100025010001500066035002100081040001300102110005900115670010300174953000900277985001400286321927819980528051132.6980415n| acannaab |a ana c ans98013334 a(DLC)nr 98013926 aCStcCSt20aApple & Honey Productions (with "ns" in the 010 field) aThe Quarrel, c1996:bcredits (Apple & Honey Productions) cassette label (Apple & Honey Film Corp.) axx00 cRLGeLSPC01767cz a2200397n 45000010008000000080041000080050017000490100017000660350021000830350017001040350021001210350016001420350017001580350016001750350017001910350016002080350017002240350016002410400028002571500010002853600303002954500014005984500023006124500020006354500025006554500018006804500018006984500022007164500038007386700151007766700106009276700203010336700100012369060018013369530015013544739049860211i| anannbabn |a ana 20220722202437.7 ash 85088762  a(DLC)sh 85088762 a(DLC)5528053 a(DLC)sp 85088762 a(DLC)277565 a(DLC)6087828 a(DLC)308126 a(DLC)6189148 a(DLC)313204 a(DLC)7204960 a(DLC)360090 aDLCcDLCdDLCdWaUdDLC aMusic isubdivisionaMusiciunder ethnic groups for music of the group; and subdivisionaSongs and musiciunder names of persons, corporate bodies, places, classes of persons, ethnic groups, wars, and topical headings for collections or single works of vocal or instrumental music about the topic or entity aArt music aArt music, Western aClassical music aMusical compositions aMusical works aSerious music aWestern art music aWestern music (Western countries) aSzabo, M. For the love of music, 2001:babstr. (Western art music) p. 5 ("Negative attitudes toward Western art music begin in elementary school") aNew Grove dictionary of music and musicians (Online), Dec. 4, 2001b(151 hits on "western art music") aAmer. Herit. dict. of the Engl. lang., via WWW, Dec. 4, 2001b(art music: Music composed in a classical tradition and intended as serious art, especially as distinguished from popular or folk music) aLC database, Dec. 4, 2001b(Western music; art music; art-music; genre hdg.: Western art music) t0726ute04v0 axx00bta2700507nz a2200193n 45000010009000000050017000090080041000260100017000670350021000840350015001050350022001200400023001420530015001651500035001805500020002155500016002356670038002516700024002891166473820210718060308.0860211 | anbnnbabn |b ana  asj2021053664 a(DLC)sh 85087063 a(DLC)84102 a(DLC)sj2021053664 aDLCbengcDLCdDLC 0aLB1029.M75 aMontessori method of education wgaKindergarten wgaTeaching aMachine-derived authority record. aTen red rods, 1980.01071nz a2200205n 4500001000800000005001700008008004100025010001700066035001700083040002900100155001200129455001500141455001400156555002900170670057500199985000800774985001800782910005300800906001200853978160320150214055930.0141210|| anznnbabn |a ana c agf2014026871 agf2014026871 aCaStSMFbengcDLCflcgft aHymnals aHymn books aHymnbooks wgaService books (Music) aGrove music online, viewed August 29, 2014:bunder Liturgy & liturgical books (The most familiar liturgical book in modern churches is undoubtedly the hymnal. Although Anglican service books have mostly remained separate from the hymnal, many denominations have adopted a combined 'hymnal and service book'. Contents and arrangement differ but, in addition to the main corpus of hymns, there will usually be found various items of service music, an abridged psalter, rites for morning and evening prayer, and the text of occasional services (baptism, a burial Office). ) aMvI eMusic project aProposal saved by tc03 on 02/11/2015 at 08:38:59 t1514v000212nz a2200097n 45000010011000000030004000110050017000150080041000320100017000731500024000902018001899DLC20180803133935.0180714|| anannbabn |n ana  adg2018001899 aChildren (for test)00211nz a2200097n 4500001001300000003000400013005001700017008004100034010001700075151002100092sh2018001934DLC20180803133936.9180718|| anannbabn |n ana  amp2018001934 aMusic (for test)00861cz a2200229n 4500001001200000003000600012005001700018008004100035016002300076024004400099040002800143053001700171150002300188450002200211550003700233688003500270688003600305750004200341750011200383750007300495750006300568fst00853501OCoLC20220207165103.0041024nn anznnbabn || ana d7 afst008535012OCoLC7 ahttp://id.worldcat.org/fast/8535012uri aOCoLCbengcOCoLCffast 0aQD241bQD441 aChemistry, Organic aOrganic chemistry wgaChemistry0(OCoLC)fst00853344 aLC (2022) Subject Usage: 1,516 aWC (2022) Subject Usage: 49,383 0aChemistry, Organic0(DLC)sh 85023022  4aOrganic chemistry4RM0http://en.wikipedia.org/wiki/Organic_chemistry0https://www.wikidata.org/wiki/Q11351 7aChimie organique2ram4EQ0http://data.bnf.fr/ark:/12148/cb11936102w 7aOrganische Chemie2gnd4RM0http://d-nb.info/gnd/4043793-000649cz a2200169n 4500001000800000003000500008005001700013008004100030010001200071040001500083072001300098155002200111455003000133667018900163680011800352688000900470D003160DNLM20180904000000.0990101 n ancnnbabn || ana  aD003160 aDNLMcDNLM aV3.x250 aComparative Study wnnnaaComparative Studies athis heading is used as a Publication Type; do not use for comparison of subject & normal controls; differentiate from the specialties ANATOMY, COMPARATIVE; HISTOLOGY, COMPARATIVE; etc iComparison of outcomes, results, responses, etc for different techniques, therapeutic approaches or other inputs. a196600702nz a2200217n 4500001001100000003000400011008004100015005001700056010004000073040002200113155003400135455001800169455001500187555001400202555003100216555002100247555001500268555001400283667003700297680015000334tgm008103gTGM101108 n anznnbabn a ana d20220727142330.4 atgm008103zgmgpc000822zlctgm008081 aDLCcDLCdUtOrBLW aPostcards (with "tgm" in 010) aMailing cards aPost cards 5wgaCards 5whaPhotographic postcards 5whaPostal cards aStationery aViewbooks aFormerly TGMI term & TGMII term. aCards on which a message may be written or printed for mailing without an envelope; often include a pictorial, comic, or other scene on one side.00283nz a2200109n 4500001001100000003000400011008004100015005001700056010004200073040002200115155003600137tgm008103gTGM101108 n anznnbabn a ana d20220727142330.4 alcgtm008103zgmgpc000822zlctgm008081 aDLCcDLCdUtOrBLW aPostcards (with "lcgtm" in 010)00219nz a2200097n 4500001001300000003000400013005001700017008004100034010002100075151002500096sh2018001934DLC20180803133936.9180718|| anannbabn |n ana  arbmscv2018001934 aRare book (for test)00225nz a2200097n 4500001001300000003000400013005001700017008004100034010001900075151003300094sh2018001934DLC20180803133936.9180718|| anannbabn |n ana  aaatg2018001934 aArt (for test "aatg" in 010)00222nz a2200097n 4500001001300000003000400013005001700017008004100034010001700075151003200092sh2018001934DLC20180803133936.9180718|| anannbabn |n ana  aaat201803333 aArt (for test "aat" in 010)00220nz a2200097n 4500001001300000003000400013005001700017008004100034010002000075151002700095sh2018001934DLC20180803133936.9180718|| anannbabn |n ana  agsafd2018001934 aGSAFD Genre (for test)00463cz a2200157n 450000100090000000300040000900800410001300500170005401000140007103500230008504000230010804600130013110000480014467000580019267000550025079061096DLC790730n| acannaabn |n aaa 20220830055439.8 a79061096  a(OCoLC)oca00294116 aDLCbengcDLCdIEN f191602261 aStone, Robert B (not from pre-defined list) aPaul, S. The complete book of home modernizing, 1953. aInfo. converted from 678, 2012-10-27b(b. 2/26/16)
16 changes: 14 additions & 2 deletions cypress/support/fragments/marcAuthority/marcAuthorities.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ export default {
cy.wait(1000);
},

verifyActionsSortedBy(value) {
cy.expect(Select({ dataTestID: 'sort-by-selection', checkedOptionText: value }).exists());
},

actionsSelectCheckbox(value) {
cy.do(Checkbox(value).click());
},
Expand Down Expand Up @@ -453,6 +457,10 @@ export default {
cy.expect(ColumnHeader(content).exists());
},

clickOnColumnHeader(content) {
cy.do(authoritiesList.clickHeader(content));
},

chooseTypeOfHeadingAndCheck(headingType, headingTypeA, headingTypeB) {
cy.do([
headingTypeAccordion.clickHeader(),
Expand Down Expand Up @@ -865,9 +873,13 @@ export default {
.then(() => cells);
},

checkResultListSortedByColumn(columnIndex) {
checkResultListSortedByColumn(columnIndex, isAscending = true) {
this.getResultsListByColumn(columnIndex).then((cells) => {
cy.expect(cells).to.deep.equal(cells.sort());
if (isAscending) {
cy.expect(cells).to.deep.equal(cells.sort((a, b) => a - b));
} else {
cy.expect(cells).to.deep.equal(cells.sort((a, b) => b - a));
}
});
},

Expand Down

0 comments on commit ba484e9

Please sign in to comment.