From 5270693bdd7bf99a2e8924348f2f06f79524e144 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 26 Jun 2019 15:27:58 +0200 Subject: [PATCH] #1387 e2e Ticket Edit sale path --- e2e/paths/04-item-module/10_item_index.spec.js | 4 ++-- loopback/locale/en.json | 3 ++- modules/order/back/methods/order/new.js | 3 --- .../order/back/methods/order/specs/new.spec.js | 16 +--------------- modules/ticket/back/methods/ticket/new.js | 3 --- .../ticket/back/methods/ticket/specs/new.spec.js | 12 ------------ 6 files changed, 5 insertions(+), 36 deletions(-) diff --git a/e2e/paths/04-item-module/10_item_index.spec.js b/e2e/paths/04-item-module/10_item_index.spec.js index 64b7b2874..b83b37c59 100644 --- a/e2e/paths/04-item-module/10_item_index.spec.js +++ b/e2e/paths/04-item-module/10_item_index.spec.js @@ -39,7 +39,7 @@ describe('Item index path', () => { it('should navigate forth and back to see the images column is still visible', async() => { const imageVisible = await nightmare .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) + .waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.searchIcon) .wait(selectors.itemsIndex.searchResult) .isVisible(selectors.itemsIndex.firstItemImage); @@ -76,7 +76,7 @@ describe('Item index path', () => { it('should now navigate forth and back to see the ids column is now visible', async() => { const idVisible = await nightmare .waitToClick(selectors.itemsIndex.searchResult) - .waitToClick(selectors.itemsIndex.goBackToModuleIndexButton) + .waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton) .waitToClick(selectors.itemsIndex.searchIcon) .wait(selectors.itemsIndex.searchResult) .isVisible(selectors.itemsIndex.firstItemId); diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 31ba033dd..7d998c3f3 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -48,5 +48,6 @@ "Extension format is invalid": "Extension format is invalid", "NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS", "This client can't be invoiced": "This client can't be invoiced", - "The introduced hour already exists": "The introduced hour already exists" + "The introduced hour already exists": "The introduced hour already exists", + "Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket" } \ No newline at end of file diff --git a/modules/order/back/methods/order/new.js b/modules/order/back/methods/order/new.js index 0d020ccd6..4f1f2c3aa 100644 --- a/modules/order/back/methods/order/new.js +++ b/modules/order/back/methods/order/new.js @@ -48,9 +48,6 @@ module.exports = Self => { }); if (address.client().type().code === 'normal') { - if (address.client().isFreezed) - throw new UserError(`You can't create an order for a frozen client`); - if (!address.client().isActive) throw new UserError(`You can't create an order for a inactive client`); } diff --git a/modules/order/back/methods/order/specs/new.spec.js b/modules/order/back/methods/order/specs/new.spec.js index c823079fe..1cd3e8ce8 100644 --- a/modules/order/back/methods/order/specs/new.spec.js +++ b/modules/order/back/methods/order/specs/new.spec.js @@ -10,21 +10,7 @@ describe('order new()', () => { done(); }); - it('should throw an error if the client is frozen', async() => { - let error; - let landed = new Date(); - let addressFk = 125; - let agencyModeFk = 1; - - await app.models.Order.new(landed, addressFk, agencyModeFk) - .catch(e => { - error = e; - }); - - expect(error).toEqual(new UserError(`You can't create an order for a frozen client`)); - }); - - it('should throw an error if the client isnt frozen and isnt active', async() => { + it('should throw an error if the client isnt active', async() => { let error; let landed = new Date(); let addressFk = 6; diff --git a/modules/ticket/back/methods/ticket/new.js b/modules/ticket/back/methods/ticket/new.js index d57681269..defa25963 100644 --- a/modules/ticket/back/methods/ticket/new.js +++ b/modules/ticket/back/methods/ticket/new.js @@ -45,9 +45,6 @@ module.exports = Self => { agencyMode = await models.AgencyMode.findById(params.agencyModeFk); if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) { - if (address.client().isFreezed) - throw new UserError(`You can't create a ticket for a frozen client`); - if (!address.client().isActive) throw new UserError(`You can't create a ticket for a inactive client`); } diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js index 10ab41448..80147c2f2 100644 --- a/modules/ticket/back/methods/ticket/specs/new.spec.js +++ b/modules/ticket/back/methods/ticket/specs/new.spec.js @@ -13,18 +13,6 @@ describe('ticket new()', () => { done(); }); - it('should throw an error when the client is frozen', async() => { - let error; - let params = {addressFk: 125}; - - await app.models.Ticket.new(ctx, params) - .catch(e => { - error = e; - }); - - expect(error).toEqual(new UserError(`You can't create a ticket for a frozen client`)); - }); - it('should throw an error if the client isnt frozen and isnt active', async() => { let error; let params = {addressFk: 6};