From 5752c831d8fc1f2aa5a9c9eba7037f9019f61608 Mon Sep 17 00:00:00 2001 From: Ostap_Voitsekhovskyi Date: Mon, 1 Apr 2024 16:20:37 +0300 Subject: [PATCH 1/3] FAT-10355 FAT-10356 --- cypress.config.js | 8 +- ...rdion-shadow-instance-central-tenant.cy.js | 108 ++++++++++++++++++ ...ordion-shadow-instance-member-tenant.cy.js | 68 +++++++++++ ...-for-member-librarys-holdings-record.cy.js | 2 - .../fragments/inventory/instanceRecordView.js | 10 +- 5 files changed, 185 insertions(+), 11 deletions(-) create mode 100644 cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js create mode 100644 cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js diff --git a/cypress.config.js b/cypress.config.js index ebf24d89b3..7444b6f102 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -21,9 +21,9 @@ module.exports = defineConfig({ pageLoadTimeout: 60000, downloadsFolder: 'cypress/downloads', env: { - OKAPI_HOST: 'https://folio-testing-cypress-okapi.ci.folio.org', - OKAPI_TENANT: 'diku', - diku_login: 'diku_admin', + OKAPI_HOST: 'https://folio-testing-sprint-okapi.ci.folio.org', + OKAPI_TENANT: 'cs00000int', + diku_login: 'ECSAdmin', diku_password: 'admin', is_kiwi_release: false, downloadTimeout: 2000, @@ -114,7 +114,7 @@ module.exports = defineConfig({ return result; }, - baseUrl: 'https://folio-testing-cypress-diku.ci.folio.org', + baseUrl: 'https://folio-testing-sprint-cs00000int.ci.folio.org', testIsolation: false, }, }); diff --git a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js new file mode 100644 index 0000000000..d1a07f260e --- /dev/null +++ b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js @@ -0,0 +1,108 @@ +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'; +import TopMenu from '../../../../support/fragments/topMenu'; +import Users from '../../../../support/fragments/users/users'; +import InventoryHoldings from '../../../../support/fragments/inventory/holdings/inventoryHoldings'; +import Locations from '../../../../support/fragments/settings/tenant/location-setup/locations'; +import ServicePoints from '../../../../support/fragments/settings/tenant/servicePoints/servicePoints'; +import InventoryItems from '../../../../support/fragments/inventory/item/inventoryItems'; + +describe('Inventory', () => { + describe('Instance', () => { + const testData = { + servicePoint: ServicePoints.defaultServicePoint, + }; + + before('Create test data', () => { + cy.getAdminToken(); + cy.getConsortiaId().then((consortiaId) => { + testData.consortiaId = consortiaId; + }); + cy.setTenant(Affiliations.College); + cy.getCollegeAdminToken(); + InventoryInstance.createInstanceViaApi().then(({ instanceData }) => { + testData.instance = instanceData; + ServicePoints.createViaApi(testData.servicePoint).then(() => { + testData.location = Locations.getDefaultLocation({ + servicePointId: testData.servicePoint.id, + }).location; + + Locations.createViaApi(testData.location).then(() => { + InventoryHoldings.createHoldingRecordViaApi({ + instanceId: testData.instance.instanceId, + permanentLocationId: testData.location.id, + }).then(({ id: holdingId }) => { + testData.instance.holdingId = holdingId; + cy.getLoanTypes({ limit: 1 }).then((res) => { + testData.loanTypeId = res[0].id; + }); + cy.getMaterialTypes({ limit: 1 }).then((res) => { + testData.materialTypeId = res.id; + }); + InventoryItems.createItemViaApi({ + holdingsRecordId: holdingId, + materialType: { id: testData.materialTypeId }, + permanentLoanType: { id: testData.loanTypeId }, + status: { name: 'Available' }, + }).then((item) => { + testData.item = item; + }); + }); + }); + }); + + InventoryInstance.shareInstanceViaApi( + testData.instance.instanceId, + testData.consortiaId, + Affiliations.College, + Affiliations.Consortia, + ); + }); + + 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]); + }); + }); + + after('Delete test data', () => { + cy.resetTenant(); + cy.getAdminToken(); + cy.setTenant(Affiliations.College); + cy.deleteItemViaApi(testData.item.id); + InventoryHoldings.deleteHoldingRecordViaApi(testData.instance.holdingId); + Locations.deleteViaApi(testData.location); + ServicePoints.deleteViaApi(testData.servicePoint.id); + InventoryInstance.deleteInstanceViaApi(testData.instance.instanceId); + cy.resetTenant(); + Users.deleteViaApi(testData.user.userId); + }); + + it( + 'C411616 (CONSORTIA) Verify the Consortial holdings accordion details on shared Instance in 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(); + // InventoryInstance.verifyConsortiaHoldingsAccordion(false); + // InventoryInstance.expandConsortiaHoldings(); + InventoryInstance.expandMemberSubHoldings(Affiliations.College); + InventoryInstance.expandMemberSubSubHoldings( + Affiliations.College, + testData.instance.holdingId, + ); + }, + ); + }); +}); diff --git a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js new file mode 100644 index 0000000000..280007db0e --- /dev/null +++ b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js @@ -0,0 +1,68 @@ +import Affiliations, { tenantNames } from '../../../../support/dictionary/affiliations'; +import Permissions from '../../../../support/dictionary/permissions'; +import InventoryInstance from '../../../../support/fragments/inventory/inventoryInstance'; +import InventoryInstances from '../../../../support/fragments/inventory/inventoryInstances'; +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', () => { + const testData = {}; + + 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.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]); + }); + }); + + 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( + 'C411615 (CONSORTIA) Verify the Consortial holdings accordion on shadow Instance in 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(); + + InventoryInstance.verifyConsortiaHoldingsAccordion(); + }, + ); + }); +}); diff --git a/cypress/e2e/consortia/inventory/instance/holding-actions-menu-on-central-tenant-for-member-librarys-holdings-record.cy.js b/cypress/e2e/consortia/inventory/instance/holding-actions-menu-on-central-tenant-for-member-librarys-holdings-record.cy.js index ec799524c1..f7c5ce0eb3 100644 --- a/cypress/e2e/consortia/inventory/instance/holding-actions-menu-on-central-tenant-for-member-librarys-holdings-record.cy.js +++ b/cypress/e2e/consortia/inventory/instance/holding-actions-menu-on-central-tenant-for-member-librarys-holdings-record.cy.js @@ -9,13 +9,11 @@ import Locations from '../../../../support/fragments/settings/tenant/location-se import ServicePoints from '../../../../support/fragments/settings/tenant/servicePoints/servicePoints'; import TopMenu from '../../../../support/fragments/topMenu'; import Users from '../../../../support/fragments/users/users'; -import getRandomPostfix from '../../../../support/utils/stringTools'; describe('Inventory', () => { describe('Instance', () => { let user; const testData = { - newInstanceTitle: `C411384 instanceTitle${getRandomPostfix()}`, servicePoint: ServicePoints.defaultServicePoint, }; diff --git a/cypress/support/fragments/inventory/instanceRecordView.js b/cypress/support/fragments/inventory/instanceRecordView.js index a4c30a4a05..8988261885 100644 --- a/cypress/support/fragments/inventory/instanceRecordView.js +++ b/cypress/support/fragments/inventory/instanceRecordView.js @@ -32,7 +32,7 @@ const electronicAccessAccordion = Accordion('Electronic access'); const classificationAccordion = Accordion('Classification'); const listClassifications = MultiColumnList({ id: 'list-classifications' }); const descriptiveDataAccordion = Accordion('Descriptive data'); -const adminDataAcoordion = Accordion('Administrative data'); +const adminDataAccordion = Accordion('Administrative data'); const publisherList = descriptiveDataAccordion.find(MultiColumnList({ id: 'list-publication' })); const verifyResourceTitle = (value) => { @@ -341,7 +341,7 @@ export default { verifyMarkedAsStaffSuppressed() { cy.expect( rootSection - .find(adminDataAcoordion) + .find(adminDataAccordion) .find(HTML(including('Staff suppressed'))) .exists(), ); @@ -350,7 +350,7 @@ export default { verifyNotMarkAssuppressFromDiscavery() { cy.expect( rootSection - .find(adminDataAcoordion) + .find(adminDataAccordion) .find(HTML(including('Suppressed from discovery'))) .absent(), ); @@ -359,7 +359,7 @@ export default { verifyMarkedAsPreviouslyHeld() { cy.expect( rootSection - .find(adminDataAcoordion) + .find(adminDataAccordion) .find(HTML(including('Previously held'))) .exists(), ); @@ -368,7 +368,7 @@ export default { verifyNotMarkAsPreviouslyHeld() { cy.expect( rootSection - .find(adminDataAcoordion) + .find(adminDataAccordion) .find(HTML(including('Previously held'))) .absent(), ); From ad3a9ca293190f0e194a34e4d88644e789e7567d Mon Sep 17 00:00:00 2001 From: Tetiana_Paranich Date: Tue, 14 May 2024 16:04:43 +0300 Subject: [PATCH 2/3] fixed tests --- ...rdion-shadow-instance-central-tenant.cy.js | 129 ++++++++++-------- ...ordion-shadow-instance-member-tenant.cy.js | 19 ++- 2 files changed, 79 insertions(+), 69 deletions(-) diff --git a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js index d1a07f260e..b805932fad 100644 --- a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js +++ b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-central-tenant.cy.js @@ -1,18 +1,20 @@ +import uuid from 'uuid'; +import { ITEM_STATUS_NAMES } from '../../../../support/constants'; 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'; -import TopMenu from '../../../../support/fragments/topMenu'; -import Users from '../../../../support/fragments/users/users'; -import InventoryHoldings from '../../../../support/fragments/inventory/holdings/inventoryHoldings'; import Locations from '../../../../support/fragments/settings/tenant/location-setup/locations'; import ServicePoints from '../../../../support/fragments/settings/tenant/servicePoints/servicePoints'; -import InventoryItems from '../../../../support/fragments/inventory/item/inventoryItems'; +import TopMenu from '../../../../support/fragments/topMenu'; +import Users from '../../../../support/fragments/users/users'; +import getRandomPostfix from '../../../../support/utils/stringTools'; describe('Inventory', () => { describe('Instance', () => { const testData = { - servicePoint: ServicePoints.defaultServicePoint, + instanceTitle: `C411616 Instance ${getRandomPostfix()}`, + itemBarcode: uuid(), }; before('Create test data', () => { @@ -21,87 +23,96 @@ describe('Inventory', () => { testData.consortiaId = consortiaId; }); cy.setTenant(Affiliations.College); - cy.getCollegeAdminToken(); - InventoryInstance.createInstanceViaApi().then(({ instanceData }) => { - testData.instance = instanceData; - ServicePoints.createViaApi(testData.servicePoint).then(() => { - testData.location = Locations.getDefaultLocation({ - servicePointId: testData.servicePoint.id, + cy.getCollegeAdminToken() + .then(() => { + cy.getInstanceTypes({ limit: 1 }).then((instanceTypes) => { + testData.instanceTypeId = instanceTypes[0].id; + }); + cy.getHoldingTypes({ limit: 1 }).then((res) => { + testData.holdingTypeId = res[0].id; + }); + const collegeLocationData = Locations.getDefaultLocation({ + servicePointId: ServicePoints.getDefaultServicePoint().id, }).location; - - Locations.createViaApi(testData.location).then(() => { - InventoryHoldings.createHoldingRecordViaApi({ - instanceId: testData.instance.instanceId, - permanentLocationId: testData.location.id, - }).then(({ id: holdingId }) => { - testData.instance.holdingId = holdingId; - cy.getLoanTypes({ limit: 1 }).then((res) => { - testData.loanTypeId = res[0].id; - }); - cy.getMaterialTypes({ limit: 1 }).then((res) => { - testData.materialTypeId = res.id; - }); - InventoryItems.createItemViaApi({ - holdingsRecordId: holdingId, - materialType: { id: testData.materialTypeId }, + Locations.createViaApi(collegeLocationData).then((location) => { + testData.collegeLocation = location; + }); + cy.getLoanTypes({ limit: 1 }).then((res) => { + testData.loanTypeId = res[0].id; + }); + cy.getMaterialTypes({ limit: 1 }).then((res) => { + testData.materialTypeId = res.id; + }); + }) + .then(() => { + InventoryInstances.createFolioInstanceViaApi({ + instance: { + instanceTypeId: testData.instanceTypeId, + title: testData.instanceTitle, + }, + holdings: [ + { + holdingsTypeId: testData.holdingTypeId, + permanentLocationId: testData.collegeLocation.id, + }, + ], + items: [ + { + barcode: testData.itemBarcode, + status: { name: ITEM_STATUS_NAMES.AVAILABLE }, permanentLoanType: { id: testData.loanTypeId }, - status: { name: 'Available' }, - }).then((item) => { - testData.item = item; - }); - }); + materialType: { id: testData.materialTypeId }, + }, + ], + }).then((specialInstanceIds) => { + testData.testInstanceIds = specialInstanceIds; + + InventoryInstance.shareInstanceViaApi( + specialInstanceIds.instanceId, + testData.consortiaId, + Affiliations.College, + Affiliations.Consortia, + ); }); }); - InventoryInstance.shareInstanceViaApi( - testData.instance.instanceId, - testData.consortiaId, - Affiliations.College, - Affiliations.Consortia, - ); - }); - 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]); + + 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); - cy.deleteItemViaApi(testData.item.id); - InventoryHoldings.deleteHoldingRecordViaApi(testData.instance.holdingId); - Locations.deleteViaApi(testData.location); - ServicePoints.deleteViaApi(testData.servicePoint.id); - InventoryInstance.deleteInstanceViaApi(testData.instance.instanceId); - cy.resetTenant(); Users.deleteViaApi(testData.user.userId); + cy.setTenant(Affiliations.College); + InventoryInstances.deleteInstanceAndHoldingRecordAndAllItemsViaApi(testData.itemBarcode); + Locations.deleteViaApi(testData.collegeLocation); }); it( 'C411616 (CONSORTIA) Verify the Consortial holdings accordion details on shared Instance in 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.searchByTitle(testData.instanceTitle); InventoryInstances.selectInstance(); InventoryInstance.waitLoading(); - // InventoryInstance.verifyConsortiaHoldingsAccordion(false); - // InventoryInstance.expandConsortiaHoldings(); + InventoryInstance.verifyConsortiaHoldingsAccordion(false); + InventoryInstance.expandConsortiaHoldings(); + InventoryInstance.verifyMemberSubHoldingsAccordion(Affiliations.College); InventoryInstance.expandMemberSubHoldings(Affiliations.College); - InventoryInstance.expandMemberSubSubHoldings( - Affiliations.College, - testData.instance.holdingId, - ); + InventoryInstance.openHoldingsAccordion(testData.collegeLocation.name); + InventoryInstance.checkIsItemCreated(testData.itemBarcode); }, ); }); diff --git a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js index 280007db0e..32657166ea 100644 --- a/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js +++ b/cypress/e2e/consortia/inventory/instance/consortial-holdings-accordion-shadow-instance-member-tenant.cy.js @@ -29,38 +29,37 @@ describe('Inventory', () => { 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]); + + cy.login(testData.user.username, testData.user.password); + + ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.central); + ConsortiumManager.switchActiveAffiliation(tenantNames.central, tenantNames.college); + ConsortiumManager.checkCurrentTenantInTopMenu(tenantNames.college); }); }); after('Delete test data', () => { cy.resetTenant(); cy.getAdminToken(); + Users.deleteViaApi(testData.user.userId); cy.setTenant(Affiliations.College); InventoryInstance.deleteInstanceViaApi(testData.instance.instanceId); - cy.resetTenant(); - Users.deleteViaApi(testData.user.userId); }); it( 'C411615 (CONSORTIA) Verify the Consortial holdings accordion on shadow Instance in 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.searchByTitle(testData.instance.instanceId); InventoryInstances.selectInstance(); InventoryInstance.waitLoading(); - InventoryInstance.verifyConsortiaHoldingsAccordion(); }, ); From 5a87150f946056fb15e20c27ed930a17968fda45 Mon Sep 17 00:00:00 2001 From: Tetiana_Paranich Date: Tue, 14 May 2024 16:08:30 +0300 Subject: [PATCH 3/3] changed cypress config --- cypress.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress.config.js b/cypress.config.js index 398a97d9d5..ef8a0c90bf 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -22,9 +22,9 @@ module.exports = defineConfig({ pageLoadTimeout: 60000, downloadsFolder: 'cypress/downloads', env: { - OKAPI_HOST: 'https://folio-testing-sprint-okapi.ci.folio.org', - OKAPI_TENANT: 'cs00000int', - diku_login: 'ECSAdmin', + OKAPI_HOST: 'https://folio-testing-cypress-okapi.ci.folio.org', + OKAPI_TENANT: 'diku', + diku_login: 'diku_admin', diku_password: 'admin', is_kiwi_release: false, downloadTimeout: 2000, @@ -118,7 +118,7 @@ module.exports = defineConfig({ return result; }, - baseUrl: 'https://folio-testing-sprint-cs00000int.ci.folio.org', + baseUrl: 'https://folio-testing-cypress-diku.ci.folio.org', testIsolation: false, }, });