Skip to content

Commit

Permalink
fixed tests (#4583)
Browse files Browse the repository at this point in the history
  • Loading branch information
TetianaParanich authored Dec 25, 2024
1 parent dde7e69 commit 1b7fa6a
Show file tree
Hide file tree
Showing 15 changed files with 146 additions and 126 deletions.
6 changes: 1 addition & 5 deletions cypress/e2e/data-import/e2e/match-on-holdings-856-u.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import NewJobProfile from '../../../support/fragments/data_import/job_profiles/n
import FileDetails from '../../../support/fragments/data_import/logs/fileDetails';
import Logs from '../../../support/fragments/data_import/logs/logs';
import HoldingsRecordView from '../../../support/fragments/inventory/holdingsRecordView';
import InstanceRecordView from '../../../support/fragments/inventory/instanceRecordView';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import InventorySearchAndFilter from '../../../support/fragments/inventory/inventorySearchAndFilter';
import {
ActionProfiles as SettingsActionProfiles,
FieldMappingProfiles as SettingsFieldMappingProfiles,
Expand Down Expand Up @@ -238,9 +236,7 @@ describe('Data Import', () => {
Logs.checkJobStatus(nameForUpdateCreateMarcFile, JOB_STATUS_NAMES.COMPLETED);

TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InventorySearchAndFilter.searchInstanceByHRID(instanceHRID);
InstanceRecordView.verifyInstancePaneExists();
InstanceRecordView.openHoldingView();
HoldingsRecordView.waitLoading();
HoldingsRecordView.checkCallNumber('ONLINE');
});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ describe('Data Import', () => {
FileDetails.columnNameInResultList.instance,
);

TopMenuNavigation.openAppFromDropdown(APPLICATION_NAMES.INVENTORY);
cy.wait(2000);
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InventorySearchAndFilter.waitLoading();
InventorySearchAndFilter.searchInstanceByHRID(instanceHRID);
// ensure the fields created in Field mapping profile exists in inventory
InventorySearchAndFilter.checkInstanceDetails();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ describe('Data Import', () => {
FileDetails.columnNameInResultList.instance,
);

TopMenuNavigation.openAppFromDropdown(APPLICATION_NAMES.INVENTORY);
InventorySearchAndFilter.searchInstanceByHRID(instanceHRID);
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InstanceRecordView.verifyInstancePaneExists();
// ensure the fields created in Field mapping profile exists in inventory
InventorySearchAndFilter.checkInstanceDetails();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Data Import', () => {
JobProfiles.runImportFile();
Logs.checkFileIsRunning(bigFileName);
// TODO wait until at least 1% of the file will be processed
cy.wait(45000);
cy.wait(15000);
DataImport.deleteImportJob(bigFileName);
DataImport.verifyCancelImportJobModal();
DataImport.confirmDeleteImportJob();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DEFAULT_JOB_PROFILE_NAMES, RECORD_STATUSES } from '../../../support/constants';
import { Permissions } from '../../../support/dictionary';
import DataImport from '../../../support/fragments/data_import/dataImport';
import JobProfiles from '../../../support/fragments/data_import/job_profiles/jobProfiles';
import FileDetails from '../../../support/fragments/data_import/logs/fileDetails';
import Logs from '../../../support/fragments/data_import/logs/logs';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
Expand All @@ -20,16 +21,16 @@ describe('Data Import', () => {
cy.createTempUser([Permissions.moduleDataImportEnabled.gui]).then((userProperties) => {
user = userProperties;

DataImport.uploadFileViaApi(filePathToUpload, fileName, jobProfileToRun).then(
(response) => {
instanceId = response[0].instance.id;
},
);

cy.login(user.username, user.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
DataImport.verifyUploadState();
DataImport.uploadFile(filePathToUpload, fileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.search(jobProfileToRun);
JobProfiles.runImportFile();
Logs.waitFileIsImported(fileName);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,99 +14,107 @@ import Users from '../../../support/fragments/users/users';
import InteractorsTools from '../../../support/utils/interactorsTools';
import getRandomPostfix from '../../../support/utils/stringTools';

let user;
const OCLCAuthentication = '100481406/PAOLF';
const fileName = `C356824 autotestFile${getRandomPostfix()}.mrc`;
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS;
const oclcForImport = '912958093';
const oclcForUpdating = '698820890';
const updatedInstanceData = {
title:
'Dictionary of Louisiana French : as spoken in Cajun, Creole, and American Indian communities / Albert Valdman, editor ; Kevin J. Rottet, associate editor.',
language: 'English, French',
publisher: 'University Press of Mississippi',
placeOfPublication: 'Jackson',
publicationDate: '2010',
physicalDescription: 'XL, 892 S',
subject: 'French language--Dialects--Louisiana--Dictionaries',
notes: {
noteType: 'Bibliography note',
noteContent: 'Includes bibliographical references and index',
},
};

describe('Data Import', () => {
describe('Importing MARC Bib files', () => {
let user;
const OCLCAuthentication = '100481406/PAOLF';
const fileName = `C356824 autotestFile${getRandomPostfix()}.mrc`;
const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS;
const oclcForImport = '912958093';
const oclcForUpdating = '698820890';
const updatedInstanceData = {
title:
'Dictionary of Louisiana French : as spoken in Cajun, Creole, and American Indian communities / Albert Valdman, editor ; Kevin J. Rottet, associate editor.',
language: 'English, French',
publisher: 'University Press of Mississippi',
placeOfPublication: 'Jackson',
publicationDate: '2010',
physicalDescription: 'XL, 892 S',
subject: 'French language--Dialects--Louisiana--Dictionaries',
notes: {
noteType: 'Bibliography note',
noteContent: 'Includes bibliographical references and index',
describe(
'Importing MARC Bib files',
{
retries: {
runMode: 2,
},
};

before('Create test user and login', () => {
cy.createTempUser([
Permissions.moduleDataImportEnabled.gui,
Permissions.uiInventorySingleRecordImport.gui,
Permissions.uiInventorySettingsConfigureSingleRecordImport.gui,
Permissions.settingsDataImportEnabled.gui,
Permissions.remoteStorageView.gui,
]).then((userProperties) => {
user = userProperties;
},
() => {
beforeEach('Create test user and login', () => {
cy.createTempUser([
Permissions.moduleDataImportEnabled.gui,
Permissions.uiInventorySingleRecordImport.gui,
Permissions.uiInventorySettingsConfigureSingleRecordImport.gui,
Permissions.settingsDataImportEnabled.gui,
Permissions.remoteStorageView.gui,
]).then((userProperties) => {
user = userProperties;

cy.login(user.username, user.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
cy.login(user.username, user.password, {
path: TopMenu.dataImportPath,
waiter: DataImport.waitLoading,
});
});
});
});

after('Delete test data', () => {
cy.getAdminToken().then(() => {
Users.deleteViaApi(user.userId);
afterEach('Delete test data', () => {
cy.getAdminToken().then(() => {
Users.deleteViaApi(user.userId);
});
});
});

it(
'C356824 Inventory single record import is not delayed when large data import jobs are running (folijet)',
{ tags: ['criticalPathFlaky', 'folijet', 'C356824'] },
() => {
Z3950TargetProfiles.changeOclcWorldCatValueViaApi(OCLCAuthentication);
it(
'C356824 Inventory single record import is not delayed when large data import jobs are running (folijet)',
{ tags: ['criticalPathFlaky', 'folijet', 'C356824'] },
() => {
Z3950TargetProfiles.changeOclcWorldCatValueViaApi(OCLCAuthentication);

// import a file
DataImport.checkIsLandingPageOpened();
DataImport.verifyUploadState();
DataImport.uploadFile('oneThousandMarcBib.mrc', fileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.search(jobProfileToRun);
JobProfiles.runImportFile();
Logs.checkFileIsRunning(fileName);
// import a file
DataImport.checkIsLandingPageOpened();
DataImport.verifyUploadState();
DataImport.uploadFile('oneThousandMarcBib.mrc', fileName);
JobProfiles.waitFileIsUploaded();
JobProfiles.search(jobProfileToRun);
JobProfiles.runImportFile();
Logs.checkFileIsRunning(fileName);

TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InventoryInstances.importWithOclc(oclcForImport);
InventoryInstance.waitLoading();
InventoryInstance.startOverlaySourceBibRecord();
InventoryInstance.singleOverlaySourceBibRecordModalIsPresented();
InventoryInstance.overlayWithOclc(oclcForUpdating);
InteractorsTools.checkCalloutMessage(
`Record ${oclcForUpdating} updated. Results may take a few moments to become visible in Inventory`,
calloutTypes.success,
);
cy.reload();
// check instance is updated
InventoryInstance.verifyInstanceTitle(updatedInstanceData.title);
InventoryInstance.verifyInstanceLanguage(updatedInstanceData.language);
InventoryInstance.verifyInstancePublisher({
publisher: updatedInstanceData.publisher,
place: updatedInstanceData.placeOfPublication,
date: updatedInstanceData.publicationDate,
});
InventoryInstance.verifyInstancePhysicalcyDescription(
updatedInstanceData.physicalDescription,
);
InventoryInstance.openSubjectAccordion();
InventoryInstance.verifyInstanceSubject(0, 0, updatedInstanceData.subject);
InventoryInstance.checkInstanceNotes(
updatedInstanceData.notes.noteType,
updatedInstanceData.notes.noteContent,
);
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InventoryInstances.importWithOclc(oclcForImport);
InventoryInstance.waitLoading();
InventoryInstance.startOverlaySourceBibRecord();
InventoryInstance.singleOverlaySourceBibRecordModalIsPresented();
InventoryInstance.overlayWithOclc(oclcForUpdating);
InteractorsTools.checkCalloutMessage(
`Record ${oclcForUpdating} updated. Results may take a few moments to become visible in Inventory`,
calloutTypes.success,
);
cy.reload();
// check instance is updated
InventoryInstance.verifyInstanceTitle(updatedInstanceData.title);
InventoryInstance.verifyInstanceLanguage(updatedInstanceData.language);
InventoryInstance.verifyInstancePublisher({
publisher: updatedInstanceData.publisher,
place: updatedInstanceData.placeOfPublication,
date: updatedInstanceData.publicationDate,
});
InventoryInstance.verifyInstancePhysicalcyDescription(
updatedInstanceData.physicalDescription,
);
InventoryInstance.openSubjectAccordion();
InventoryInstance.verifyInstanceSubject(0, 0, updatedInstanceData.subject);
InventoryInstance.checkInstanceNotes(
updatedInstanceData.notes.noteType,
updatedInstanceData.notes.noteContent,
);

TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT);
Logs.checkFileIsRunning(fileName);
},
);
});
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT);
Logs.checkFileIsRunning(fileName);
},
);
},
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ describe('Data Import', () => {
FileDetails.checkItemQuantityInSummaryTable(quantityOfItems, 1);

TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
ItemRecordView.closeDetailView();
InventorySearchAndFilter.searchInstanceByHRID(initialInstanceHrId);
InventoryInstance.openHoldingView();
HoldingsRecordView.checkTemporaryLocation('-');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ describe('Data Import', () => {
SettingsDataImport.selectSettingsTab(SETTINGS_TABS.MATCH_PROFILES);
MatchProfiles.createMatchProfile(instanceMatchProfile);
MatchProfiles.checkMatchProfilePresented(instanceMatchProfile.profileName);
cy.wait(1000);
cy.wait(3000);
MatchProfiles.createMatchProfileWithStaticValue(holdingsMatchProfile);
MatchProfiles.checkMatchProfilePresented(holdingsMatchProfile.profileName);

Expand Down Expand Up @@ -393,9 +393,7 @@ describe('Data Import', () => {
FileDetails.checkHoldingsQuantityInSummaryTable(quantityOfItems, 1);

TopMenuNavigation.navigateToApp(APPLICATION_NAMES.INVENTORY);
InventorySearchAndFilter.selectYesfilterStaffSuppress();
InventorySearchAndFilter.searchInstanceByHRID(instanceHrid);
InstanceRecordView.openHoldingView();
HoldingsRecordView.waitLoading();
HoldingsRecordView.checkFormerHoldingsId(
holdingsMappingProfileForUpdate.formerHoldingsId,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import NewJobProfile from '../../../support/fragments/data_import/job_profiles/n
import FileDetails from '../../../support/fragments/data_import/logs/fileDetails';
import JsonScreenView from '../../../support/fragments/data_import/logs/jsonScreenView';
import Logs from '../../../support/fragments/data_import/logs/logs';
import InventoryInstance from '../../../support/fragments/inventory/inventoryInstance';
import OrderLines from '../../../support/fragments/orders/orderLines';
import {
ActionProfiles as SettingsActionProfiles,
Expand All @@ -36,7 +35,6 @@ import getRandomPostfix from '../../../support/utils/stringTools';
describe('Data Import', () => {
describe('Permissions', () => {
let user;
let instanceId;
const filePath = 'marcBibFileForC377023.mrc';
const marcFileName = `C377023 autotestFileName${getRandomPostfix()}.mrc`;
const title = 'ROALD DAHL : TELLER OF THE UNEXPECTED : A BIOGRAPHY.';
Expand Down Expand Up @@ -135,7 +133,6 @@ describe('Data Import', () => {
SettingsJobProfiles.deleteJobProfileByNameViaApi(jobProfile.profileName);
SettingsActionProfiles.deleteActionProfileByNameViaApi(actionProfile.name);
SettingsFieldMappingProfiles.deleteMappingProfileByNameViaApi(mappingProfile.name);
InventoryInstance.deleteInstanceViaApi(instanceId);
});
});

Expand All @@ -151,7 +148,6 @@ describe('Data Import', () => {
JsonScreenView.openOrderTab();
JsonScreenView.verifyContentInTab(message);
TopMenuNavigation.navigateToApp(APPLICATION_NAMES.DATA_IMPORT);
FileDetails.close();
Logs.openFileDetails(marcFileName);
FileDetails.openOrder(RECORD_STATUSES.CREATED);
OrderLines.waitLoading();
Expand Down
1 change: 0 additions & 1 deletion cypress/e2e/inventory/holdings/holdings-details.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ describe('Inventory', () => {
HoldingsRecordEdit.saveAndClose();
HoldingsRecordView.waitLoading();
HoldingsRecordView.checkHoldingsType(testData.holdingsType);
cy.logout();

cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let user;
let instanceRecord;
const OCLCAuthentication = '100481406/PAOLF';
const oclcRecordData = {
title: 'Cooking Light Soups & Stew [electronic resource].',
title: 'Cooking Light Soups & Stew.',
language: 'English',
publisher: 'TI Inc. Books',
placeOfPublication: 'Chicago',
Expand Down Expand Up @@ -79,7 +79,6 @@ describe('Inventory', () => {
`Record ${oclcRecordData.oclc} updated. Results may take a few moments to become visible in Inventory`,
);
cy.wait(15000);
cy.reload();
InventoryInstance.waitInstanceRecordViewOpened(oclcRecordData.title);
InventoryInstance.verifyLastUpdatedDate();
InstanceRecordView.verifyInstanceSource(INSTANCE_SOURCE_NAMES.MARC);
Expand All @@ -91,9 +90,12 @@ describe('Inventory', () => {
date: oclcRecordData.publicationDate,
});
InventoryInstance.verifyInstancePhysicalcyDescription(oclcRecordData.physicalDescription);
InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn1, 4);
InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn2, 5);
InventoryInstance.openIdentifiersAccordion();
InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn1, 6);
InventoryInstance.verifyResourceIdentifier('ISBN', oclcRecordData.isbn2, 7);
InventoryInstance.openSubjectAccordion();
InventoryInstance.verifyInstanceSubject(0, 0, oclcRecordData.subject);
InventoryInstance.openInstanceNotesAccordion();
InventoryInstance.checkInstanceNotes(
oclcRecordData.notes.noteType,
oclcRecordData.notes.noteContent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,12 @@ describe('Data Import', () => {
cy.wait(2000);
JobProfileView.duplicate();
NewJobProfile.fillProfileName(jobProfileNameForChanging);
cy.wait(7000);
cy.wait(3000);
NewJobProfile.unlinkProfile(1);
cy.wait(3000);
NewJobProfile.saveAndClose();
JobProfileView.verifyCalloutMessage(calloutMessage);
cy.wait(7000);
JobProfileView.verifyJobProfileOpened();
JobProfileView.verifyJobProfileName(jobProfileNameForChanging);
JobProfileView.verifyLinkedProfiles(linkedProfileNames, linkedProfileNames.length);
Expand Down
Loading

0 comments on commit 1b7fa6a

Please sign in to comment.