Skip to content

Commit

Permalink
test updates for eureka rbugfest (#4667)
Browse files Browse the repository at this point in the history
  • Loading branch information
eremv authored Jan 24, 2025
1 parent 598f4d1 commit 0ce3df7
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ describe('Data Import', () => {
const linkingTagAndValues = [
{
rowIndex: 16,
value: 'C380511 Ludwig one, Beethoven, 1770-1827.',
value: 'C380511 Ludwig v., Beethoven, 1770-1827',
tag: '100',
},
{
rowIndex: 18,
rowIndex: 17,
value:
'C380511 Beethoven, Ludwig van, 1770-1827 Variations, piano, violin, cello, op. 44, E♭ major',
tag: '240',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ describe('Inventory', () => {

before('Creating user and instance with item with call number', () => {
cy.getAdminToken().then(() => {
InventoryInstances.getInstancesViaApi({ query: 'title="instanceForRecord_"' }).then(
(inst) => {
inst.forEach((instance) => InventoryInstances.deleteInstanceAndItsHoldingsAndItemsViaApi(instance.id));
},
);
cy.createTempUser([permissions.inventoryAll.gui, permissions.uiCallNumberBrowse.gui]).then(
(userProperties) => {
testData.user = userProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ describe('Inventory', () => {
testData.contributor.types.actor,
);
InstanceRecordEdit.saveAndClose();
BrowseContributors.waitForContributorToAppear(testData.contributor.name);
cy.wait(3000);
cy.login(testData.userProperties.username, testData.userProperties.password, {
path: TopMenu.inventoryPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ describe('Inventory', () => {
);
InstanceRecordEdit.saveAndClose();

BrowseContributors.waitForContributorToAppear(testData.contributor.name);

InventorySearchAndFilter.switchToBrowseTab();

BrowseContributors.select();
Expand Down Expand Up @@ -158,6 +160,8 @@ describe('Inventory', () => {
);
InstanceRecordEdit.saveAndClose();

BrowseContributors.waitForContributorToAppear(testData.contributor.name);

InventorySearchAndFilter.switchToBrowseTab();

BrowseContributors.select();
Expand Down Expand Up @@ -189,6 +193,8 @@ describe('Inventory', () => {
);
InstanceRecordEdit.saveAndClose();

BrowseContributors.waitForContributorToAppear(testData.contributor.name);

InventorySearchAndFilter.switchToBrowseTab();
BrowseContributors.select();
BrowseContributors.browse(testData.contributor.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('Inventory', () => {
cy.wait(1500);
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.checkAfterSaveAndClose();

BrowseContributors.waitForContributorToAppear(testData.contributorName);
InventorySearchAndFilter.switchToBrowseTab();
BrowseContributors.select();
BrowseContributors.searchRecordByName(testData.contributorName);
Expand All @@ -109,6 +109,8 @@ describe('Inventory', () => {
QuickMarcEditor.pressSaveAndClose();
QuickMarcEditor.constinueWithSaveAndCheckInstanceRecord();

BrowseContributors.waitForContributorToAppear(testData.contributorName, false);

InventorySearchAndFilter.switchToBrowseTab();
BrowseContributors.select();
BrowseContributors.browse(testData.contributorName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,27 +170,7 @@ describe('MARC', () => {
before('Creating user and data', () => {
// make sure there are no duplicate authority records in the system before auto-linking
cy.getAdminToken().then(() => {
MarcAuthorities.getMarcAuthoritiesViaApi({
limit: 200,
query: 'naturalId="*C388641"',
}).then((records) => {
records.forEach((record) => {
if (record.authRefType === 'Authorized') {
MarcAuthority.deleteViaAPI(record.id);
}
});
});

MarcAuthorities.getMarcAuthoritiesViaApi({
limit: 100,
query: 'keyword="C388641"',
}).then((records) => {
records.forEach((record) => {
if (record.authRefType === 'Authorized') {
MarcAuthority.deleteViaAPI(record.id);
}
});
});
MarcAuthorities.deleteMarcAuthorityByTitleViaAPI('C388641');
});

cy.createTempUser([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,7 @@ describe('MARC', () => {
// Making sure there are no duplicate authority records in the system before auto-linking
cy.getAdminToken().then(() => {
naturalIds.forEach((id) => {
MarcAuthorities.getMarcAuthoritiesViaApi({
limit: 200,
query: `naturalId="${id}*" and authRefType=="Authorized"`,
}).then((records) => {
records.forEach((record) => {
MarcAuthority.deleteViaAPI(record.id);
});
});
MarcAuthorities.deleteMarcAuthorityByTitleViaAPI(id);
});
});

Expand Down
25 changes: 25 additions & 0 deletions cypress/support/fragments/inventory/search/browseContributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,31 @@ export default {
});
},

waitForContributorToAppear(contributorName, isPresent = true) {
return cy.recurse(
() => {
return cy.okapiRequest({
method: 'GET',
path: 'browse/contributors/instances',
searchParams: {
query: `(name>="${contributorName}")`,
},
isDefaultSearchParamsRequired: false,
});
},
(response) => {
const foundContributors = response.body.items.filter((item) => {
return item.name === contributorName;
});
return isPresent ? foundContributors.length > 0 : foundContributors.length === 0;
},
{
limit: 10,
delay: 5000,
},
);
},

openInstance(contributor) {
cy.do(MultiColumnListCell(contributor.name).hrefClick());
},
Expand Down

0 comments on commit 0ce3df7

Please sign in to comment.