From 1b13e58e101dd5f5878a47abca3a2d8c1912cbda Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 17 Sep 2020 09:58:00 +0200 Subject: [PATCH] =?UTF-8?q?item=20basic-data=20a=C3=B1adir=20isFragile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- e2e/helpers/selectors.js | 3 +- e2e/paths/04-item/02_basic_data.spec.js | 17 ++++++-- modules/item/back/models/item.json | 6 +++ modules/item/front/basic-data/index.html | 44 ++++++++++----------- modules/item/front/basic-data/locale/es.yml | 4 +- modules/ticket/back/models/ticket.json | 3 +- 6 files changed, 47 insertions(+), 30 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bd1d30e45..e1189ca50 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -275,7 +275,8 @@ export default { name: 'vn-item-basic-data vn-textfield[ng-model="$ctrl.item.name"]', relevancy: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.relevancy"]', origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', - expense: 'vn-autocomplete[ng-model="$ctrl.item.expenseFk"]', + compression: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.compression"]', + isFragile: 'vn-check[label="isFragile"]', longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', isActiveCheckbox: 'vn-check[label="Active"]', priceInKgCheckbox: 'vn-check[label="Price in kg"]', diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index 7a9b9a1e7..836efaa2e 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -28,11 +28,13 @@ describe('Item Edit basic data path', () => { await page.clearInput(selectors.itemBasicData.relevancy); await page.write(selectors.itemBasicData.relevancy, '1'); await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain'); - await page.autocompleteSearch(selectors.itemBasicData.expense, 'Alquiler VNH'); + await page.clearInput(selectors.itemBasicData.compression); + await page.write(selectors.itemBasicData.compression, '2'); await page.clearInput(selectors.itemBasicData.longName); await page.write(selectors.itemBasicData.longName, 'RS Rose of Purity'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); await page.waitToClick(selectors.itemBasicData.priceInKgCheckbox); + await page.waitToClick(selectors.itemBasicData.isFragile); await page.waitToClick(selectors.itemBasicData.submitBasicDataButton); const message = await page.waitForSnackbar(); @@ -93,11 +95,11 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('Spain'); }); - it(`should confirm the item expence was edited`, async() => { + it(`should confirm the item compression was edited`, async() => { const result = await page - .waitToGetProperty(selectors.itemBasicData.expense, 'value'); + .waitToGetProperty(selectors.itemBasicData.compression, 'value'); - expect(result).toEqual('Alquiler VNH'); + expect(result).toEqual('2'); }); it(`should confirm the item long name was edited`, async() => { @@ -107,6 +109,13 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('RS Rose of Purity'); }); + it('should confirm isFragile checkbox is unchecked', async() => { + const result = await page + .checkboxState(selectors.itemBasicData.isFragile); + + expect(result).toBe('unchecked'); + }); + it('should confirm isActive checkbox is unchecked', async() => { const result = await page .checkboxState(selectors.itemBasicData.isActiveCheckbox); diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index c5af8890b..66c32933e 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -113,6 +113,9 @@ "value10": { "type": "String" }, + "compression": { + "type": "Number" + }, "hasKgPrice": { "type": "Boolean", "description": "Price per Kg" @@ -125,6 +128,9 @@ }, "minPrice": { "type": "number" + }, + "isFragile": { + "type": "Boolean" } }, "relations": { diff --git a/modules/item/front/basic-data/index.html b/modules/item/front/basic-data/index.html index 99146deb0..71fd3848d 100644 --- a/modules/item/front/basic-data/index.html +++ b/modules/item/front/basic-data/index.html @@ -63,12 +63,6 @@ - - - - + + + + - - + - - - + label="Price in kg" + ng-model="$ctrl.item.hasKgPrice"> + + + diff --git a/modules/item/front/basic-data/locale/es.yml b/modules/item/front/basic-data/locale/es.yml index 07e681770..1681862e0 100644 --- a/modules/item/front/basic-data/locale/es.yml +++ b/modules/item/front/basic-data/locale/es.yml @@ -7,4 +7,6 @@ Is active: Activo Expense: Gasto Price in kg: Precio en kg New intrastat: Nuevo intrastat -Identifier: Identificador \ No newline at end of file +Identifier: Identificador +Fragile: Frágil +Is shown at website, app that this item cannot travel (wreath, palms, ...): Se muestra en la web, app que este artículo no puede viajar (coronas, palmas, ...) \ No newline at end of file diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 63b69b914..df92d6861 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -92,8 +92,7 @@ "agencyMode": { "type": "belongsTo", "model": "AgencyMode", - "foreignKey": "agencyModeFk", - "required": true + "foreignKey": "agencyModeFk" }, "packages": { "type": "hasMany",