Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TetianaParanich committed Dec 19, 2024
1 parent 0ddf61e commit 9b500fc
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 42 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { INSTANCE_SOURCE_NAMES } from '../../../../support/constants';
import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations';
import Permissions from '../../../../support/dictionary/permissions';
import InstanceRecordView from '../../../../support/fragments/inventory/instanceRecordView';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
import InventorySearchAndFilter from '../../../../support/fragments/inventory/inventorySearchAndFilter';
import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';

describe('Inventory', () => {
describe('Instance', () => {
let user;
const testData = {
instanceSource: INSTANCE_SOURCE_NAMES.FOLIO,
};

before('Create test data', () => {
cy.getAdminToken();
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
testData.instance = instanceData;
});

cy.createTempUser([Permissions.uiInventoryViewInstances.gui])
.then((userProperties) => {
user = userProperties;
})
.then(() => {
cy.assignAffiliationToUser(Affiliations.College, user.userId);
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(user.userId, [
Permissions.uiInventoryViewCreateEditInstances.gui,
]);
});
});

beforeEach('Login', () => {
cy.login(user.username, user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college);
});

after('Delete test data', () => {
cy.resetTenant();
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(testData.instance.instanceId);
Users.deleteViaApi(user.userId);
});

it(
'C402376 (CONSORTIA) Verify limited Edit permissions for Shared FOLIO instance on Member tenant (consortia) (folijet)',
{ tags: ['criticalPathECS', 'folijet', 'C402376'] },
() => {
InventorySearchAndFilter.verifySearchAndFilterPane();
InventorySearchAndFilter.bySource(testData.instanceSource);
cy.wait(1500);
InventorySearchAndFilter.byShared('Yes');
cy.wait(1500);
InventorySearchAndFilter.searchInstanceByTitle(testData.instance.instanceId);
InventorySearchAndFilter.verifyInstanceDetailsView();
InstanceRecordView.verifyInstanceSource(testData.instanceSource);
InstanceRecordView.verifyEditInstanceButtonAbsent();
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,22 @@ import getRandomPostfix from '../../../../support/utils/stringTools';
describe('Inventory', () => {
describe('Instance', () => {
let user;
const C402335testData = {
const testData = {
filePath: 'oneMarcBib.mrc',
marcFileName: `C402335 autotestFileName${getRandomPostfix()}.mrc`,
instanceSource: INSTANCE_SOURCE_NAMES.MARC,
};
const C402376testData = {
instanceSource: INSTANCE_SOURCE_NAMES.FOLIO,
};

before('Create test data', () => {
cy.getAdminToken();
DataImport.uploadFileViaApi(
C402335testData.filePath,
C402335testData.marcFileName,
testData.filePath,
testData.marcFileName,
DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
).then((response) => {
C402335testData.instanceId = response[0].instance.id;
});
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
C402376testData.instance = instanceData;
testData.instanceId = response[0].instance.id;
});
cy.resetTenant();

cy.getAdminToken();
cy.createTempUser([Permissions.uiInventoryViewInstances.gui])
.then((userProperties) => {
user = userProperties;
Expand All @@ -63,43 +55,22 @@ describe('Inventory', () => {
after('Delete test data', () => {
cy.resetTenant();
cy.getAdminToken();
InventoryInstance.deleteInstanceViaApi(C402335testData.instanceId);
InventoryInstance.deleteInstanceViaApi(C402376testData.instance.instanceId);
InventoryInstance.deleteInstanceViaApi(testData.instanceId);
Users.deleteViaApi(user.userId);
});

it(
'C402335 (CONSORTIA) Verify limited Edit permissions for Shared MARC instance on Member tenant (consortia) (folijet)',
{ tags: ['criticalPathECS', 'folijet', 'C402335'] },
() => {
cy.intercept('POST', '/authn/refresh').as('/authn/refresh');
InventorySearchAndFilter.verifySearchAndFilterPane();
InventorySearchAndFilter.bySource(C402335testData.instanceSource);
cy.wait(1500);
InventorySearchAndFilter.byShared('Yes');
cy.wait(1500);
InventorySearchAndFilter.searchInstanceByTitle(C402335testData.instanceId);
cy.wait('@/authn/refresh', { timeout: 5000 });
InventorySearchAndFilter.verifyInstanceDetailsView();
InstanceRecordView.verifyInstanceSource(C402335testData.instanceSource);
InstanceRecordView.verifyEditInstanceButtonAbsent();
},
);

it(
'C402376 (CONSORTIA) Verify limited Edit permissions for Shared FOLIO instance on Member tenant (consortia) (folijet)',
{ tags: ['criticalPathECS', 'folijet', 'C402376'] },
() => {
cy.intercept('POST', '/authn/refresh').as('/authn/refresh');
InventorySearchAndFilter.verifySearchAndFilterPane();
InventorySearchAndFilter.bySource(C402376testData.instanceSource);
InventorySearchAndFilter.bySource(testData.instanceSource);
cy.wait(1500);
InventorySearchAndFilter.byShared('Yes');
cy.wait(1500);
InventorySearchAndFilter.searchInstanceByTitle(C402376testData.instance.instanceId);
cy.wait('@/authn/refresh', { timeout: 5000 });
InventorySearchAndFilter.searchInstanceByTitle(testData.instanceId);
InventorySearchAndFilter.verifyInstanceDetailsView();
InstanceRecordView.verifyInstanceSource(C402376testData.instanceSource);
InstanceRecordView.verifyInstanceSource(testData.instanceSource);
InstanceRecordView.verifyEditInstanceButtonAbsent();
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,7 @@ describe('Data Import', () => {
DataImport.editMarcFile(
'marcFileForC350591.mrc',
editedMarcFileName,
[
'Agrarianism and capitalism in early Georgia, 1732-1743 /',
'14567-1',
'xyzt124245271818912626262',
],
['Cornell University Graduate School records,', '14567-1', 'xyzt124245271818912626262'],
[uniquePartOfInstanceTitle, item.vrn, itemBarcode],
);

Expand Down

0 comments on commit 9b500fc

Please sign in to comment.