Skip to content

Commit

Permalink
Merge branch 'master' into FAT-13417
Browse files Browse the repository at this point in the history
  • Loading branch information
nayimovag committed May 21, 2024
2 parents 38bd9cf + 8ad1f7b commit ef10bf1
Show file tree
Hide file tree
Showing 35 changed files with 870 additions and 168 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import { DEFAULT_JOB_PROFILE_NAMES, INSTANCE_SOURCE_NAMES } from '../../../../support/constants';
import { tenantNames } from '../../../../support/dictionary/affiliations';
import Permissions from '../../../../support/dictionary/permissions';
import DataImport from '../../../../support/fragments/data_import/dataImport';
import InstanceRecordView from '../../../../support/fragments/inventory/instanceRecordView';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
import InventoryNewInstance from '../../../../support/fragments/inventory/inventoryNewInstance';
import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';
import getRandomPostfix from '../../../../support/utils/stringTools';

describe('Inventory', () => {
describe('Instance', () => {
const marcFile = {
marc: 'oneMarcBib.mrc',
marcFileName: `C410928 marcFileName${getRandomPostfix()}.mrc`,
};
const testData = {
newResourceTitleC410927: `C410927 instanceTitle${getRandomPostfix()}`,
newResourceTitleC410928: `C410928 instanceTitle${getRandomPostfix()}`,
newResourceType: 'notated movement',
source: INSTANCE_SOURCE_NAMES.FOLIO,
};

before('Create test data', () => {
cy.getAdminToken();
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
testData.instanceC410927 = instanceData;
});
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.marcFileName,
DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
).then((response) => {
testData.instanceC410928 = response[0].instance;
});

cy.createTempUser([Permissions.inventoryAll.gui]).then((userProperties) => {
testData.user = userProperties;
});
});

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

after('Delete test data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(testData.user.userId);
InventoryInstance.deleteInstanceViaApi(testData.instanceC410927.instanceId);
InventoryInstance.deleteInstanceViaApi(testData.instanceC410928.id);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"hrid"=="${testData.instanceC410927Hrid}"`,
}).then((instance) => {
InventoryInstance.deleteInstanceViaApi(instance.id);
});
cy.getInstance({
limit: 1,
expandAll: true,
query: `"hrid"=="${testData.instanceC410928Hrid}"`,
}).then((instance) => {
InventoryInstance.deleteInstanceViaApi(instance.id);
});
});

it(
'C410927 (CONSORTIA) Duplicating shared instance on Central tenant with Source FOLIO (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
InventoryInstances.searchByTitle(testData.instanceC410927.instanceId);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
InstanceRecordView.duplicate();
InventoryNewInstance.fillResourceTitle(testData.newResourceTitleC410927);
InventoryNewInstance.fillResourceType(testData.newResourceType);
InventoryNewInstance.clickSaveAndCloseButton();
InventoryInstance.waitInstanceRecordViewOpened(testData.newResourceTitleC410927);
InventoryInstance.checkInstanceDetails([{ key: 'Source', value: testData.source }]);
InventoryInstance.getAssignedHRID().then((initialInstanceHrId) => {
testData.instanceC410927Hrid = initialInstanceHrId;
});
},
);

it(
'C410928 (CONSORTIA) Duplicating shared instance on Central tenant with Source MARC (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
InventoryInstances.searchByTitle(testData.instanceC410928.id);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
InstanceRecordView.duplicate();
InventoryNewInstance.fillResourceTitle(testData.newResourceTitleC410928);
InventoryNewInstance.fillResourceType(testData.newResourceType);
InventoryNewInstance.clickSaveAndCloseButton();
InventoryInstance.waitInstanceRecordViewOpened(testData.newResourceTitleC410928);
InventoryInstance.checkInstanceDetails([{ key: 'Source', value: testData.source }]);
InventoryInstance.getAssignedHRID().then((initialInstanceHrId) => {
testData.instanceC410928Hrid = initialInstanceHrId;
});
},
);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { DEFAULT_JOB_PROFILE_NAMES, INSTANCE_SOURCE_NAMES } from '../../../../support/constants';
import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations';
import Permissions from '../../../../support/dictionary/permissions';
import DataImport from '../../../../support/fragments/data_import/dataImport';
import InstanceRecordView from '../../../../support/fragments/inventory/instanceRecordView';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
import InventoryNewInstance from '../../../../support/fragments/inventory/inventoryNewInstance';
import ConsortiumManager from '../../../../support/fragments/settings/consortium-manager/consortium-manager';
import TopMenu from '../../../../support/fragments/topMenu';
import Users from '../../../../support/fragments/users/users';
import getRandomPostfix from '../../../../support/utils/stringTools';

describe('Inventory', () => {
describe('Instance', () => {
const marcFile = {
marc: 'oneMarcBib.mrc',
marcFileName: `C410926 marcFileName${getRandomPostfix()}.mrc`,
};
const testData = {
newResourceTitleC410925: `C410925 instanceTitle${getRandomPostfix()}`,
newResourceTitleC410926: `C410926 instanceTitle${getRandomPostfix()}`,
newResourceType: 'notated movement',
source: INSTANCE_SOURCE_NAMES.FOLIO,
};

before('Create test data', () => {
cy.getAdminToken();
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
testData.instanceC410925 = instanceData;
});
DataImport.uploadFileViaApi(
marcFile.marc,
marcFile.marcFileName,
DEFAULT_JOB_PROFILE_NAMES.CREATE_INSTANCE_AND_SRS,
).then((response) => {
testData.instanceC410926 = response[0].instance;
});

cy.resetTenant();
cy.createTempUser([Permissions.inventoryAll.gui]).then((userProperties) => {
testData.user = userProperties;

cy.assignAffiliationToUser(Affiliations.College, testData.user.userId);
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(testData.user.userId, [Permissions.inventoryAll.gui]);
});
});

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

after('Delete test data', () => {
cy.resetTenant();
cy.getAdminToken();
Users.deleteViaApi(testData.user.userId);
InventoryInstance.deleteInstanceViaApi(testData.instanceC410925.instanceId);
InventoryInstance.deleteInstanceViaApi(testData.instanceC410926.id);
cy.setTenant(Affiliations.College);
cy.getInstance({
limit: 1,
expandAll: true,
query: `"hrid"=="${testData.instanceC410925Hrid}"`,
}).then((instance) => {
InventoryInstance.deleteInstanceViaApi(instance.id);
});
cy.getInstance({
limit: 1,
expandAll: true,
query: `"hrid"=="${testData.instanceC410926Hrid}"`,
}).then((instance) => {
InventoryInstance.deleteInstanceViaApi(instance.id);
});
});

it(
'C410925 (CONSORTIA) Duplicating shared instance on Member tenant with Source FOLIO (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
InventoryInstances.searchByTitle(testData.instanceC410925.instanceId);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
InstanceRecordView.duplicate();
InventoryNewInstance.fillResourceTitle(testData.newResourceTitleC410925);
InventoryNewInstance.fillResourceType(testData.newResourceType);
InventoryNewInstance.clickSaveAndCloseButton();
InventoryInstance.waitInstanceRecordViewOpened(testData.newResourceTitleC410925);
InventoryInstance.checkInstanceDetails([{ key: 'Source', value: testData.source }]);
InventoryInstance.getAssignedHRID().then((initialInstanceHrId) => {
testData.instanceC410925Hrid = initialInstanceHrId;
});
},
);

it(
'C410926 (CONSORTIA) Duplicating shared instance on Member tenant with Source MARC (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
InventoryInstances.searchByTitle(testData.instanceC410926.id);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
InstanceRecordView.duplicate();
InventoryNewInstance.fillResourceTitle(testData.newResourceTitleC410926);
InventoryNewInstance.fillResourceType(testData.newResourceType);
InventoryNewInstance.clickSaveAndCloseButton();
InventoryInstance.waitInstanceRecordViewOpened(testData.newResourceTitleC410926);
InventoryInstance.checkInstanceDetails([{ key: 'Source', value: testData.source }]);
InventoryInstance.getAssignedHRID().then((initialInstanceHrId) => {
testData.instanceC410926Hrid = initialInstanceHrId;
});
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ describe('Inventory', () => {
InventoryInstances.searchByTitle(testData.instance.instanceTitle);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
InventoryInstance.checkInstanceHeader(`Local instance • ${testData.instance.instanceTitle} `);
InventoryInstance.checkInstanceHeader(
`Local instance • ${testData.instance.instanceTitle} `,
);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ describe('Inventory', () => {
InstanceRecordView.edit();
InstanceRecordEdit.waitLoading();

InstanceRecordEdit.checkInstanceHeader(` Edit shared instance • ${testData.instance.instanceTitle}`);
InstanceRecordEdit.checkInstanceHeader(
` Edit shared instance • ${testData.instance.instanceTitle}`,
);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ describe('Inventory', () => {
InstanceRecordView.edit();
InstanceRecordEdit.waitLoading();

InstanceRecordEdit.checkInstanceHeader(` Edit shared instance • ${testData.instance.instanceTitle}`);
InstanceRecordEdit.checkInstanceHeader(
` Edit shared instance • ${testData.instance.instanceTitle}`,
);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Affiliations from '../../../../support/dictionary/affiliations';
import Permissions from '../../../../support/dictionary/permissions';
import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance';
import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances';
Expand All @@ -11,46 +10,34 @@ describe('Inventory', () => {

before('Create test data', () => {
cy.getAdminToken();
cy.getConsortiaId().then((consortiaId) => {
testData.consortiaId = consortiaId;
});
cy.setTenant(Affiliations.College);
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
testData.instance = instanceData;
InventoryInstance.shareInstanceViaApi(
testData.instance.instanceId,
testData.consortiaId,
Affiliations.College,
Affiliations.Consortia,
);
});

cy.resetTenant();
cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then(
(userProperties) => {
testData.user = userProperties;

cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});
},
);
});

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

it(
'C404385 (CONSORTIA) Verify the header of a shared Instance on the Central tenant (consortia) (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
cy.login(testData.user.username, testData.user.password, {
path: TopMenu.inventoryPath,
waiter: InventoryInstances.waitContentLoading,
});

InventoryInstances.searchByTitle(testData.instance.instanceTitle);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,43 @@ describe('Inventory', () => {

before('Create test data', () => {
cy.getAdminToken();
cy.getConsortiaId().then((consortiaId) => {
testData.consortiaId = consortiaId;
});
cy.setTenant(Affiliations.College);
InventoryInstance.createInstanceViaApi().then(({ instanceData }) => {
testData.instance = instanceData;
InventoryInstance.shareInstanceViaApi(
testData.instance.instanceId,
testData.consortiaId,
Affiliations.College,
Affiliations.Consortia,
);
});

cy.resetTenant();
cy.createTempUser([Permissions.uiInventoryViewCreateEditInstances.gui]).then(
(userProperties) => {
testData.user = userProperties;

cy.assignAffiliationToUser(Affiliations.College, testData.user.userId);
cy.setTenant(Affiliations.College);
cy.assignPermissionsToExistingUser(testData.user.userId, [
Permissions.uiInventoryViewCreateEditInstances.gui,
]);

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

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

it(
'C404384 (CONSORTIA) Verify the header of a shared Instance on the Member tenant (consortia) (folijet)',
{ tags: ['extendedPathECS', 'folijet'] },
() => {
cy.login(testData.user.username, testData.user.password);

ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central);
ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college);
ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college);

cy.visit(TopMenu.inventoryPath);
InventoryInstances.waitContentLoading();

InventoryInstances.searchByTitle(testData.instance.instanceTitle);
InventoryInstances.selectInstance();
InventoryInstance.waitLoading();
Expand Down
Loading

0 comments on commit ef10bf1

Please sign in to comment.