diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 958c92d02..8b4d21745 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -160,6 +160,16 @@ let actions = { .catch(done); }, + waitToFocus: function(selector, done) { + this.wait(selector) + .evaluate_now(selector => { + let element = document.querySelector(selector); + element.focus(); + }, done, selector) + .then(done) + .catch(done); + }, + isVisible: function(selector, done) { this.wait(selector) .evaluate_now(elementSelector => { diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index bd850ef3f..be035d0e5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -339,12 +339,13 @@ export default { firstSaleThumbnailImage: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) vn-td:nth-child(3) > img', firstSaleZoomedImage: 'body > div > div > img', firstSaleQuantity: `vn-textfield[model="sale.quantity"]:nth-child(1) input`, + firstSaleQuantityCell: `vn-ticket-sale vn-tr:nth-child(1) > vn-td-editable`, firstSaleQuantityClearInput: `vn-textfield[model="sale.quantity"] div.suffix > i`, firstSaleID: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(4) > span', firstSalePrice: 'vn-ticket-sale:nth-child(1) vn-tr:nth-child(1) > vn-td:nth-child(7) > span', - firstSalePriceInput: 'vn-ticket-sale:nth-child(1) > vn-vertical > vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown > div > div.content > div > vn-textfield', + firstSalePriceInput: 'vn-ticket-sale:nth-child(1) vn-popover.edit.dialog-summary.ng-isolate-scope.vn-popover.shown vn-textfield input', firstSaleDiscount: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(8) > span', - firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount > div > vn-textfield > div > div > div.infix > input.ng-not-empty', + firstSaleDiscountInput: 'vn-ticket-sale:nth-child(1) vn-ticket-sale-edit-discount vn-textfield input', firstSaleImport: 'vn-ticket-sale:nth-child(1) vn-td:nth-child(9)', firstSaleReservedIcon: 'vn-ticket-sale vn-tr:nth-child(1) > vn-td:nth-child(2) > vn-icon:nth-child(3)', firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(6) section:nth-child(1)`, diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 9a0a3f35d..cc3125f9b 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -2,7 +2,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; // #1152 refactor ticket.sale, update price no funciona correctamente. -xdescribe('Ticket Edit sale path', () => { +describe('Ticket Edit sale path', () => { const nightmare = createNightmare(); beforeAll(() => { @@ -138,7 +138,7 @@ xdescribe('Ticket Edit sale path', () => { it('should try to add a higher quantity value and then receive an error', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '9\u000d') .waitForLastSnackbar(); @@ -147,7 +147,7 @@ xdescribe('Ticket Edit sale path', () => { it('should remove 1 from quantity', async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleQuantityClearInput) + .waitToFocus(selectors.ticketSales.firstSaleQuantityCell) .write(selectors.ticketSales.firstSaleQuantity, '4\u000d') .waitForLastSnackbar(); @@ -180,7 +180,6 @@ xdescribe('Ticket Edit sale path', () => { it('should update the discount', async() => { const result = await nightmare .waitToClick(selectors.ticketSales.firstSaleDiscount) - .wait('vn-textfield[label="Discount"] > div[class="container selected"]') // a function selects the text after it's loaded .write(selectors.ticketSales.firstSaleDiscountInput, '50\u000d') // .write('body', '\u000d') // simulates enter .waitForLastSnackbar(); @@ -597,16 +596,16 @@ xdescribe('Ticket Edit sale path', () => { describe('when state is preparation and loged as salesPerson', () => { it(`shouldnt be able to edit the sale price`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSalePrice) - .exists(selectors.ticketSales.firstSalePriceInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSalePrice); expect(result).toBeFalsy(); }); it(`shouldnt be able to edit the sale discount`, async() => { const result = await nightmare - .waitToClick(selectors.ticketSales.firstSaleDiscount) - .exists(selectors.ticketSales.firstSaleDiscountInput); + .waitToClick(selectors.ticketSales.firstSaleID) + .exists(selectors.ticketSales.firstSaleDiscount); expect(result).toBeFalsy(); }); diff --git a/modules/ticket/front/sale/editDiscount.html b/modules/ticket/front/sale/editDiscount.html index 9822ae802..cdc5f0839 100644 --- a/modules/ticket/front/sale/editDiscount.html +++ b/modules/ticket/front/sale/editDiscount.html @@ -3,6 +3,7 @@
New price
-{{($ctrl.sale.quantity * $ctrl.editedPrice) - - (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100) - | currency: 'EUR':2}}
+ on-open="$ctrl.getManaSalespersonMana()" + on-close="$ctrl.mana = null"> +New price
+{{($ctrl.sale.quantity * $ctrl.editedPrice) + - (($ctrl.sale.discount * ($ctrl.sale.quantity * $ctrl.editedPrice))/100) + | currency: 'EUR':2}}
+