diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 901c7f57f..330d2f0b0 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -213,7 +213,9 @@ export default { regularizeQuantityInput: `vn-item-descriptor > vn-dialog > div > form > div.body > tpl-body > div > vn-textfield > div > div > div.infix > input`, regularizeWarehouseAutocomplete: 'vn-item-descriptor vn-dialog vn-autocomplete[field="$ctrl.warehouseFk"]', editButton: 'vn-item-card vn-item-descriptor vn-float-button[icon="edit"]', - regularizeSaveButton: `vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button` + regularizeSaveButton: `vn-item-descriptor > vn-dialog > div > form > div.buttons > tpl-buttons > button`, + inactiveIcon: 'vn-item-descriptor vn-icon[icon="icon-unavailable"]', + navigateBackToIndex: 'vn-item-descriptor vn-icon[icon="chevron_left"]' }, itemBasicData: { basicDataButton: `vn-left-menu a[ui-sref="item.card.data"]`, diff --git a/e2e/paths/item-module/11_inactive.spec.js b/e2e/paths/item-module/11_inactive.spec.js new file mode 100644 index 000000000..cdc9d7e65 --- /dev/null +++ b/e2e/paths/item-module/11_inactive.spec.js @@ -0,0 +1,48 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/nightmare'; + +describe('Item regularize path', () => { + const nightmare = createNightmare(); + beforeAll(() => { + nightmare + .loginAndModule('developer', 'item') + .accessToSearchResult(1) + .accessToSection('item.card.data'); + }); + + it('should check the descriptor inactive icon is dark as the item is active', async() => { + let darkIcon = await nightmare + .wait(selectors.itemDescriptor.inactiveIcon) + .waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright') + .isVisible(selectors.itemDescriptor.inactiveIcon); + + expect(darkIcon).toBeTruthy(); + }); + + it('should set the item to inactive', async() => { + let result = await nightmare + .waitToClick(selectors.itemBasicData.isActiveCheckbox) + .waitToClick(selectors.itemBasicData.submitBasicDataButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should reload the section and check the inactive icon is bright', async() => { + let brightIcon = await nightmare + .reloadSection('item.card.data') + .waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright') + .isVisible(selectors.itemDescriptor.inactiveIcon); + + expect(brightIcon).toBeTruthy(); + }); + + it('should set the item back to active', async() => { + let result = await nightmare + .waitToClick(selectors.itemBasicData.isActiveCheckbox) + .waitToClick(selectors.itemBasicData.submitBasicDataButton) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); +});