From 97fea9c970610f0338556743861c90bac79f0295 Mon Sep 17 00:00:00 2001 From: Ostap_Voitsekhovskyi Date: Mon, 18 Nov 2024 16:38:35 +0200 Subject: [PATCH] fixes for QG --- .../tags/filter-instances-by-tags.cy.js | 108 ++++++++------- .../invoices/invoices-manually-create.cy.js | 69 +++++----- .../marc-authority-import_3.cy.js | 127 ++++++++++-------- .../fragments/inventory/filterItems.js | 17 +-- .../fragments/inventory/inventoryInstance.js | 6 +- .../fragments/inventory/inventoryInstances.js | 55 ++++---- .../inventory/inventorySearchAndFilter.js | 25 ++-- 7 files changed, 224 insertions(+), 183 deletions(-) diff --git a/cypress/e2e/inventory/tags/filter-instances-by-tags.cy.js b/cypress/e2e/inventory/tags/filter-instances-by-tags.cy.js index 09c2a40336..24bf779f41 100644 --- a/cypress/e2e/inventory/tags/filter-instances-by-tags.cy.js +++ b/cypress/e2e/inventory/tags/filter-instances-by-tags.cy.js @@ -6,56 +6,68 @@ import TopMenu from '../../../support/fragments/topMenu'; import Users from '../../../support/fragments/users/users'; describe('Inventory', () => { - describe('Tags', () => { - let userId; - let instanceRecord = null; - const testTag = `test_tag_${uuid()}`; - const tagsCount = '1'; + describe( + 'Tags', + { + retries: { + runMode: 1, + }, + }, + () => { + let userId; + let instanceRecord = null; + let testTag; + const tagsCount = '1'; - beforeEach(() => { - cy.getAdminToken() - .then(() => { - InventoryInstance.createInstanceViaApi().then(({ instanceData }) => { - instanceRecord = instanceData; - }); - }) - .then(() => { - cy.createTempUser([ - permissions.inventoryAll.gui, - permissions.uiTagsPermissionAll.gui, - ]).then(({ username, password, userId: id }) => { - userId = id; - cy.login(username, password); + beforeEach(() => { + testTag = `test_tag_${uuid()}`; + cy.getAdminToken() + .then(() => { + InventoryInstance.createInstanceViaApi().then(({ instanceData }) => { + instanceRecord = instanceData; + }); + }) + .then(() => { + cy.createTempUser([ + permissions.inventoryAll.gui, + permissions.uiTagsPermissionAll.gui, + ]).then(({ username, password, userId: id }) => { + userId = id; + cy.login(username, password, { + path: TopMenu.inventoryPath, + waiter: InventorySearchAndFilter.waitLoading, + }); + }); }); - }); - }); + }); - afterEach(() => { - cy.getAdminToken(); - InventoryInstance.deleteInstanceViaApi(instanceRecord.instanceId); - Users.deleteViaApi(userId); - }); + afterEach(() => { + cy.getAdminToken(); + InventoryInstance.deleteInstanceViaApi(instanceRecord.instanceId); + Users.deleteViaApi(userId); + }); - it( - 'C343215 Filter instances by tags (volaris)', - { tags: ['smoke', 'volaris', 'shiftLeft', 'C343215'] }, - () => { - cy.visit(TopMenu.inventoryPath); - InventorySearchAndFilter.verifyPanesExist(); - InventorySearchAndFilter.searchInstanceByTitle(instanceRecord.instanceTitle); - InventorySearchAndFilter.verifySearchResult(instanceRecord.instanceTitle); - InventorySearchAndFilter.selectFoundInstance(instanceRecord.instanceTitle); - InventorySearchAndFilter.verifyInstanceDetailsView(); - InventorySearchAndFilter.openTagsField(); - InventorySearchAndFilter.verifyTagsView(); - InventorySearchAndFilter.addTag(testTag); - cy.reload(); - InventorySearchAndFilter.verifyTagCount(tagsCount); - InventorySearchAndFilter.closeInstanceDetailPane(); - InventorySearchAndFilter.resetAllAndVerifyNoResultsAppear(); - InventorySearchAndFilter.filterByTag(testTag); - InventorySearchAndFilter.verifyIsFilteredByTag(instanceRecord.instanceTitle); - }, - ); - }); + it( + 'C343215 Filter instances by tags (volaris)', + { tags: ['smoke', 'volaris', 'shiftLeft', 'C343215'] }, + () => { + InventorySearchAndFilter.verifyPanesExist(); + InventorySearchAndFilter.searchInstanceByTitle(instanceRecord.instanceTitle); + InventorySearchAndFilter.verifySearchResult(instanceRecord.instanceTitle); + InventorySearchAndFilter.selectFoundInstance(instanceRecord.instanceTitle); + InventorySearchAndFilter.verifyInstanceDetailsView(); + InventorySearchAndFilter.openTagsField(); + InventorySearchAndFilter.verifyTagsView(); + InventorySearchAndFilter.addTag(testTag); + cy.reload(); + cy.wait(5000); + InventorySearchAndFilter.verifyTagCount(tagsCount); + InventorySearchAndFilter.closeInstanceDetailPane(); + InventorySearchAndFilter.resetAllAndVerifyNoResultsAppear(); + InventorySearchAndFilter.filterByTag(testTag); + InventorySearchAndFilter.verifyIsFilteredByTag(instanceRecord.instanceTitle); + }, + ); + }, + ); }); diff --git a/cypress/e2e/invoices/invoices-manually-create.cy.js b/cypress/e2e/invoices/invoices-manually-create.cy.js index a25bce9d60..3e773337c9 100644 --- a/cypress/e2e/invoices/invoices-manually-create.cy.js +++ b/cypress/e2e/invoices/invoices-manually-create.cy.js @@ -4,36 +4,45 @@ import VendorAddress from '../../support/fragments/invoices/vendorAddress'; import Organizations from '../../support/fragments/organizations/organizations'; import TopMenu from '../../support/fragments/topMenu'; -describe('Invoices', () => { - const invoice = { ...NewInvoice.defaultUiInvoice }; - const vendorPrimaryAddress = { ...VendorAddress.vendorAddress }; +describe( + 'Invoices', + { + retries: { + runMode: 1, + }, + }, + () => { + let invoice; + let vendorPrimaryAddress; - before(() => { - cy.getAdminToken(); - Organizations.getOrganizationViaApi({ query: `name=${invoice.vendorName}` }).then( - (organization) => { - invoice.accountingCode = organization.erpCode; - Object.assign( - vendorPrimaryAddress, - organization.addresses.find((address) => address.isPrimary === true), - ); - }, - ); - cy.getBatchGroups().then((batchGroup) => { - invoice.batchGroup = batchGroup.name; + beforeEach(() => { + invoice = { ...NewInvoice.defaultUiInvoice }; + vendorPrimaryAddress = { ...VendorAddress.vendorAddress }; + cy.getAdminToken(); + Organizations.getOrganizationViaApi({ query: `name=${invoice.vendorName}` }).then( + (organization) => { + invoice.accountingCode = organization.erpCode; + Object.assign( + vendorPrimaryAddress, + organization.addresses.find((address) => address.isPrimary === true), + ); + }, + ); + cy.getBatchGroups().then((batchGroup) => { + invoice.batchGroup = batchGroup.name; + }); + cy.loginAsAdmin({ path: TopMenu.invoicesPath, waiter: Invoices.waitLoading }); }); - cy.loginAsAdmin(); - cy.visit(TopMenu.invoicesPath); - }); - it( - 'C2299 Manually Create Invoice (thunderjet)', - { tags: ['smoke', 'thunderjet', 'shiftLeft'] }, - () => { - Invoices.createDefaultInvoice(invoice, vendorPrimaryAddress); - Invoices.checkCreatedInvoice(invoice, vendorPrimaryAddress); - Invoices.deleteInvoiceViaActions(); - Invoices.confirmInvoiceDeletion(); - }, - ); -}); + it( + 'C2299 Manually Create Invoice (thunderjet)', + { tags: ['smoke', 'thunderjet', 'shiftLeft'] }, + () => { + Invoices.createDefaultInvoice(invoice, vendorPrimaryAddress); + Invoices.checkCreatedInvoice(invoice, vendorPrimaryAddress); + Invoices.deleteInvoiceViaActions(); + Invoices.confirmInvoiceDeletion(); + }, + ); + }, +); diff --git a/cypress/e2e/marc/marc-authority/browse-authority-records/marc-authority-import_3.cy.js b/cypress/e2e/marc/marc-authority/browse-authority-records/marc-authority-import_3.cy.js index bdfcd2ad8c..6e9244b01b 100644 --- a/cypress/e2e/marc/marc-authority/browse-authority-records/marc-authority-import_3.cy.js +++ b/cypress/e2e/marc/marc-authority/browse-authority-records/marc-authority-import_3.cy.js @@ -9,72 +9,81 @@ import getRandomPostfix from '../../../../support/utils/stringTools'; describe('MARC', () => { describe('MARC Authority', () => { - describe('Browse - Authority records', () => { - const testData = { - searchOptionPersonalName: 'Personal name', - searchOptionNameTitle: 'Name-title', - searchOptionKeyword: 'Keyword', - recordA: 'Angelou, Maya.', - recordB: 'Angelou, Maya. And still I rise', - recordBRef: 'Angelou, Maya. Still I rise', - authorized: 'Authorized', - reference: 'Reference', - recordWithoutTitle: 'Twain, Mark, 1835-1910', - }; - const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY; - const propertyName = 'authority'; - const fileName = `C360522 testMarcFile.${getRandomPostfix()}.mrc`; - const createdAuthorityIDs = []; + describe( + 'Browse - Authority records', + { + retries: { + runMode: 1, + }, + }, + () => { + const testData = { + searchOptionPersonalName: 'Personal name', + searchOptionNameTitle: 'Name-title', + searchOptionKeyword: 'Keyword', + recordA: 'Angelou, Maya.', + recordB: 'Angelou, Maya. And still I rise', + recordBRef: 'Angelou, Maya. Still I rise', + authorized: 'Authorized', + reference: 'Reference', + recordWithoutTitle: 'Twain, Mark, 1835-1910', + }; + const jobProfileToRun = DEFAULT_JOB_PROFILE_NAMES.CREATE_AUTHORITY; + const propertyName = 'authority'; + let fileName; + const createdAuthorityIDs = []; - before('Creating data', () => { - cy.createTempUser([ - Permissions.moduleDataImportEnabled.gui, - Permissions.uiMarcAuthoritiesAuthorityRecordView.gui, - ]).then((createdUserProperties) => { - testData.userProperties = createdUserProperties; + beforeEach('Creating data', () => { + fileName = `C360522 testMarcFile.${getRandomPostfix()}.mrc`; + cy.createTempUser([ + Permissions.moduleDataImportEnabled.gui, + Permissions.uiMarcAuthoritiesAuthorityRecordView.gui, + ]).then((createdUserProperties) => { + testData.userProperties = createdUserProperties; - cy.login(testData.userProperties.username, testData.userProperties.password, { - path: TopMenu.dataImportPath, - waiter: DataImport.waitLoading, + cy.login(testData.userProperties.username, testData.userProperties.password, { + path: TopMenu.dataImportPath, + waiter: DataImport.waitLoading, + }); }); }); - }); - after('Deleting data', () => { - cy.getAdminToken(); - Users.deleteViaApi(testData.userProperties.userId); - createdAuthorityIDs.forEach((id) => { - MarcAuthority.deleteViaAPI(id); + afterEach('Deleting data', () => { + cy.getAdminToken(); + Users.deleteViaApi(testData.userProperties.userId); + createdAuthorityIDs.forEach((id) => { + MarcAuthority.deleteViaAPI(id); + }); + createdAuthorityIDs.length = 0; }); - createdAuthorityIDs.length = 0; - }); - it( - 'C360522 Import of "MARC Authority" record with same valid prefixes in "001" and "010 $a" fields (spitfire)', - { tags: ['smoke', 'authority', 'spitfire', 'shiftLeft', 'C360522'] }, - () => { - DataImport.uploadFileViaApi( - 'D_genre(prefixes_in_001_010Sa)sc_03.mrc', - fileName, - jobProfileToRun, - ).then((response) => { - response.forEach((record) => { - createdAuthorityIDs.push(record[propertyName].id); + it( + 'C360522 Import of "MARC Authority" record with same valid prefixes in "001" and "010 $a" fields (spitfire)', + { tags: ['smoke', 'authority', 'spitfire', 'shiftLeft', 'C360522'] }, + () => { + DataImport.uploadFileViaApi( + 'D_genre(prefixes_in_001_010Sa)sc_03.mrc', + fileName, + jobProfileToRun, + ).then((response) => { + response.forEach((record) => { + createdAuthorityIDs.push(record[propertyName].id); + }); }); - }); - Logs.waitFileIsImported(fileName); - Logs.checkJobStatus(fileName, 'Completed'); - Logs.openFileDetails(fileName); - Logs.goToTitleLink('Case Reports'); - cy.wait(1000); - Logs.checkAuthorityLogJSON([ - '"sourceFileId":', - '"6ddf21a6-bc2f-4cb0-ad96-473e1f82da23"', - '"naturalId":', - '"D002363"', - ]); - }, - ); - }); + Logs.waitFileIsImported(fileName); + Logs.checkJobStatus(fileName, 'Completed'); + Logs.openFileDetails(fileName); + Logs.goToTitleLink('Case Reports'); + cy.wait(1000); + Logs.checkAuthorityLogJSON([ + '"sourceFileId":', + '"6ddf21a6-bc2f-4cb0-ad96-473e1f82da23"', + '"naturalId":', + '"D002363"', + ]); + }, + ); + }, + ); }); }); diff --git a/cypress/support/fragments/inventory/filterItems.js b/cypress/support/fragments/inventory/filterItems.js index 7814f2ff80..6886e52f69 100644 --- a/cypress/support/fragments/inventory/filterItems.js +++ b/cypress/support/fragments/inventory/filterItems.js @@ -1,10 +1,11 @@ +import { including } from '@interactors/html'; import { - Checkbox, - Button, Accordion, - MultiColumnListCell, + Button, MultiColumnList, - TextField, + MultiColumnListCell, + MultiSelect, + MultiSelectOption, } from '../../../../interactors'; import { ITEM_STATUS_NAMES } from '../../constants'; @@ -27,11 +28,11 @@ export default { ], toggleStatus(statusName) { - cy.do(TextField({ label: 'itemStatus-field' }).fillIn(statusName)); - // need to wait until status is uploaded + cy.wait(500); + cy.do(MultiSelect({ id: 'itemStatus-multiselect' }).toggle()); + cy.wait(500); + cy.do(MultiSelectOption(including(statusName)).click()); cy.wait(1500); - cy.do(TextField({ label: 'itemStatus-field' }).focus()); - cy.do(Checkbox(statusName).click()); }, toggleItemStatusAccordion() { diff --git a/cypress/support/fragments/inventory/inventoryInstance.js b/cypress/support/fragments/inventory/inventoryInstance.js index fdc22def19..ee367cc758 100644 --- a/cypress/support/fragments/inventory/inventoryInstance.js +++ b/cypress/support/fragments/inventory/inventoryInstance.js @@ -206,12 +206,14 @@ const openHoldings = (...holdingToBeOpened) => { }; const openItemByBarcode = (itemBarcode) => { + cy.wait(500); cy.do( instanceDetailsSection .find(MultiColumnListCell({ columnIndex: 0, content: itemBarcode })) .find(Button(including(itemBarcode))) .click(), ); + cy.wait(500); ItemRecordView.waitLoading(); }; @@ -1082,9 +1084,9 @@ export default { }, deleteTag: (tagName) => { - cy.do(MultiSelect().find(closeTag).click()); + cy.do(MultiSelect({ id: 'input-tag' }).find(closeTag).click()); cy.expect( - MultiSelect() + MultiSelect({ id: 'input-tag' }) .find(HTML(including(tagName))) .absent(), ); diff --git a/cypress/support/fragments/inventory/inventoryInstances.js b/cypress/support/fragments/inventory/inventoryInstances.js index 2307e8fe0c..e2e74759a6 100644 --- a/cypress/support/fragments/inventory/inventoryInstances.js +++ b/cypress/support/fragments/inventory/inventoryInstances.js @@ -1,36 +1,38 @@ /* eslint-disable cypress/no-unnecessary-waiting */ -import uuid from 'uuid'; import { HTML, including, matching } from '@interactors/html'; +import uuid from 'uuid'; import { - Section, - or, - MultiColumnList, + AdvancedSearch, + AdvancedSearchRow, Button, - Pane, - TextField, Checkbox, Modal, - Select, - TextInput, - TextArea, - PaneHeader, - PaneContent, + MultiColumnList, + MultiColumnListCell, MultiColumnListHeader, MultiColumnListRow, - AdvancedSearch, - AdvancedSearchRow, - MultiColumnListCell, + MultiSelect, + MultiSelectOption, + Pane, + PaneContent, + PaneHeader, + Section, + Select, + TextArea, + TextField, + TextInput, + or, } from '../../../../interactors'; +import { ITEM_STATUS_NAMES, LOCATION_NAMES, REQUEST_METHOD } from '../../constants'; +import Arrays from '../../utils/arrays'; +import FileManager from '../../utils/fileManager'; +import parseMrkFile from '../../utils/parseMrkFile'; +import getRandomPostfix from '../../utils/stringTools'; import CheckinActions from '../check-in-actions/checkInActions'; import InventoryHoldings from './holdings/inventoryHoldings'; -import InventoryNewInstance from './inventoryNewInstance'; import InventoryInstance from './inventoryInstance'; +import InventoryNewInstance from './inventoryNewInstance'; import InventoryItems from './item/inventoryItems'; -import Arrays from '../../utils/arrays'; -import { ITEM_STATUS_NAMES, LOCATION_NAMES, REQUEST_METHOD } from '../../constants'; -import getRandomPostfix from '../../utils/stringTools'; -import parseMrkFile from '../../utils/parseMrkFile'; -import FileManager from '../../utils/fileManager'; const rootSection = Section({ id: 'pane-results' }); const resultsPaneHeader = PaneHeader({ id: 'paneHeaderpane-results' }); @@ -362,14 +364,13 @@ export default { cy.do(Button({ id: 'accordion-toggle-button-instancesTags' }).click()); // wait for data to be loaded cy.intercept('/search/instances/facets?facet=instanceTags**').as('getTags'); - cy.do(Section({ id: 'instancesTags' }).find(TextField()).click()); - cy.do(Section({ id: 'instancesTags' }).find(TextField()).fillIn(tagName)); cy.wait('@getTags'); - // TODO: clarify with developers what should be waited - cy.wait(1500); - cy.do(Section({ id: 'instancesTags' }).find(TextField()).focus()); - cy.do(Section({ id: 'instancesTags' }).find(TextField()).click()); - cy.do(Checkbox(tagName).click()); + + cy.wait(500); + cy.do(MultiSelect({ id: 'instancesTags-multiselect' }).toggle()); + cy.wait(500); + cy.do(MultiSelectOption(including(tagName)).click()); + cy.wait(500); }, searchAndVerify(value) { diff --git a/cypress/support/fragments/inventory/inventorySearchAndFilter.js b/cypress/support/fragments/inventory/inventorySearchAndFilter.js index 46787b8c5c..dd157bdf19 100644 --- a/cypress/support/fragments/inventory/inventorySearchAndFilter.js +++ b/cypress/support/fragments/inventory/inventorySearchAndFilter.js @@ -111,7 +111,10 @@ const searchHoldingsByHRID = (hrid) => { }; const searchInstanceByTitle = (title) => { - cy.do([TextArea({ id: 'input-inventory-search' }).fillIn(title), searchButton.click()]); + cy.do(TextArea({ id: 'input-inventory-search' }).fillIn(title)); + cy.wait(500); + cy.do(searchButton.click()); + cy.wait(500); InventoryInstance.waitInventoryLoading(); }; @@ -654,13 +657,18 @@ export default { }, searchTag(tag) { + cy.wait(500); cy.do([tagsAccordionButton.click(), instancesTagsSection.find(TextField()).fillIn(tag)]); }, filterByTag(tag) { - this.searchTag(tag); - cy.do(instancesTagsSection.find(Checkbox(tag)).click()); - cy.wait(1000); + cy.wait(500); + cy.do(tagsAccordionButton.click()); + cy.wait(500); + cy.do(MultiSelect({ id: 'instancesTags-multiselect' }).toggle()); + cy.wait(500); + cy.do(MultiSelectOption(including(tag)).click()); + cy.wait(500); }, verifyTagIsAbsent(tag) { @@ -705,12 +713,11 @@ export default { addTag(tag) { cy.intercept('PUT', '**/inventory/instances/**').as('addTag'); - cy.do([ - MultiSelect({ id: 'input-tag' }).fillIn(tag), - MultiSelect().open(), - MultiSelectOption(including(tag)).click(), - ]); + cy.do(MultiSelect({ id: 'input-tag' }).fillIn(tag)); + cy.wait(500); + cy.do(MultiSelectOption(including(tag)).click()); cy.wait('@addTag'); + cy.wait(500); }, verifyTagsView() {