From b5b5f56fdd0b6a4752a5d859e86f95f95ffb0b50 Mon Sep 17 00:00:00 2001 From: bohdanihor Date: Tue, 16 Apr 2024 19:54:49 +0300 Subject: [PATCH 1/6] 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/6] 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/6] 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 a356c7267c842515dc6c2980f9877687d9e2c1b0 Mon Sep 17 00:00:00 2001 From: IhorBohdan Date: Fri, 27 Sep 2024 18:02:17 +0300 Subject: [PATCH 4/6] Fix Visit Methods --- ...-in-current-FY-for-previous-FY-order.cy.js | 23 +++++++++++-------- ...ceiving-pieces-from-order-for-PE-mix.cy.js | 14 +---------- ...e-in-received-status-when-edit-piece.cy.js | 7 ++++-- .../e2e/settings/orders/adjust-instance.cy.js | 17 +++++++++----- .../finance/transactions/transactions.js | 3 +++ cypress/support/fragments/settingsMenu.js | 6 +++++ .../support/fragments/topMenuNavigation.js | 2 +- 7 files changed, 40 insertions(+), 32 deletions(-) diff --git a/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js b/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js index 3e2169fdf9..7fe3999027 100644 --- a/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js +++ b/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js @@ -15,6 +15,7 @@ import TopMenu from '../../support/fragments/topMenu'; import Users from '../../support/fragments/users/users'; import DateTools from '../../support/utils/dateTools'; import getRandomPostfix from '../../support/utils/stringTools'; +import TopMenuNavigation from '../../support/fragments/topMenuNavigation'; describe('Invoices', () => { const firstFiscalYear = { ...FiscalYears.defaultUiFiscalYear }; @@ -67,9 +68,10 @@ describe('Invoices', () => { let user; before(() => { - cy.getAdminToken(); - cy.loginAsAdmin(); - cy.visit(SettingsMenu.expenseClassesPath); + cy.loginAsAdmin({ + path: SettingsMenu.expenseClassesPath, + waiter: SettingsFinance.waitExpenseClassesLoading, + }); SettingsFinance.createNewExpenseClass(firstExpenseClass); FiscalYears.createViaApi(firstFiscalYear).then((firstFiscalYearResponse) => { firstFiscalYear.id = firstFiscalYearResponse.id; @@ -110,9 +112,10 @@ describe('Invoices', () => { Funds.addBudget(allocatedQuantity); Funds.editBudget(); Funds.addExpensesClass(firstExpenseClass.name); + Funds.closeBudgetDetails(); }); - cy.visit(TopMenu.ledgerPath); + FinanceHelp.selectLedgersNavigation(); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -121,7 +124,7 @@ describe('Invoices', () => { 'None', 'Allocation', ); - cy.visit(TopMenu.fiscalYearPath); + FinanceHelp.selectFiscalYearsNavigation(); FinanceHelp.searchByName(firstFiscalYear.name); FiscalYears.selectFY(firstFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -136,7 +139,7 @@ describe('Invoices', () => { periodStartForSecondFY, periodEndForSecondFY, ); - cy.visit(TopMenu.ledgerPath); + FinanceHelp.selectLedgersNavigation(); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -146,7 +149,7 @@ describe('Invoices', () => { 'Allocation', ); - cy.visit(TopMenu.fiscalYearPath); + FinanceHelp.selectFiscalYearsNavigation(); FinanceHelp.searchByName(secondFiscalYear.name); FiscalYears.selectFY(secondFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -161,7 +164,7 @@ describe('Invoices', () => { periodStartForSecondFY, periodEndForSecondFY, ); - cy.visit(TopMenu.ledgerPath); + FinanceHelp.selectLedgersNavigation(); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -171,7 +174,7 @@ describe('Invoices', () => { 'Allocation', ); - cy.visit(TopMenu.fiscalYearPath); + FinanceHelp.selectFiscalYearsNavigation(); FinanceHelp.searchByName(thirdFiscalYear.name); FiscalYears.selectFY(thirdFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -226,7 +229,7 @@ describe('Invoices', () => { Organizations.editOrganization(); Organizations.changeOrganizationStatus(organization.status); - cy.visit(TopMenu.invoicesPath); + TopMenuNavigation.navigateToApp('Invoices'); Invoices.searchByNumber(invoice.invoiceNumber); Invoices.selectInvoice(invoice.invoiceNumber); Invoices.approveInvoice(); diff --git a/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js b/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js index 3d1cf42778..d6d4bb7317 100644 --- a/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js +++ b/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js @@ -94,19 +94,7 @@ describe('Orders', () => { }); after(() => { - cy.loginAsAdmin({ path: TopMenu.receivingPath, waiter: Receiving.waitLoading }); - Orders.searchByParameter('PO number', orderNumber); - Receiving.selectLinkFromResultsList(); - Receiving.unreceiveFromReceivedSection(); - cy.visit(TopMenu.ordersPath); - Orders.searchByParameter('PO number', orderNumber); - Orders.selectFromResultsList(orderNumber); - Orders.unOpenOrder(); - OrderLines.selectPOLInOrder(0); - OrderLines.deleteOrderLine(); - // Need to wait until the order is opened before deleting it - cy.wait(2000); - Orders.deleteOrderViaApi(order.id); + cy.getAdminToken(); Users.deleteViaApi(user.userId); }); diff --git a/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js b/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js index ddc5fb2d68..162f4ca8de 100644 --- a/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js +++ b/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js @@ -14,6 +14,7 @@ import TopMenu from '../../support/fragments/topMenu'; import Users from '../../support/fragments/users/users'; import InteractorsTools from '../../support/utils/interactorsTools'; import Receiving from '../../support/fragments/receiving/receiving'; +import TopMenuNavigation from '../../support/fragments/topMenuNavigation'; describe('Orders: Inventory interaction', () => { const defaultFiscalYear = { ...FiscalYears.defaultRolloverFiscalYear }; @@ -64,7 +65,8 @@ describe('Orders: Inventory interaction', () => { organization.id = responseOrganizations; }); firstOrder.vendor = organization.name; - cy.visit(TopMenu.ordersPath); + TopMenuNavigation.openAppFromDropdown('Orders'); + Orders.selectOrders(); Orders.createApprovedOrderForRollover(firstOrder, true).then((firstOrderResponse) => { firstOrder.id = firstOrderResponse.id; orderNumber = firstOrderResponse.poNumber; @@ -109,7 +111,8 @@ describe('Orders: Inventory interaction', () => { Orders.deleteOrderViaApi(firstOrder.id); Organizations.deleteOrganizationViaApi(organization.id); - cy.visit(TopMenu.fundPath); + TopMenuNavigation.openAppFromDropdown('Finance'); + FinanceHelp.selectFundsNavigation(); FinanceHelp.searchByName(defaultFund.name); Funds.selectFund(defaultFund.name); Funds.selectBudgetDetails(); diff --git a/cypress/e2e/settings/orders/adjust-instance.cy.js b/cypress/e2e/settings/orders/adjust-instance.cy.js index b69286acfd..a6b4db92fc 100644 --- a/cypress/e2e/settings/orders/adjust-instance.cy.js +++ b/cypress/e2e/settings/orders/adjust-instance.cy.js @@ -14,6 +14,8 @@ import SettingsMenu from '../../../support/fragments/settingsMenu'; import TopMenu from '../../../support/fragments/topMenu'; import Users from '../../../support/fragments/users/users'; import getRandomPostfix from '../../../support/utils/stringTools'; +import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; +import SettingOrdersNavigationMenu from '../../../support/fragments/settings/orders/settingOrdersNavigationMenu'; describe('orders: Settings', () => { const order = { @@ -111,11 +113,13 @@ describe('orders: Settings', () => { location.libraryId, location.id, ); - cy.visit(SettingsMenu.ordersInstanceStatusPath); + TopMenuNavigation.openAppFromDropdown('Settings'); + SettingsMenu.selectOrders(); + SettingOrdersNavigationMenu.selectInstanceStatus(); SettingsOrders.selectInstanceStatus(otherInstanceStatus); - cy.visit(SettingsMenu.ordersInstanceTypePath); + SettingOrdersNavigationMenu.selectInstanceType(); SettingsOrders.selectInstanceType(otherInstanceType); - cy.visit(SettingsMenu.ordersLoanTypePath); + SettingOrdersNavigationMenu.selectLoanType(); SettingsOrders.selectLoanType(selectedLoanType); Users.deleteViaApi(user.userId); }); @@ -125,11 +129,12 @@ describe('orders: Settings', () => { { tags: ['smoke', 'thunderjet'] }, () => { SettingsOrders.selectInstanceStatus(instanceStatus); - cy.visit(SettingsMenu.ordersInstanceTypePath); + SettingOrdersNavigationMenu.selectInstanceType(); SettingsOrders.selectInstanceType(instanceType); - cy.visit(SettingsMenu.ordersLoanTypePath); + SettingOrdersNavigationMenu.selectLoanType(); SettingsOrders.selectLoanType(loanType); - cy.visit(TopMenu.ordersPath); + TopMenuNavigation.navigateToApp('Orders'); + Orders.selectOrders(); Orders.searchByParameter('PO number', orderNumber); Orders.selectFromResultsList(orderNumber); Orders.openOrder(); diff --git a/cypress/support/fragments/finance/transactions/transactions.js b/cypress/support/fragments/finance/transactions/transactions.js index 9ab1909a05..033c4e905f 100644 --- a/cypress/support/fragments/finance/transactions/transactions.js +++ b/cypress/support/fragments/finance/transactions/transactions.js @@ -48,6 +48,9 @@ export default { return TransactionDetails; }, closeTransactionsPage() { + cy.wait(4000); + cy.get('#finance-module-display button[icon=times]').first().click(); + cy.wait(4000); }, }; diff --git a/cypress/support/fragments/settingsMenu.js b/cypress/support/fragments/settingsMenu.js index 0a508f88d6..fa2e95907d 100644 --- a/cypress/support/fragments/settingsMenu.js +++ b/cypress/support/fragments/settingsMenu.js @@ -1,3 +1,5 @@ +import { NavListItem } from '../../../interactors'; + export default { // direct paths to folio apps to use in cy.visit() into initial steps of our scenarios // TODO: add separated scenarios related with SettingsMenu implementation @@ -125,4 +127,8 @@ export default { tagsGeneralPath: 'settings/tags/general', // Software versions softwareVersionsPath: 'settings/about', + + selectOrders() { + cy.do(NavListItem('Orders').click()); + }, }; diff --git a/cypress/support/fragments/topMenuNavigation.js b/cypress/support/fragments/topMenuNavigation.js index 11fca09a82..32a11e42cf 100644 --- a/cypress/support/fragments/topMenuNavigation.js +++ b/cypress/support/fragments/topMenuNavigation.js @@ -19,7 +19,7 @@ export default { }, openAppFromDropdown(appName) { cy.do(HTML({ id: 'app-list-dropdown-toggle' }).click()); - cy.wait(500); + cy.wait(2000); cy.do(Link(appName).click()); }, }; From 414479ac54c4342b8e9125459fd7a1ed5ce3ae91 Mon Sep 17 00:00:00 2001 From: IhorBohdan Date: Fri, 27 Sep 2024 18:06:43 +0300 Subject: [PATCH 5/6] Revert "Fix Visit Methods" This reverts commit a356c7267c842515dc6c2980f9877687d9e2c1b0. --- ...-in-current-FY-for-previous-FY-order.cy.js | 23 ++++++++----------- ...ceiving-pieces-from-order-for-PE-mix.cy.js | 14 ++++++++++- ...e-in-received-status-when-edit-piece.cy.js | 7 ++---- .../e2e/settings/orders/adjust-instance.cy.js | 17 +++++--------- .../finance/transactions/transactions.js | 3 --- cypress/support/fragments/settingsMenu.js | 6 ----- .../support/fragments/topMenuNavigation.js | 2 +- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js b/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js index 7fe3999027..3e2169fdf9 100644 --- a/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js +++ b/cypress/e2e/invoices/approve-and-pay-invoice-created-in-current-FY-for-previous-FY-order.cy.js @@ -15,7 +15,6 @@ import TopMenu from '../../support/fragments/topMenu'; import Users from '../../support/fragments/users/users'; import DateTools from '../../support/utils/dateTools'; import getRandomPostfix from '../../support/utils/stringTools'; -import TopMenuNavigation from '../../support/fragments/topMenuNavigation'; describe('Invoices', () => { const firstFiscalYear = { ...FiscalYears.defaultUiFiscalYear }; @@ -68,10 +67,9 @@ describe('Invoices', () => { let user; before(() => { - cy.loginAsAdmin({ - path: SettingsMenu.expenseClassesPath, - waiter: SettingsFinance.waitExpenseClassesLoading, - }); + cy.getAdminToken(); + cy.loginAsAdmin(); + cy.visit(SettingsMenu.expenseClassesPath); SettingsFinance.createNewExpenseClass(firstExpenseClass); FiscalYears.createViaApi(firstFiscalYear).then((firstFiscalYearResponse) => { firstFiscalYear.id = firstFiscalYearResponse.id; @@ -112,10 +110,9 @@ describe('Invoices', () => { Funds.addBudget(allocatedQuantity); Funds.editBudget(); Funds.addExpensesClass(firstExpenseClass.name); - Funds.closeBudgetDetails(); }); - FinanceHelp.selectLedgersNavigation(); + cy.visit(TopMenu.ledgerPath); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -124,7 +121,7 @@ describe('Invoices', () => { 'None', 'Allocation', ); - FinanceHelp.selectFiscalYearsNavigation(); + cy.visit(TopMenu.fiscalYearPath); FinanceHelp.searchByName(firstFiscalYear.name); FiscalYears.selectFY(firstFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -139,7 +136,7 @@ describe('Invoices', () => { periodStartForSecondFY, periodEndForSecondFY, ); - FinanceHelp.selectLedgersNavigation(); + cy.visit(TopMenu.ledgerPath); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -149,7 +146,7 @@ describe('Invoices', () => { 'Allocation', ); - FinanceHelp.selectFiscalYearsNavigation(); + cy.visit(TopMenu.fiscalYearPath); FinanceHelp.searchByName(secondFiscalYear.name); FiscalYears.selectFY(secondFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -164,7 +161,7 @@ describe('Invoices', () => { periodStartForSecondFY, periodEndForSecondFY, ); - FinanceHelp.selectLedgersNavigation(); + cy.visit(TopMenu.ledgerPath); FinanceHelp.searchByName(defaultLedger.name); Ledgers.selectLedger(defaultLedger.name); Ledgers.rollover(); @@ -174,7 +171,7 @@ describe('Invoices', () => { 'Allocation', ); - FinanceHelp.selectFiscalYearsNavigation(); + cy.visit(TopMenu.fiscalYearPath); FinanceHelp.searchByName(thirdFiscalYear.name); FiscalYears.selectFY(thirdFiscalYear.name); FiscalYears.editFiscalYearDetails(); @@ -229,7 +226,7 @@ describe('Invoices', () => { Organizations.editOrganization(); Organizations.changeOrganizationStatus(organization.status); - TopMenuNavigation.navigateToApp('Invoices'); + cy.visit(TopMenu.invoicesPath); Invoices.searchByNumber(invoice.invoiceNumber); Invoices.selectInvoice(invoice.invoiceNumber); Invoices.approveInvoice(); diff --git a/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js b/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js index d6d4bb7317..3d1cf42778 100644 --- a/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js +++ b/cypress/e2e/orders/receiving-and-check-in/receiving-pieces-from-order-for-PE-mix.cy.js @@ -94,7 +94,19 @@ describe('Orders', () => { }); after(() => { - cy.getAdminToken(); + cy.loginAsAdmin({ path: TopMenu.receivingPath, waiter: Receiving.waitLoading }); + Orders.searchByParameter('PO number', orderNumber); + Receiving.selectLinkFromResultsList(); + Receiving.unreceiveFromReceivedSection(); + cy.visit(TopMenu.ordersPath); + Orders.searchByParameter('PO number', orderNumber); + Orders.selectFromResultsList(orderNumber); + Orders.unOpenOrder(); + OrderLines.selectPOLInOrder(0); + OrderLines.deleteOrderLine(); + // Need to wait until the order is opened before deleting it + cy.wait(2000); + Orders.deleteOrderViaApi(order.id); Users.deleteViaApi(user.userId); }); diff --git a/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js b/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js index 162f4ca8de..ddc5fb2d68 100644 --- a/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js +++ b/cypress/e2e/receiving/check-possible-actions-for-piece-in-received-status-when-edit-piece.cy.js @@ -14,7 +14,6 @@ import TopMenu from '../../support/fragments/topMenu'; import Users from '../../support/fragments/users/users'; import InteractorsTools from '../../support/utils/interactorsTools'; import Receiving from '../../support/fragments/receiving/receiving'; -import TopMenuNavigation from '../../support/fragments/topMenuNavigation'; describe('Orders: Inventory interaction', () => { const defaultFiscalYear = { ...FiscalYears.defaultRolloverFiscalYear }; @@ -65,8 +64,7 @@ describe('Orders: Inventory interaction', () => { organization.id = responseOrganizations; }); firstOrder.vendor = organization.name; - TopMenuNavigation.openAppFromDropdown('Orders'); - Orders.selectOrders(); + cy.visit(TopMenu.ordersPath); Orders.createApprovedOrderForRollover(firstOrder, true).then((firstOrderResponse) => { firstOrder.id = firstOrderResponse.id; orderNumber = firstOrderResponse.poNumber; @@ -111,8 +109,7 @@ describe('Orders: Inventory interaction', () => { Orders.deleteOrderViaApi(firstOrder.id); Organizations.deleteOrganizationViaApi(organization.id); - TopMenuNavigation.openAppFromDropdown('Finance'); - FinanceHelp.selectFundsNavigation(); + cy.visit(TopMenu.fundPath); FinanceHelp.searchByName(defaultFund.name); Funds.selectFund(defaultFund.name); Funds.selectBudgetDetails(); diff --git a/cypress/e2e/settings/orders/adjust-instance.cy.js b/cypress/e2e/settings/orders/adjust-instance.cy.js index a6b4db92fc..b69286acfd 100644 --- a/cypress/e2e/settings/orders/adjust-instance.cy.js +++ b/cypress/e2e/settings/orders/adjust-instance.cy.js @@ -14,8 +14,6 @@ import SettingsMenu from '../../../support/fragments/settingsMenu'; import TopMenu from '../../../support/fragments/topMenu'; import Users from '../../../support/fragments/users/users'; import getRandomPostfix from '../../../support/utils/stringTools'; -import TopMenuNavigation from '../../../support/fragments/topMenuNavigation'; -import SettingOrdersNavigationMenu from '../../../support/fragments/settings/orders/settingOrdersNavigationMenu'; describe('orders: Settings', () => { const order = { @@ -113,13 +111,11 @@ describe('orders: Settings', () => { location.libraryId, location.id, ); - TopMenuNavigation.openAppFromDropdown('Settings'); - SettingsMenu.selectOrders(); - SettingOrdersNavigationMenu.selectInstanceStatus(); + cy.visit(SettingsMenu.ordersInstanceStatusPath); SettingsOrders.selectInstanceStatus(otherInstanceStatus); - SettingOrdersNavigationMenu.selectInstanceType(); + cy.visit(SettingsMenu.ordersInstanceTypePath); SettingsOrders.selectInstanceType(otherInstanceType); - SettingOrdersNavigationMenu.selectLoanType(); + cy.visit(SettingsMenu.ordersLoanTypePath); SettingsOrders.selectLoanType(selectedLoanType); Users.deleteViaApi(user.userId); }); @@ -129,12 +125,11 @@ describe('orders: Settings', () => { { tags: ['smoke', 'thunderjet'] }, () => { SettingsOrders.selectInstanceStatus(instanceStatus); - SettingOrdersNavigationMenu.selectInstanceType(); + cy.visit(SettingsMenu.ordersInstanceTypePath); SettingsOrders.selectInstanceType(instanceType); - SettingOrdersNavigationMenu.selectLoanType(); + cy.visit(SettingsMenu.ordersLoanTypePath); SettingsOrders.selectLoanType(loanType); - TopMenuNavigation.navigateToApp('Orders'); - Orders.selectOrders(); + cy.visit(TopMenu.ordersPath); Orders.searchByParameter('PO number', orderNumber); Orders.selectFromResultsList(orderNumber); Orders.openOrder(); diff --git a/cypress/support/fragments/finance/transactions/transactions.js b/cypress/support/fragments/finance/transactions/transactions.js index 033c4e905f..9ab1909a05 100644 --- a/cypress/support/fragments/finance/transactions/transactions.js +++ b/cypress/support/fragments/finance/transactions/transactions.js @@ -48,9 +48,6 @@ export default { return TransactionDetails; }, closeTransactionsPage() { - cy.wait(4000); - cy.get('#finance-module-display button[icon=times]').first().click(); - cy.wait(4000); }, }; diff --git a/cypress/support/fragments/settingsMenu.js b/cypress/support/fragments/settingsMenu.js index fa2e95907d..0a508f88d6 100644 --- a/cypress/support/fragments/settingsMenu.js +++ b/cypress/support/fragments/settingsMenu.js @@ -1,5 +1,3 @@ -import { NavListItem } from '../../../interactors'; - export default { // direct paths to folio apps to use in cy.visit() into initial steps of our scenarios // TODO: add separated scenarios related with SettingsMenu implementation @@ -127,8 +125,4 @@ export default { tagsGeneralPath: 'settings/tags/general', // Software versions softwareVersionsPath: 'settings/about', - - selectOrders() { - cy.do(NavListItem('Orders').click()); - }, }; diff --git a/cypress/support/fragments/topMenuNavigation.js b/cypress/support/fragments/topMenuNavigation.js index 32a11e42cf..11fca09a82 100644 --- a/cypress/support/fragments/topMenuNavigation.js +++ b/cypress/support/fragments/topMenuNavigation.js @@ -19,7 +19,7 @@ export default { }, openAppFromDropdown(appName) { cy.do(HTML({ id: 'app-list-dropdown-toggle' }).click()); - cy.wait(2000); + cy.wait(500); cy.do(Link(appName).click()); }, }; From cbef847856cc82e3cb30d3249e0660648505f558 Mon Sep 17 00:00:00 2001 From: IhorBohdan Date: Thu, 10 Oct 2024 09:45:48 +0300 Subject: [PATCH 6/6] Implement FAT-16801 --- ...ting-list-in-pol-and-receiving-title.cy.js | 202 ++++++++++++++++++ cypress/support/dictionary/permissions.js | 4 + .../support/fragments/orders/orderLines.js | 12 ++ 3 files changed, 218 insertions(+) create mode 100644 cypress/e2e/orders/prioritize-users-in-routing-list-in-pol-and-receiving-title.cy.js diff --git a/cypress/e2e/orders/prioritize-users-in-routing-list-in-pol-and-receiving-title.cy.js b/cypress/e2e/orders/prioritize-users-in-routing-list-in-pol-and-receiving-title.cy.js new file mode 100644 index 0000000000..cc89913fde --- /dev/null +++ b/cypress/e2e/orders/prioritize-users-in-routing-list-in-pol-and-receiving-title.cy.js @@ -0,0 +1,202 @@ +import permissions from '../../support/dictionary/permissions'; +import getRandomPostfix from '../../support/utils/stringTools'; +import FiscalYears from '../../support/fragments/finance/fiscalYears/fiscalYears'; +import TopMenu from '../../support/fragments/topMenu'; +import Ledgers from '../../support/fragments/finance/ledgers/ledgers'; +import Users from '../../support/fragments/users/users'; +import Funds from '../../support/fragments/finance/funds/funds'; +import NewOrder from '../../support/fragments/orders/newOrder'; +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 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, ORDER_STATUSES } from '../../support/constants'; +import BasicOrderLine from '../../support/fragments/orders/basicOrderLine'; +import MaterialTypes from '../../support/fragments/settings/inventory/materialTypes'; +import Receiving from '../../support/fragments/receiving/receiving'; + +describe('Receiving', () => { + const firstFiscalYear = { ...FiscalYears.defaultUiFiscalYear }; + const defaultLedger = { ...Ledgers.defaultUiLedger }; + const firstFund = { ...Funds.defaultUiFund }; + const secondFund = { + name: `autotest_fund2_${getRandomPostfix()}`, + code: getRandomPostfix(), + externalAccountNo: getRandomPostfix(), + fundStatus: 'Active', + description: `This is fund created by E2E test automation script_${getRandomPostfix()}`, + }; + const firstOrder = { + ...NewOrder.getDefaultOngoingOrder, + orderType: 'Ongoing', + ongoing: { isSubscription: false, manualRenewal: false }, + approved: true, + reEncumber: true, + }; + const organization = { ...NewOrganization.defaultUiOrganizations }; + firstFiscalYear.code = firstFiscalYear.code.slice(0, -1) + '1'; + const firstBudget = { + ...Budgets.getDefaultBudget(), + allocated: 1000, + }; + const routingList1 = `routingList_1${getRandomPostfix()}`; + let enterUser; + let firstUser; + let secondUser; + let thirdUser; + let firstOrderNumber; + let servicePointId; + let location; + let orderLine; + + before(() => { + cy.getAdminToken(); + FiscalYears.createViaApi(firstFiscalYear).then((firstFiscalYearResponse) => { + firstFiscalYear.id = firstFiscalYearResponse.id; + firstBudget.fiscalYearId = firstFiscalYearResponse.id; + defaultLedger.fiscalYearOneId = firstFiscalYear.id; + Ledgers.createViaApi(defaultLedger).then((ledgerResponse) => { + defaultLedger.id = ledgerResponse.id; + firstFund.ledgerId = defaultLedger.id; + secondFund.ledgerId = defaultLedger.id; + + Funds.createViaApi(firstFund).then((fundResponse) => { + firstFund.id = fundResponse.fund.id; + firstBudget.fundId = fundResponse.fund.id; + Budgets.createViaApi(firstBudget); + cy.createTempUser([ + permissions.uiOrdersEdit.gui, + permissions.uiReceivingViewEdit.gui, + ]).then((firstUserProperties) => { + firstUser = firstUserProperties; + cy.createTempUser([ + permissions.uiOrdersEdit.gui, + permissions.uiReceivingViewEdit.gui, + ]).then((secondUserProperties) => { + secondUser = secondUserProperties; + cy.createTempUser([ + permissions.uiOrdersEdit.gui, + permissions.uiReceivingViewEdit.gui, + ]).then((thirdUserProperties) => { + thirdUser = thirdUserProperties; + ServicePoints.getViaApi().then((servicePoint) => { + servicePointId = servicePoint[0].id; + NewLocation.createViaApi(NewLocation.getDefaultLocation(servicePointId)).then( + (res) => { + location = res; + + MaterialTypes.createMaterialTypeViaApi( + MaterialTypes.getDefaultMaterialType(), + ).then((mtypes) => { + cy.getAcquisitionMethodsApi({ + query: `value="${ACQUISITION_METHOD_NAMES_IN_PROFILE.PURCHASE_AT_VENDOR_SYSTEM}"`, + }).then((params) => { + Organizations.createOrganizationViaApi(organization).then( + (responseOrganizations) => { + organization.id = responseOrganizations; + 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: [], + }, + }; + Orders.createOrderViaApi(firstOrder).then((firstOrderResponse) => { + firstOrder.id = firstOrderResponse.id; + firstOrderNumber = firstOrderResponse.poNumber; + firstOrderLine.purchaseOrderId = firstOrderResponse.id; + OrderLines.createOrderLineViaApi(firstOrderLine); + Orders.updateOrderViaApi({ + ...firstOrderResponse, + workflowStatus: ORDER_STATUSES.OPEN, + }); + cy.loginAsAdmin({ + path: TopMenu.ordersPath, + waiter: Orders.waitLoading, + }); + Orders.searchByParameter('PO number', firstOrderNumber); + Orders.selectFromResultsList(firstOrderNumber); + OrderLines.selectPOLInOrder(); + OrderLines.openRoutingLists(); + OrderLines.addRoutingListExist(); + OrderLines.addRoutingList(); + OrderLines.fillInRoutingListInfo(routingList1); + OrderLines.assignUser(firstUser.username); + OrderLines.assignUser(secondUser.username); + OrderLines.assignUser(thirdUser.username); + OrderLines.saveRoutingList(); + OrderLines.backToEditingOrder(); + }); + }, + ); + }); + }); + }, + ); + }); + }); + }); + }); + }); + }); + }); + + cy.createTempUser([ + permissions.uiOrdersEdit.gui, + permissions.uiReceivingViewEditDelete.gui, + ]).then((userProperties) => { + enterUser = userProperties; + cy.login(userProperties.username, userProperties.password, { + path: TopMenu.ordersPath, + waiter: Orders.waitLoading, + }); + }); + }); + + after(() => { + cy.getAdminToken(); + Users.deleteViaApi(enterUser.userId); + Users.deleteViaApi(enterUser.userId); + Users.deleteViaApi(enterUser.userId); + Users.deleteViaApi(enterUser.userId); + }); + + it( + 'C468198 Prioritize users in Routing list in POL and Receiving title (thunderjet)', + { tags: ['criticalPath', 'thunderjet'] }, + () => { + Orders.searchByParameter('PO number', firstOrderNumber); + Orders.selectFromResultsList(firstOrderNumber); + OrderLines.selectPOLInOrder(); + OrderLines.openRoutingList(routingList1); + OrderLines.editRoutingList(); + OrderLines.assignUser(enterUser.username); + OrderLines.unAssignUserFromRoutingList(firstUser.id); + OrderLines.checkUserIsAbsent(firstUser.username); + OrderLines.saveRoutingList(); + OrderLines.backToEditingOrder(); + Orders.receiveOrderViaActions(); + Receiving.selectPOLInReceive(orderLine.titleOrPackage); + }, + ); +}); diff --git a/cypress/support/dictionary/permissions.js b/cypress/support/dictionary/permissions.js index c072fe0f67..ffc51840b9 100644 --- a/cypress/support/dictionary/permissions.js +++ b/cypress/support/dictionary/permissions.js @@ -624,6 +624,10 @@ export default { internal: 'ui-receiving.create', gui: 'Receiving: View, edit, create', }, + uiReceivingViewEdit: { + internal: 'ui-receiving.edit', + gui: 'Receiving: View, edit', + }, uiReceivingViewEditDelete: { internal: 'ui-receiving.delete', gui: 'Receiving: View, edit, delete', diff --git a/cypress/support/fragments/orders/orderLines.js b/cypress/support/fragments/orders/orderLines.js index 009da363e5..9fb070ad61 100644 --- a/cypress/support/fragments/orders/orderLines.js +++ b/cypress/support/fragments/orders/orderLines.js @@ -2482,6 +2482,14 @@ export default { cy.do([TextField({ id: 'input-routing-list-name' }).fillIn(name), saveAndCloseButton.click()]); }, + fillInRoutingListInfo: (name) => { + cy.do(TextField({ id: 'input-routing-list-name' }).fillIn(name)); + }, + + saveRoutingList: () => { + cy.do(saveAndCloseButton.click()); + }, + fillInRoutingListInfoWithNotesAndSave: (name, notes) => { cy.do([ TextField({ id: 'input-routing-list-name' }).fillIn(name), @@ -2539,6 +2547,10 @@ export default { ]); }, + unAssignUserFromRoutingList(userID) { + cy.do(Button({ id: `clickable-remove-user-${userID}` }).click()); + }, + deleteUserFromRoutingList(user) { cy.do(Button({ id: `clickable-remove-user-${user}` }).click()); },