Skip to content

Commit

Permalink
Fat 17699 (#4569)
Browse files Browse the repository at this point in the history
* fixed tests

* fixed tests
  • Loading branch information
TetianaParanich authored Dec 20, 2024
1 parent c140acb commit 6b1846c
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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,
]);

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 @@ -48,23 +40,20 @@ describe('Inventory', () => {
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);
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(C402335testData.instanceId);
InventoryInstance.deleteInstanceViaApi(C402376testData.instance.instanceId);
InventoryInstance.deleteInstanceViaApi(testData.instanceId);
Users.deleteViaApi(user.userId);
});

Expand All @@ -74,32 +63,14 @@ describe('Inventory', () => {
() => {
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);
InventorySearchAndFilter.searchInstanceByTitle(testData.instanceId);
cy.wait('@/authn/refresh', { timeout: 5000 });
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 @@ -127,7 +127,7 @@ describe('Inventory', () => {
);
InventoryInstance.openItemByBarcode(testData.itemBarcode);
ItemRecordView.verifyEffectiveLocationForItemInDetails(testData.locationName);
ItemRecordView.verifyHoldingsPermanentLocation(testData.locationName);
ItemRecordView.verifyHoldingsPermanentLocation(`${testData.locationName} (University)`);
ItemRecordView.verifyItemEffectiveLocation(testData.locationName);
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,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 6b1846c

Please sign in to comment.