From b5b5f56fdd0b6a4752a5d859e86f95f95ffb0b50 Mon Sep 17 00:00:00 2001 From: bohdanihor Date: Tue, 16 Apr 2024 19:54:49 +0300 Subject: [PATCH 1/4] Fix extended tests Thunderjet --- ...g-by-export-method-does-not-reset-search-results.cy.js | 3 +++ .../e2e/orders/verify-orders-numbers-is-hyperlink.cy.js | 4 +++- .../inventory/browse-call-numbers-and-subjects.cy.js | 2 +- .../export/export-results-to-csv-from-receiving.cy.js | 8 ++++++++ cypress/support/fragments/finance/funds/funds.js | 2 +- .../fragments/inventory/inventorySearchAndFilter.js | 7 +++++-- cypress/support/fragments/orders/orderLines.js | 5 +---- cypress/support/fragments/orders/orders.js | 1 + 8 files changed, 23 insertions(+), 9 deletions(-) diff --git a/cypress/e2e/export-manager/export-orders-in-edifact-format/sorting-by-export-method-does-not-reset-search-results.cy.js b/cypress/e2e/export-manager/export-orders-in-edifact-format/sorting-by-export-method-does-not-reset-search-results.cy.js index a76b8c6fd9..05ee70c792 100644 --- a/cypress/e2e/export-manager/export-orders-in-edifact-format/sorting-by-export-method-does-not-reset-search-results.cy.js +++ b/cypress/e2e/export-manager/export-orders-in-edifact-format/sorting-by-export-method-does-not-reset-search-results.cy.js @@ -179,6 +179,9 @@ describe('orders: export', () => { ExportManagerSearchPane.sortByJobID(); ExportManagerSearchPane.selectJobByIntegrationInList(integrationNameForFirstOrganization); ExportManagerSearchPane.resetAll(); + ExportManagerSearchPane.searchBySuccessful(); + ExportManagerSearchPane.searchByFailed(); + ExportManagerSearchPane.sortByJobID(); ExportManagerSearchPane.selectJobByIntegrationInList(integrationNameForSecondOrganization); }, ); diff --git a/cypress/e2e/orders/verify-orders-numbers-is-hyperlink.cy.js b/cypress/e2e/orders/verify-orders-numbers-is-hyperlink.cy.js index f9245ca753..d63342f13f 100644 --- a/cypress/e2e/orders/verify-orders-numbers-is-hyperlink.cy.js +++ b/cypress/e2e/orders/verify-orders-numbers-is-hyperlink.cy.js @@ -73,7 +73,7 @@ describe('Orders', () => { 'C369087 - Orders| Results List | Verify that value in "PO number" and "POL number" columns are hyperlinks (thunderjet) (TaaS)', { tags: ['extendedPath', 'thunderjet'] }, () => { - Orders.selectStatusInSearch(ORDER_STATUSES.PENDING); + Orders.selectPendingStatusFilter(); Orders.waitLoading(); [...Array(ordersCount).keys()].forEach((index) => { const title = testData.orders[index].poNumber; @@ -82,6 +82,7 @@ describe('Orders', () => { Orders.selectFromResultsList(title); OrderDetails.verifyOrderTitle(`Purchase order - ${title}`); }); + Orders.resetFilters(); Orders.selectOrderLines(); OrderLines.verifyNoResultsMessage(); @@ -94,6 +95,7 @@ describe('Orders', () => { OrderLines.selectOrderline(title); OrderLines.verifyOrderTitlePOL(`PO Line details - ${title}`); }); + Orders.resetFilters(); }, ); }); diff --git a/cypress/e2e/permissions/inventory/browse-call-numbers-and-subjects.cy.js b/cypress/e2e/permissions/inventory/browse-call-numbers-and-subjects.cy.js index 132564224b..a0a17f839a 100644 --- a/cypress/e2e/permissions/inventory/browse-call-numbers-and-subjects.cy.js +++ b/cypress/e2e/permissions/inventory/browse-call-numbers-and-subjects.cy.js @@ -57,7 +57,7 @@ describe('Permisions -> Inventory', () => { InventorySearchAndFilter.browseSearch('K1'); InventorySearchAndFilter.verifySearchAndResetAllButtonsDisabled(false); InventorySearchAndFilter.verifyBrowseInventorySearchResults(); - + InventorySearchAndFilter.resetAll(); InventorySearchAndFilter.selectBrowseSubjects(); InventorySearchAndFilter.verifySearchAndResetAllButtonsDisabled(true); InventorySearchAndFilter.browseSearch('art'); diff --git a/cypress/e2e/receiving/export/export-results-to-csv-from-receiving.cy.js b/cypress/e2e/receiving/export/export-results-to-csv-from-receiving.cy.js index 15dc3ebd6a..30cf99095a 100644 --- a/cypress/e2e/receiving/export/export-results-to-csv-from-receiving.cy.js +++ b/cypress/e2e/receiving/export/export-results-to-csv-from-receiving.cy.js @@ -68,6 +68,10 @@ describe('Receiving', () => { 'Vendor', 'Requester', 'Rush', + 'Created by', + 'Date created', + 'Updated by', + 'Date updated', ]; const pieceFields = [ 'Display summary', @@ -86,6 +90,10 @@ describe('Receiving', () => { 'Receiving status', 'Internal note', 'External note', + 'Created by (Piece)', + 'Date created (Piece)', + 'Updated by (Piece)', + 'Date updated (Piece)', ]; before('Create test order', () => { diff --git a/cypress/support/fragments/finance/funds/funds.js b/cypress/support/fragments/finance/funds/funds.js index 03bd58c689..aaf25ab552 100644 --- a/cypress/support/fragments/finance/funds/funds.js +++ b/cypress/support/fragments/finance/funds/funds.js @@ -280,7 +280,7 @@ export default { ]); // eslint-disable-next-line cypress/no-unnecessary-waiting cy.wait(4000); - cy.do([Button('Save').click()]); + cy.do([saveAndClose.click()]); }, addPlannedBudgetWithoutFY: (allocatedQuantity) => { diff --git a/cypress/support/fragments/inventory/inventorySearchAndFilter.js b/cypress/support/fragments/inventory/inventorySearchAndFilter.js index 0e4094e2fc..3577ca0018 100644 --- a/cypress/support/fragments/inventory/inventorySearchAndFilter.js +++ b/cypress/support/fragments/inventory/inventorySearchAndFilter.js @@ -574,7 +574,7 @@ export default { }, resetAll() { - cy.do(resetAllButton.click()); + cy.do(resetAllBtn.click()); }, clickResetAllButton() { @@ -798,7 +798,10 @@ export default { }, verifySearchAndResetAllButtonsDisabled(state) { - cy.expect([searchButton.has({ disabled: state }), resetAllBtn.has({ disabled: state })]); + cy.expect([ + Section({ id: 'browse-inventory-filters-pane' }).find(searchButton).has({ disabled: state }), + Section({ id: 'browse-inventory-filters-pane' }).find(resetAllBtn).has({ disabled: state }), + ]); }, verifyNoRecordsFound() { diff --git a/cypress/support/fragments/orders/orderLines.js b/cypress/support/fragments/orders/orderLines.js index c2930da44f..0b03390711 100644 --- a/cypress/support/fragments/orders/orderLines.js +++ b/cypress/support/fragments/orders/orderLines.js @@ -778,13 +778,10 @@ export default { submitOrderLine(); }, - addReveivingNoteToItemDetailsAndSave(orderNumber) { + addReveivingNoteToItemDetailsAndSave() { cy.do([TextArea('Receiving note').fillIn(note), saveAndCloseButton.click()]); cy.wait(4000); submitOrderLine(); - InteractorsTools.checkCalloutMessage( - `The purchase order line ${orderNumber}-1 was successfully updated`, - ); }, rolloverPOLineInfoforPhysicalMaterialWith2Funds( diff --git a/cypress/support/fragments/orders/orders.js b/cypress/support/fragments/orders/orders.js index f565c7e0b2..4cd11f02bd 100644 --- a/cypress/support/fragments/orders/orders.js +++ b/cypress/support/fragments/orders/orders.js @@ -739,6 +739,7 @@ export default { }, selectPendingStatusFilter: () => { + cy.wait(4000); cy.do(Checkbox({ id: 'clickable-filter-workflowStatus-pending' }).click()); }, From e9f23bb7adda0f4cfa079095ffa2c4fa5536f953 Mon Sep 17 00:00:00 2001 From: bohdanihor Date: Wed, 1 May 2024 10:26:14 +0300 Subject: [PATCH 2/4] Rewrite big UI methods into one API --- ...get-summary-and-encumbrances-updated.cy.js | 203 +++++++++++------- .../fragments/orders/basicOrderLine.js | 2 +- 2 files changed, 130 insertions(+), 75 deletions(-) diff --git a/cypress/e2e/finance/fiscalYears/fiscalYearRollover/budget-summary-and-encumbrances-updated.cy.js b/cypress/e2e/finance/fiscalYears/fiscalYearRollover/budget-summary-and-encumbrances-updated.cy.js index 167229c87f..cf8a3ff521 100644 --- a/cypress/e2e/finance/fiscalYears/fiscalYearRollover/budget-summary-and-encumbrances-updated.cy.js +++ b/cypress/e2e/finance/fiscalYears/fiscalYearRollover/budget-summary-and-encumbrances-updated.cy.js @@ -12,10 +12,17 @@ import Orders from '../../../../support/fragments/orders/orders'; import OrderLines from '../../../../support/fragments/orders/orderLines'; import Organizations from '../../../../support/fragments/organizations/organizations'; import NewOrganization from '../../../../support/fragments/organizations/newOrganization'; -import NewInvoice from '../../../../support/fragments/invoices/newInvoice'; import Invoices from '../../../../support/fragments/invoices/invoices'; import ServicePoints from '../../../../support/fragments/settings/tenant/servicePoints/servicePoints'; import NewLocation from '../../../../support/fragments/settings/tenant/locations/newLocation'; +import Budgets from '../../../../support/fragments/finance/budgets/budgets'; +import { + ACQUISITION_METHOD_NAMES_IN_PROFILE, + INVOICE_STATUSES, + ORDER_STATUSES, +} from '../../../../support/constants'; +import basicOrderLine from '../../../../support/fragments/orders/basicOrderLine'; +import MaterialTypes from '../../../../support/fragments/settings/inventory/materialTypes'; describe('ui-finance: Fiscal Year Rollover', () => { const firstFiscalYear = { ...FiscalYears.defaultUiFiscalYear }; @@ -37,7 +44,7 @@ describe('ui-finance: Fiscal Year Rollover', () => { description: `This is fund created by E2E test automation script_${getRandomPostfix()}`, }; const firstOrder = { - ...NewOrder.defaultOneTimeOrder, + ...NewOrder.getDefaultOngoingOrder, orderType: 'Ongoing', ongoing: { isSubscription: false, manualRenewal: false }, approved: true, @@ -48,25 +55,34 @@ describe('ui-finance: Fiscal Year Rollover', () => { reEncumber: true, }; const organization = { ...NewOrganization.defaultUiOrganizations }; - const invoice = { ...NewInvoice.defaultUiInvoice }; - const allocatedQuantity = '200'; const periodStartForFirstFY = DateTools.getThreePreviousDaysDateForFiscalYearOnUIEdit(); const periodEndForFirstFY = DateTools.getTwoPreviousDaysDateForFiscalYearOnUIEdit(); const periodStartForSecondFY = DateTools.getPreviousDayDateForFiscalYearOnUIEdit(); const periodEndForSecondFY = DateTools.getDayTomorrowDateForFiscalYearOnUIEdit(); firstFiscalYear.code = firstFiscalYear.code.slice(0, -1) + '1'; + let firstInvoice; let user; let firstOrderNumber; let secondOrderNumber; let servicePointId; let location; + const firstBudget = { + ...Budgets.getDefaultBudget(), + allocated: 200, + }; + const secondBudget = { + ...Budgets.getDefaultBudget(), + allocated: 200, + }; before(() => { cy.getAdminToken(); // create first Fiscal Year and prepere 2 Funds for Rollover FiscalYears.createViaApi(firstFiscalYear).then((firstFiscalYearResponse) => { firstFiscalYear.id = firstFiscalYearResponse.id; + firstBudget.fiscalYearId = firstFiscalYearResponse.id; + secondBudget.fiscalYearId = firstFiscalYearResponse.id; defaultLedger.fiscalYearOneId = firstFiscalYear.id; secondFiscalYear.code = firstFiscalYear.code.slice(0, -1) + '2'; Ledgers.createViaApi(defaultLedger).then((ledgerResponse) => { @@ -76,83 +92,122 @@ describe('ui-finance: Fiscal Year Rollover', () => { Funds.createViaApi(firstFund).then((fundResponse) => { firstFund.id = fundResponse.fund.id; + firstBudget.fundId = fundResponse.fund.id; + Budgets.createViaApi(firstBudget); - cy.loginAsAdmin({ path: TopMenu.fundPath, waiter: Funds.waitLoading }); - FinanceHelp.searchByName(firstFund.name); - Funds.selectFund(firstFund.name); - Funds.addBudget(allocatedQuantity); - }); + Funds.createViaApi(secondFund).then((secondFundResponse) => { + secondFund.id = secondFundResponse.fund.id; + secondBudget.fundId = secondFundResponse.fund.id; + Budgets.createViaApi(secondBudget); + + // Create second Fiscal Year for Rollover + FiscalYears.createViaApi(secondFiscalYear).then((secondFiscalYearResponse) => { + secondFiscalYear.id = secondFiscalYearResponse.id; + }); + ServicePoints.getViaApi().then((servicePoint) => { + servicePointId = servicePoint[0].id; + NewLocation.createViaApi(NewLocation.getDefaultLocation(servicePointId)).then( + (res) => { + location = res; - Funds.createViaApi(secondFund).then((secondFundResponse) => { - secondFund.id = secondFundResponse.fund.id; + MaterialTypes.createMaterialTypeViaApi( + MaterialTypes.getDefaultMaterialType(), + ).then((mtypes) => { + cy.getAcquisitionMethodsApi({ + query: `value="${ACQUISITION_METHOD_NAMES_IN_PROFILE.PURCHASE_AT_VENDOR_SYSTEM}"`, + }).then((params) => { + // Prepare 2 Open Orders for Rollover + Organizations.createOrganizationViaApi(organization).then( + (responseOrganizations) => { + organization.id = responseOrganizations; + secondOrder.orderType = 'One-time'; + secondOrder.vendor = organization.name; + firstOrder.vendor = organization.id; + const firstOrderLine = { + ...basicOrderLine.defaultOrderLine, + cost: { + listUnitPrice: 100.0, + currency: 'USD', + discountType: 'percentage', + quantityPhysical: 1, + poLineEstimatedPrice: 100.0, + }, + fundDistribution: [ + { code: firstFund.code, fundId: firstFund.id, value: 100 }, + ], + locations: [ + { locationId: location.id, quantity: 1, quantityPhysical: 1 }, + ], + acquisitionMethod: params.body.acquisitionMethods[0].id, + physical: { + createInventory: 'Instance, Holding, Item', + materialType: mtypes.body.id, + materialSupplier: responseOrganizations, + volumes: [], + }, + }; + cy.loginAsAdmin({ path: TopMenu.ordersPath, waiter: Orders.waitLoading }); + Orders.createOrderViaApi(firstOrder).then((firstOrderResponse) => { + firstOrder.id = firstOrderResponse.id; + firstOrderNumber = firstOrderResponse.poNumber; + firstOrderLine.purchaseOrderId = firstOrderResponse.id; - cy.visit(TopMenu.fundPath); - FinanceHelp.searchByName(secondFund.name); - Funds.selectFund(secondFund.name); - Funds.addBudget(allocatedQuantity); + OrderLines.createOrderLineViaApi(firstOrderLine); + Orders.updateOrderViaApi({ + ...firstOrderResponse, + workflowStatus: ORDER_STATUSES.OPEN, + }); + + Orders.searchByParameter('PO number', firstOrderNumber); + Orders.selectFromResultsList(firstOrderNumber); + Invoices.createInvoiceWithInvoiceLineViaApi({ + vendorId: organization.id, + fiscalYearId: firstFiscalYear.id, + poLineId: firstOrderLine.id, + fundDistributions: firstOrderLine.fundDistribution, + accountingCode: organization.erpCode, + releaseEncumbrance: true, + subTotal: 100, + }).then((invoiceRescponse) => { + firstInvoice = invoiceRescponse; + + Invoices.changeInvoiceStatusViaApi({ + invoice: firstInvoice, + status: INVOICE_STATUSES.PAID, + }); + }); + }); + cy.visit(TopMenu.ordersPath); + Orders.createApprovedOrderForRollover(secondOrder, true).then( + (secondOrderResponse) => { + secondOrder.id = secondOrderResponse.id; + secondOrderNumber = secondOrderResponse.poNumber; + Orders.checkCreatedOrder(secondOrder); + OrderLines.addPOLine(); + OrderLines.selectRandomInstanceInTitleLookUP('*', 35); + OrderLines.rolloverPOLineInfoforPhysicalMaterialWithFund( + firstFund, + '10', + '1', + '10', + location.name, + ); + OrderLines.backToEditingOrder(); + Orders.openOrder(); + }, + ); + }, + ); + }); + }); + }, + ); + }); + }); }); }); }); - // Create second Fiscal Year for Rollover - FiscalYears.createViaApi(secondFiscalYear).then((secondFiscalYearResponse) => { - secondFiscalYear.id = secondFiscalYearResponse.id; - }); - ServicePoints.getViaApi().then((servicePoint) => { - servicePointId = servicePoint[0].id; - NewLocation.createViaApi(NewLocation.getDefaultLocation(servicePointId)).then((res) => { - location = res; - }); - }); - // Prepare 2 Open Orders for Rollover - Organizations.createOrganizationViaApi(organization).then((responseOrganizations) => { - organization.id = responseOrganizations; - invoice.accountingCode = organization.erpCode; - secondOrder.orderType = 'One-time'; - }); - secondOrder.vendor = organization.name; - firstOrder.vendor = organization.name; - cy.visit(TopMenu.ordersPath); - Orders.createApprovedOrderForRollover(firstOrder, true).then((firstOrderResponse) => { - firstOrder.id = firstOrderResponse.id; - firstOrderNumber = firstOrderResponse.poNumber; - Orders.checkCreatedOrder(firstOrder); - OrderLines.addPOLine(); - OrderLines.selectRandomInstanceInTitleLookUP('*', 25); - OrderLines.rolloverPOLineInfoforPhysicalMaterialWithFund( - firstFund, - '100', - '1', - '100', - location.name, - ); - OrderLines.backToEditingOrder(); - Orders.openOrder(); - cy.visit(TopMenu.invoicesPath); - Invoices.createRolloverInvoice(invoice, organization.name); - Invoices.createInvoiceLineFromPol(firstOrderNumber); - // Need to wait, while data will be loaded - cy.wait(4000); - Invoices.approveInvoice(); - Invoices.payInvoice(); - cy.visit(TopMenu.ordersPath); - Orders.createApprovedOrderForRollover(secondOrder, true).then((secondOrderResponse) => { - secondOrder.id = secondOrderResponse.id; - secondOrderNumber = secondOrderResponse.poNumber; - Orders.checkCreatedOrder(secondOrder); - OrderLines.addPOLine(); - OrderLines.selectRandomInstanceInTitleLookUP('*', 35); - OrderLines.rolloverPOLineInfoforPhysicalMaterialWithFund( - firstFund, - '10', - '1', - '10', - location.name, - ); - OrderLines.backToEditingOrder(); - Orders.openOrder(); - }); - }); cy.createTempUser([ permissions.uiFinanceExecuteFiscalYearRollover.gui, permissions.uiFinanceViewEditFiscalYear.gui, diff --git a/cypress/support/fragments/orders/basicOrderLine.js b/cypress/support/fragments/orders/basicOrderLine.js index e07e6227a4..e668c85daa 100644 --- a/cypress/support/fragments/orders/basicOrderLine.js +++ b/cypress/support/fragments/orders/basicOrderLine.js @@ -148,7 +148,7 @@ export default { activated: false, createInventory: 'None', trial: false, - accessProvider: '', + accessProvider: null, }, purchaseOrderId: '', receiptStatus: 'Pending', From a8a0bc202475637873ab8cf7628cb84b63122c10 Mon Sep 17 00:00:00 2001 From: IhorBohdan Date: Fri, 23 Aug 2024 09:26:41 +0300 Subject: [PATCH 3/4] Update tests after UIF-540 --- ...ed-correctly-when-approved-credit-invoice-exists.cy.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cypress/e2e/finance/transactions/restricted-expenditures-are-calculated-correctly-when-approved-credit-invoice-exists.cy.js b/cypress/e2e/finance/transactions/restricted-expenditures-are-calculated-correctly-when-approved-credit-invoice-exists.cy.js index aca5a1852f..71e53b54a7 100644 --- a/cypress/e2e/finance/transactions/restricted-expenditures-are-calculated-correctly-when-approved-credit-invoice-exists.cy.js +++ b/cypress/e2e/finance/transactions/restricted-expenditures-are-calculated-correctly-when-approved-credit-invoice-exists.cy.js @@ -25,6 +25,7 @@ import FinanceHelp from '../../../support/fragments/finance/financeHelper'; import BudgetDetails from '../../../support/fragments/finance/budgets/budgetDetails'; import InvoiceLineDetails from '../../../support/fragments/invoices/invoiceLineDetails'; import InteractorsTools from '../../../support/utils/interactorsTools'; +import Approvals from '../../../support/fragments/settings/invoices/approvals'; describe('Finance: Transactions', () => { const defaultFiscalYear = { ...FiscalYears.defaultUiFiscalYear }; @@ -76,12 +77,18 @@ describe('Finance: Transactions', () => { allowableExpenditure: 100, }; const organization = { ...NewOrganization.defaultUiOrganizations }; + const isApprovePayEnabled = false; let firstInvoice; let secondInvoice; let thirdInvoice; let user; let servicePointId; let location; + const setApprovePayValue = (isEnabled = false) => { + cy.getAdminToken().then(() => { + Approvals.setApprovePayValue(isEnabled); + }); + }; before(() => { cy.getAdminToken(); @@ -236,6 +243,7 @@ describe('Finance: Transactions', () => { path: TopMenu.invoicesPath, waiter: Invoices.waitLoading, }); + setApprovePayValue(isApprovePayEnabled); }); }); From 6985fb406e8e5a660d56dab09857c44d9e88901d Mon Sep 17 00:00:00 2001 From: IhorBohdan Date: Tue, 17 Sep 2024 13:51:04 +0300 Subject: [PATCH 4/4] izmeneniya --- cypress/e2e/finance/funds/funds.deleteBudgetWithTransfer.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/finance/funds/funds.deleteBudgetWithTransfer.cy.js b/cypress/e2e/finance/funds/funds.deleteBudgetWithTransfer.cy.js index 0f6ae20a94..3a315f231a 100644 --- a/cypress/e2e/finance/funds/funds.deleteBudgetWithTransfer.cy.js +++ b/cypress/e2e/finance/funds/funds.deleteBudgetWithTransfer.cy.js @@ -19,7 +19,7 @@ describe('ui-finance: Funds', () => { const budgetCanNotBeDeletedMessage = 'Budget can not be deleted, because it has transactions'; Funds.createFundViaUI(fundFrom); // create second fund - fundTo.name = 'to_' + fundTo.name; + // fundTo.name = 'to_' + fundTo.name; fundTo.code = 'to_' + fundTo.code; fundTo.externalAccount = 'to_' + fundTo.externalAccount; Funds.createFundViaUI(fundTo);