diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index 302a66c42..1294abf1e 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -8,6 +8,24 @@ describe('Item regularize path', () => { .loginAndModule('employee', 'item'); }); + + it('should edit the user local warehouse', async() => { + let result = await nightmare + .waitToClick(selectors.globalItems.userMenuButton) + .autocompleteSearch(selectors.globalItems.userLocalWarehouse, 'Warehouse Four') + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + + it('should open the user config form to check the local settings', async() => { + let userLocalWarehouse = await nightmare + .waitToClick(selectors.globalItems.userMenuButton) + .waitToGetProperty(`${selectors.globalItems.userLocalWarehouse} input`, 'value'); + + expect(userLocalWarehouse).toContain('Warehouse Four'); + }); + it('should search for the item', async() => { const resultCount = await nightmare .write(selectors.itemsIndex.searchItemInput, 'Object5 Weapon 50') @@ -28,10 +46,17 @@ describe('Item regularize path', () => { expect(url.hash).toContain('/summary'); }); - it('should regularize the item', async() => { + it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { const result = await nightmare .waitToClick(selectors.itemDescriptor.moreMenu) .waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton) + .waitToGetProperty(`${selectors.itemDescriptor.regularizeWarehouseAutocomplete} input`, 'value'); + + expect(result).toEqual('Warehouse Four'); + }); + + it('should regularize the item', async() => { + const result = await nightmare .write(selectors.itemDescriptor.regularizeQuantityInput, 100) .autocompleteSearch(selectors.itemDescriptor.regularizeWarehouseAutocomplete, 'Warehouse One') .waitToClick(selectors.itemDescriptor.regularizeSaveButton) @@ -51,6 +76,15 @@ describe('Item regularize path', () => { expect(url.hash).toEqual('#!/ticket/index'); }); + it('should now clear the user local settings', async() => { + let result = await nightmare + .waitToClick(selectors.globalItems.userMenuButton) + .waitToClick(selectors.globalItems.userConfigFirstAutocompleteClear) + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); + }); + it('should search for the ticket with alias missing', async() => { const result = await nightmare .write(selectors.ticketsIndex.searchTicketInput, 'missing')