From 5d1e0ee682d734e9de8a4dc7ed078238b4c3011c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 15:15:16 +0200 Subject: [PATCH] E2E fixes: client billing data, invoiceOut descriptor --- .../02-client/04_edit_billing_data.spec.js | 4 ++ .../09-invoice-out/02_descriptor.spec.js | 2 + .../invoiceOut/front/descriptor/index.html | 4 +- modules/invoiceOut/front/descriptor/index.js | 41 ++++++++++--------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index b757940be..7f37a61c1 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -32,6 +32,10 @@ describe('Client Edit billing data path', () => { }); it(`should create a new BIC code`, async() => { + // XXX: Windows fix, entity code doesn't get the focus, so the text + // '9999' is written in entity name. + await page.waitFor(500); + await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index ceb2175e2..535e37bdd 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -52,6 +52,7 @@ describe('InvoiceOut descriptor path', () => { it(`should search for the deleted invouceOut to find no results`, async() => { await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); await page.waitToClick(selectors.invoiceOutIndex.searchButton); + await page.waitForSpinnerLoad(); await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0); const result = await page.countElement(selectors.invoiceOutIndex.searchResult); @@ -69,6 +70,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); + await page.waitForSpinnerLoad(); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0); const result = await page.countElement(selectors.ticketsIndex.searchResult); diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index 981c23e34..1c18d92ed 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -40,11 +40,11 @@ \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index fea3c8bad..b813214bc 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -5,9 +5,18 @@ class Controller extends Component { constructor($element, $) { super($element, $); this.moreOptions = [ - {callback: this.showInvoiceOutPdf, name: 'Show invoice PDF'}, - {callback: this.showDeleteInvoiceOutDialog, name: 'Delete Invoice', acl: 'invoicing'}, - {callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'} + { + name: 'Show invoice PDF', + callback: this.showInvoiceOutPdf + }, { + name: 'Delete Invoice', + callback: this.showDeleteInvoiceOutDialog, + acl: 'invoicing' + }, { + name: 'Book invoice', + callback: this.showBookInvoiceOutDialog, + acl: 'invoicing' + } ]; } @@ -60,24 +69,18 @@ class Controller extends Component { this.$.bookConfirmation.show(); } - deleteInvoiceOut(response) { - if (response === 'accept') { - const query = `InvoiceOuts/${this.invoiceOut.id}/delete`; - this.$http.post(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted')); - this.$state.go('invoiceOut.index'); - }); - } + deleteInvoiceOut() { + const query = `InvoiceOuts/${this.invoiceOut.id}/delete`; + return this.$http.post(query) + .then(() => this.$state.go('invoiceOut.index')) + .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut deleted'))); } - bookInvoiceOut(response) { - if (response === 'accept') { - const query = `InvoiceOuts/${this.invoiceOut.ref}/book`; - this.$http.post(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); - this.$state.reload(); - }); - } + bookInvoiceOut() { + const query = `InvoiceOuts/${this.invoiceOut.ref}/book`; + return this.$http.post(query) + .then(() => this.$state.reload()) + .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked'))); } set quicklinks(value = {}) {