diff --git a/cypress/e2e/settings/orders/routing-address-option-is-displayed-in-orders-settings.cy.js b/cypress/e2e/settings/orders/routing-address-option-is-displayed-in-orders-settings.cy.js new file mode 100644 index 0000000000..b9667d92b3 --- /dev/null +++ b/cypress/e2e/settings/orders/routing-address-option-is-displayed-in-orders-settings.cy.js @@ -0,0 +1,52 @@ +import permissions from '../../../support/dictionary/permissions'; +import ListConfiguration from '../../../support/fragments/settings/orders/listConfiguration'; +import SettingsMenu from '../../../support/fragments/settingsMenu'; +import Users from '../../../support/fragments/users/users'; +import RoutingAddress from '../../../support/fragments/settings/orders/routingAddress'; +import SettingOrdersNavigationMenu from '../../../support/fragments/settings/orders/settingOrdersNavigationMenu'; + +Cypress.on('uncaught:exception', () => false); + +describe('orders: Settings', () => { + let user; + + before(() => { + cy.getAdminToken(); + + cy.createTempUser([permissions.uiSettingsOrdersCanViewAndEditAllSettings.gui]).then( + (userProperties) => { + user = userProperties; + cy.login(user.username, user.password, { + path: SettingsMenu.ordersRoutingAddressPath, + waiter: RoutingAddress.waitLoading, + }); + }, + ); + }); + + after(() => { + cy.getAdminToken(); + Users.deleteViaApi(user.userId); + }); + + it( + 'C466206 "Routing address" option is displayed in "Orders" settings (thunderjet)', + { tags: ['criticalPath', 'thunderjet'] }, + () => { + RoutingAddress.selectAddressType('Home'); + RoutingAddress.save(); + RoutingAddress.checkAddressTypeOption('Home'); + RoutingAddress.selectAddressType('Order'); + SettingOrdersNavigationMenu.selectListConfiguration(); + RoutingAddress.closeWhitoutSaving(); + ListConfiguration.waitLoading(); + SettingOrdersNavigationMenu.selectRoutingAddress(); + RoutingAddress.waitLoading(); + RoutingAddress.selectAddressType('Order'); + SettingOrdersNavigationMenu.selectListConfiguration(); + RoutingAddress.keepEditing(); + RoutingAddress.save(); + RoutingAddress.checkAddressTypeOption('Order'); + }, + ); +}); diff --git a/cypress/support/fragments/finance/funds/funds.js b/cypress/support/fragments/finance/funds/funds.js index 543567371d..87cf31c024 100644 --- a/cypress/support/fragments/finance/funds/funds.js +++ b/cypress/support/fragments/finance/funds/funds.js @@ -289,7 +289,7 @@ export default { saveAndClose.click(), // try to navigate without saving Button('Agreements').click(), - Button('Keep editing').click, + Button('Keep editing').click(), cancelButton.click(), Button('Close without saving').click(), ]); diff --git a/cypress/support/fragments/finance/groups/groups.js b/cypress/support/fragments/finance/groups/groups.js index 2238fd4a0a..9a312fc109 100644 --- a/cypress/support/fragments/finance/groups/groups.js +++ b/cypress/support/fragments/finance/groups/groups.js @@ -129,7 +129,7 @@ export default { cy.do([ // try to navigate without saving Button('Agreements').click(), - Button('Keep editing').click, + Button('Keep editing').click(), Button('Cancel').click(), Button('Close without saving').click(), ]); diff --git a/cypress/support/fragments/finance/ledgers/ledgers.js b/cypress/support/fragments/finance/ledgers/ledgers.js index 639a11850d..73b0f0da6a 100644 --- a/cypress/support/fragments/finance/ledgers/ledgers.js +++ b/cypress/support/fragments/finance/ledgers/ledgers.js @@ -556,7 +556,7 @@ export default { saveAndClose.click(), // try to navigate without saving Button('Agreements').click(), - Button('Keep editing').click, + Button('Keep editing').click(), Button('Cancel').click(), Button('Close without saving').click(), ]); diff --git a/cypress/support/fragments/settings/orders/routingAddress.js b/cypress/support/fragments/settings/orders/routingAddress.js index 423b2c2e62..ddaa38db2f 100644 --- a/cypress/support/fragments/settings/orders/routingAddress.js +++ b/cypress/support/fragments/settings/orders/routingAddress.js @@ -1,7 +1,35 @@ -import { Section } from '../../../../../interactors'; +import { Button, Modal, Section, Select } from '../../../../../interactors'; +import InteractorsTools from '../../../utils/interactorsTools'; + +const cancelEditingConfirmationModal = Modal({ id: 'cancel-editing-confirmation' }); export default { waitLoading() { cy.expect(Section({ id: 'central-ordering' }).exists()); }, + + selectAddressType(addressType) { + cy.wait(4000); + cy.do(Select({ name: 'ROUTING_USER_ADDRESS_TYPE_ID' }).choose(addressType)); + }, + + checkAddressTypeOption(addressType) { + cy.wait(4000); + cy.expect(Select({ name: 'ROUTING_USER_ADDRESS_TYPE_ID' }).hasValue(addressType)); + }, + + save() { + cy.do(Button({ id: 'clickable-save-routing-address-footer' }).click()); + InteractorsTools.checkCalloutMessage('Routing address setting was successfully updated'); + }, + + closeWhitoutSaving() { + cy.expect(cancelEditingConfirmationModal.exists()); + cy.do(Button({ id: 'clickable-cancel-editing-confirmation-cancel' }).click()); + }, + + keepEditing() { + cy.expect(cancelEditingConfirmationModal.exists()); + cy.do(Button({ id: 'clickable-cancel-editing-confirmation-confirm' }).click()); + }, };