Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAT-12697/C440118 #3536

Merged
merged 2 commits into from Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,87 @@
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 = {
searchOption: 'LCCN',
AUTHORIZED: 'Authorized',
searchQuery: '766384'
};

const searchResults = [
'C440118 Test LCCN subfield z record 1 (two leading spaces, one trailing space, two internal spaces)',
'C440118 Test LCCN subfield z record 2 (one space internal)',
'C440118 Test LCCN subfield z record 3 (two spaces internal)',
'C440118 Test LCCN subfield z record 4 (one space trailing)',
'C440118 Test LCCN subfield z record 5 (two spaces trailing)',
'C440118 Test LCCN subfield z record 6 (one space leading)',
'C440118 Test LCCN subfield z record 7 (two spaces leading)',
'C440118 Test LCCN subfield z record 8 (two spaces everywhere)',
'C440118 Test LCCN subfield z record 9 (no spaces)',
];

const marcFiles = [
{
marc: 'marcAuthFileForC440118.mrc',
fileName: `testMarcFile.${getRandomPostfix()}.mrc`,
jobProfileToRun: DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY,
propertyName: 'authority',
},
];

const createdAuthorityIDs = [];

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

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

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

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

it(
'C440118 Search for "MARC authority" by "LCCN" option using a query without prefix (numbers only) when "Canceled LCCN" (010 $z) has (leading, internal, trailing) spaces". (spitfire)',
{ tags: ['criticalPath', 'spitfire'] },
() => {
MarcAuthorities.searchByParameter(testData.searchOption, testData.searchQuery);
searchResults.forEach((result) => {
MarcAuthorities.checkAfterSearch(testData.AUTHORIZED, result);
});
},
);
});
});
1 change: 1 addition & 0 deletions cypress/fixtures/marcAuthFileForC440118.mrc
@@ -0,0 +1 @@
00520cz a2200181n 4500001000800000005001700008008004100025010003300066035002100099035001500120040001800135053001000153151010400163550002200267781001600289906001800305953001500323470925320120326095037.0860211|| anannbabn |a ana  an794563z sh 766384 zt001 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 1 (two leading spaces, one trailing space, two internal spaces) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400475cz a2200181n 4500001000800000005001700008008004100025010002900066035002100095035001500116040001800131053001000149151006300159550002200222781001600244906001800260953001500278470925320120326095037.0860211|| anannbabn |a ana  an794563zsh 766384zt002 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 2 (one space internal) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400477cz a2200181n 4500001000800000005001700008008004100025010003000066035002100096035001500117040001800132053001000150151006400160550002200224781001600246906001800262953001500280470925320120326095037.0860211|| anannbabn |a ana  an794563zsh 766384zt003 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 3 (two spaces internal) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400475cz a2200181n 4500001000800000005001700008008004100025010002900066035002100095035001500116040001800131053001000149151006300159550002200222781001600244906001800260953001500278470925320120326095037.0860211|| anannbabn |a ana  an794563zsh766384 zt004 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 4 (one space trailing) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400477cz a2200181n 4500001000800000005001700008008004100025010003000066035002100096035001500117040001800132053001000150151006400160550002200224781001600246906001800262953001500280470925320120326095037.0860211|| anannbabn |a ana  an794563zsh766384 zt005 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 5 (two spaces trailing) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400474cz a2200181n 4500001000800000005001700008008004100025010002900066035002100095035001500116040001800131053001000149151006200159550002200221781001600243906001800259953001500277470925320120326095037.0860211|| anannbabn |a ana  an794563z sh766384zt006 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 6 (one space leading) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400476cz a2200181n 4500001000800000005001700008008004100025010003000066035002100096035001500117040001800132053001000150151006300160550002200223781001600245906001800261953001500279470925320120326095037.0860211|| anannbabn |a ana  an794563z sh766384zt007 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 7 (two spaces leading) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400483cz a2200181n 4500001000800000005001700008008004100025010003400066035002100100035001500121040001800136053001000154151006600164550002200230781001600252906001800268953001500286470925320120326095037.0860211|| anannbabn |a ana  an794563z sh 766384 zt008 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 8 (two spaces everywhere) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd1400465cz a2200181n 4500001000800000005001700008008004100025010002800066035002100094035001500115040001800130053001000148151005400158550002200212781001600234906001800250953001500268470925320120326095037.0860211|| anannbabn |a ana  an794563zsh766384zt009 a(DLC)sh 85057894 a(DLC)55938 aDLCcDLCdDLC 0aGC296 aC440118 Test LCCN subfield z record 9 (no spaces) wgaOcean currents 0zGulf Stream t64--u----v0 axx00btd14