Skip to content

Commit

Permalink
Implement FAT-16462
Browse files Browse the repository at this point in the history
  • Loading branch information
IhorBohdan committed Sep 25, 2024
1 parent ac039e3 commit 8a0c8e0
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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');
},
);
});
2 changes: 1 addition & 1 deletion cypress/support/fragments/finance/funds/funds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]);
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/fragments/finance/groups/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]);
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/fragments/finance/ledgers/ledgers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
]);
Expand Down
30 changes: 29 additions & 1 deletion cypress/support/fragments/settings/orders/routingAddress.js
Original file line number Diff line number Diff line change
@@ -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());
},
};

0 comments on commit 8a0c8e0

Please sign in to comment.