From a096490d1c9eab0e554d01948b55cde6521c57b2 Mon Sep 17 00:00:00 2001 From: jgallego Date: Thu, 22 Nov 2018 14:12:52 +0100 Subject: [PATCH 1/3] #855 consignatario validacion back recargo --- services/loopback/common/models/address.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/services/loopback/common/models/address.js b/services/loopback/common/models/address.js index 52adb1bb8..7a94dbdc6 100644 --- a/services/loopback/common/models/address.js +++ b/services/loopback/common/models/address.js @@ -1,15 +1,30 @@ -var UserError = require('../helpers').UserError; -var getFinalState = require('../helpers').getFinalState; -var isMultiple = require('../helpers').isMultiple; +let UserError = require('../helpers').UserError; +let getFinalState = require('../helpers').getFinalState; +let isMultiple = require('../helpers').isMultiple; module.exports = Self => { Self.validate('isDefaultAddress', isActive, {message: 'Unable to default a disabled consignee'} ); + function isActive(err) { if (!this.isActive && this.isDefaultAddress) err(); } + Self.validateAsync('isEqualizated', cannotHaveET, { + message: 'Cannot check Equalization Tax in this NIF/CIF' + }); + + async function cannotHaveET(err, done) { + let client = await Self.app.models.Client.findById(this.clientFk); + let tin = client.fi.toUpperCase(); + let cannotHaveET = /^[A-B]/.test(tin); + + if (cannotHaveET && this.isEqualizated) + err(); + done(); + } + Self.beforeRemote('findById', function(ctx, modelInstance, next) { ctx.args.filter = { include: [{ From 4e1d7e2822849f97e75cc63a29a5f40a53d3fd7d Mon Sep 17 00:00:00 2001 From: Joan Date: Thu, 22 Nov 2018 15:17:35 +0100 Subject: [PATCH 2/3] fixed billing data swift validations --- client/client/src/billing-data/index.html | 1 + client/client/src/billing-data/index.js | 8 +++++--- client/core/src/components/textfield/textfield.js | 10 ++++------ services/loopback/common/models/client.js | 8 +++----- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/client/client/src/billing-data/index.html b/client/client/src/billing-data/index.html index b6ff8cbb2..579cd885c 100644 --- a/client/client/src/billing-data/index.html +++ b/client/client/src/billing-data/index.html @@ -39,6 +39,7 @@ field="$ctrl.client.bankEntityFk" fields="['name']" initial-data="$ctrl.client.bankEntityFk" + on-change="$ctrl.autofillBic()" search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}" value-field="id" show-field="bic" diff --git a/client/client/src/billing-data/index.js b/client/client/src/billing-data/index.js index 4aba252bb..e5c666a4a 100644 --- a/client/client/src/billing-data/index.js +++ b/client/client/src/billing-data/index.js @@ -28,7 +28,6 @@ export default class Controller { if (this.hasPaymethodChanges()) shouldNotify = true; - this.autofillBic(); this.$scope.watcher.submit().then(() => { if (shouldNotify) this.notifyChanges(); @@ -87,10 +86,13 @@ export default class Controller { if (countryCode != 'ES') return; let json = encodeURIComponent(JSON.stringify(filter)); - this.client.bankEntityFk = undefined; this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => { - if (response.data && response.data[0]) + const hasData = response.data && response.data[0]; + + if (hasData) this.client.bankEntityFk = response.data[0].id; + else if (!hasData) + this.client.bankEntityFk = null; }); } } diff --git a/client/core/src/components/textfield/textfield.js b/client/core/src/components/textfield/textfield.js index 43a0a9bd8..1155e5239 100644 --- a/client/core/src/components/textfield/textfield.js +++ b/client/core/src/components/textfield/textfield.js @@ -15,24 +15,22 @@ export default class Textfield extends Input { this.hasMouseIn = false; this.input.addEventListener('keydown', () => { - if (!this.oldValue) { + if (!this.oldValue) this.saveOldValue(); - } }); this.input.addEventListener('keyup', e => { - if (e.key == "Escape") { + if (e.key == 'Escape') { this.value = this.oldValue; this.cancelled = true; e.stopPropagation(); } - if (e.key == "Escape" || e.key == "Enter") + if (e.key == 'Escape' || e.key == 'Enter') this.input.blur(); }); this.input.addEventListener('blur', () => { - if (this.onChange && !this.cancelled && - (this.oldValue && this.oldValue != this.value)) + if (this.onChange && !this.cancelled && (this.oldValue != this.value)) this.onChange(); else this.cancelled = false; diff --git a/services/loopback/common/models/client.js b/services/loopback/common/models/client.js index 9a80ab669..5b0be47f5 100644 --- a/services/loopback/common/models/client.js +++ b/services/loopback/common/models/client.js @@ -129,11 +129,9 @@ module.exports = Self => { }); function hasBic(err, done) { - Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => { - if (instance && instance.ibanRequired && !this.bankEntityFk) - err(); - done(); - }); + if (this.iban && !this.bankEntityFk) + err(); + done(); } Self.observe('before save', async function(ctx) { From 00d0342d5052c98f43fec107fb27f323205b7765 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Thu, 22 Nov 2018 15:44:33 +0100 Subject: [PATCH 3/3] #781 Extensiones nightmare correct usage of extensions --- e2e/helpers/extensions.js | 28 -- .../claim-module/01_edit_basic_data.spec.js | 8 +- .../client-module/02_edit_basic_data.spec.js | 36 ++- .../client-module/03_edit_fiscal_data.spec.js | 35 ++- .../client-module/04_edit_pay_method.spec.js | 12 +- .../client-module/05_add_address.spec.js | 20 +- .../06_add_address_notes.spec.js | 8 +- .../client-module/07_edit_web_access.spec.js | 6 +- e2e/paths/client-module/08_add_notes.spec.js | 11 +- e2e/paths/client-module/09_add_credit.spec.js | 11 +- e2e/paths/client-module/10_add_greuge.spec.js | 11 +- e2e/paths/client-module/11_mandate.spec.js | 7 +- .../12_lock_of_verified_data.spec.js | 9 +- e2e/paths/client-module/13_log.spec.js | 4 +- e2e/paths/item-module/01_item_summary.spec.js | 30 +- .../02_edit_item_basic_data.spec.js | 4 +- .../item-module/03_edit_item_tax.spec.js | 10 +- .../item-module/04_create_item_tags.spec.js | 4 +- .../item-module/05_create_item_niche.spec.js | 16 +- .../06_create_item_botanical.spec.js | 16 +- .../07_create_item_barcode.spec.js | 6 +- .../08_item_create_and_clone.spec.js | 7 +- .../item-module/09_regularize_item.spec.js | 20 +- .../01_create_ticket_observations.spec.js | 70 ++--- .../02_delete_ticket_expeditions.spec.js | 4 +- e2e/paths/ticket-module/03_list_sale.spec.js | 23 +- .../04_create_ticket_packages.spec.js | 8 +- .../05_create_new_tracking_state.spec.js | 96 +++---- .../06_edit_basic_data_steps.spec.js | 262 ++++++++---------- e2e/paths/ticket-module/07_edit_sale.spec.js | 72 ++--- .../ticket-module/08_list_components.spec.js | 4 +- .../ticket-module/09_ticket_weekly.spec.js | 8 +- .../ticket-module/10_ticket_request.spec.js | 8 +- .../ticket-module/11_ticket_diary.spec.js | 4 +- .../12_delete_ticket_from_descriptor.spec.js | 6 +- .../auth/server/boot/specs/routes.spec.js | 4 +- 36 files changed, 396 insertions(+), 492 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index a812728b3..8e79e657a 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -94,20 +94,6 @@ let actions = { .then(result => done(null, result), done); }, - getInnerText: function(selector, done) { - this.wait(selector) - .evaluate_now(function(elementToSelect) { - return document.querySelector(elementToSelect).innerText; - }, done, selector); - }, - - getInputValue: function(selector, done) { - this.wait(selector) - .evaluate_now(function(elementToSelect) { - return document.querySelector(elementToSelect).value; - }, done, selector); - }, - write: function(selector, text, done) { this.wait(selector) .type(selector, text) @@ -163,20 +149,6 @@ let actions = { }, done, selector); }, - selectText: function(selector, done) { - this.wait(selector) - .evaluate(elementToSelect => { - const range = document.createRange(); - range.selectNodeContents(document.querySelector(elementToSelect)); - const sel = window.getSelection(); - sel.removeAllRanges(); - sel.addRange(range); - }, selector) - .mouseup(selector) - .then(done) - .catch(done); - }, - countElement: function(selector, done) { this.evaluate_now(selector => { return document.querySelectorAll(selector).length; diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/claim-module/01_edit_basic_data.spec.js index 12afbf54b..0b0b89e4c 100644 --- a/e2e/paths/claim-module/01_edit_basic_data.spec.js +++ b/e2e/paths/claim-module/01_edit_basic_data.spec.js @@ -36,9 +36,9 @@ describe('Claim edit basic data path', () => { .waitToClick(selectors.claimsIndex.searchResult) .waitToClick(selectors.claimBasicData.basicDataButton) .waitForURL('basic-data') - .url(); + .parsedUrl(); - expect(url).toContain('basic-data'); + expect(url.hash).toContain('basic-data'); }); it(`should edit claim state, is paid with mana and observation fields`, async () => { @@ -60,7 +60,7 @@ describe('Claim edit basic data path', () => { .wait(selectors.claimDetails.addItemButton) .click(selectors.claimBasicData.basicDataButton) .wait(selectors.claimBasicData.claimStateSelect) - .getInputValue(selectors.claimBasicData.claimStateSelect); + .waitToGetProperty(selectors.claimBasicData.claimStateSelect, 'value'); expect(result).toEqual('Gestionado'); }); @@ -76,7 +76,7 @@ describe('Claim edit basic data path', () => { it('should confirm the claim observation was edited', async () => { const result = await nightmare - .getInputValue(selectors.claimBasicData.observationInput); + .waitToGetProperty(selectors.claimBasicData.observationInput, 'value'); expect(result).toEqual('edited observation'); }); diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js index 419a077d7..c82a07b2e 100644 --- a/e2e/paths/client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/client-module/02_edit_basic_data.spec.js @@ -36,9 +36,9 @@ describe('Client Edit basicData path', () => { .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') .waitToClick(selectors.clientsIndex.searchResult) .waitForURL('summary') - .url(); + .parsedUrl(); - expect(url).toContain('summary'); + expect(url.hash).toContain('summary'); }); it('should not be able to change the salesPerson', async () => { @@ -77,43 +77,42 @@ describe('Client Edit basicData path', () => { .click(selectors.clientFiscalData.fiscalDataButton) .wait(selectors.clientFiscalData.addressInput) .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .getInputValue(selectors.clientBasicData.nameInput); + .waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); expect(result).toEqual('Ptonomy Wallace'); }); it('should confirm the contact name have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.contactInput); + .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); expect(result).toEqual('David Haller'); }); it('should confirm the landline phone number have been added', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.phoneInput); + .waitToGetProperty(selectors.clientBasicData.phoneInput, 'value'); expect(result).toEqual('987654321'); }); it('should confirm the mobile phone number have been added', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.mobileInput); + .waitToGetProperty(selectors.clientBasicData.mobileInput, 'value'); expect(result).toEqual('123456789'); }); it('should confirm the email have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.emailInput); + .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); expect(result).toEqual('PWallace@verdnatura.es'); }); it('should confirm the channel have been selected', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.channelInput); + .waitToGetProperty(selectors.clientBasicData.channelInput, 'value'); expect(result).toEqual('Rumors on the streets'); }); @@ -153,9 +152,9 @@ describe('Client Edit basicData path', () => { .waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace') .waitToClick(selectors.clientsIndex.searchResult) .waitForURL('summary') - .url(); + .parsedUrl(); - expect(url).toContain('summary'); + expect(url.hash).toContain('summary'); }); it('should be able to change the salesPerson', async () => { @@ -196,50 +195,49 @@ describe('Client Edit basicData path', () => { .click(selectors.clientFiscalData.fiscalDataButton) .wait(selectors.clientFiscalData.addressInput) .click(selectors.clientBasicData.basicDataButton) - .wait(selectors.clientBasicData.nameInput) - .getInputValue(selectors.clientBasicData.nameInput); + .waitToGetProperty(selectors.clientBasicData.nameInput, 'value'); expect(result).toEqual('Ororo Munroe'); }); it('should now confirm the contact name have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.contactInput); + .waitToGetProperty(selectors.clientBasicData.contactInput, 'value'); expect(result).toEqual('Black Panther'); }); it('should now confirm the landline phone number have been added', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.phoneInput); + .waitToGetProperty(selectors.clientBasicData.phoneInput, 'value'); expect(result).toEqual('123456789'); }); it('should now confirm the mobile phone number have been added', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.mobileInput); + .waitToGetProperty(selectors.clientBasicData.mobileInput, 'value'); expect(result).toEqual('987654321'); }); it('should now confirm the email have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.emailInput); + .waitToGetProperty(selectors.clientBasicData.emailInput, 'value'); expect(result).toEqual('Storm@verdnatura.es'); }); it('should confirm the sales person have been selected', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.salesPersonInput); + .waitToGetProperty(selectors.clientBasicData.salesPersonInput, 'value'); expect(result).toEqual('adminAssistant adminAssistant'); }); it('should now confirm the channel have been selected', async () => { const result = await nightmare - .getInputValue(selectors.clientBasicData.channelInput); + .waitToGetProperty(selectors.clientBasicData.channelInput, 'value'); expect(result).toEqual('Metropolis newspaper'); }); diff --git a/e2e/paths/client-module/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js index 4c9282e4f..a615e4bd0 100644 --- a/e2e/paths/client-module/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -38,9 +38,9 @@ describe('Client Edit fiscalData path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('/address/index') - .url(); + .parsedUrl(); - expect(url).toContain('/address/index'); + expect(url.hash).toContain('/address/index'); }); // Confirms all addresses have EQtax false for future propagation test step 2 @@ -72,9 +72,9 @@ describe('Client Edit fiscalData path', () => { const url = await nightmare .waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitForURL('fiscal-data') - .url(); + .parsedUrl(); - expect(url).toContain('fiscal-data'); + expect(url.hash).toContain('fiscal-data'); }); it('should not be able to edit the verified data checkbox', async () => { @@ -121,9 +121,9 @@ describe('Client Edit fiscalData path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitForURL('fiscal-data') - .url(); + .parsedUrl(); - expect(url).toContain('fiscal-data'); + expect(url.hash).toContain('fiscal-data'); }); it('should receive an error if VIES and EQtax are being ticked together', async () => { @@ -191,9 +191,9 @@ describe('Client Edit fiscalData path', () => { const url = await nightmare .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('/address/index') - .url(); + .parsedUrl(); - expect(url).toContain('/address/index'); + expect(url.hash).toContain('/address/index'); }); // confirm all addresses have now EQtax checked step 2 @@ -243,50 +243,49 @@ describe('Client Edit fiscalData path', () => { it('should confirm its name have been edited', async () => { const result = await nightmare .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput); + .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('SMASH!'); }); it('should confirm the fiscal id have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.fiscalIdInput); + .waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value'); expect(result).toEqual('94980061C'); }); it('should confirm the address have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.addressInput); + .waitToGetProperty(selectors.clientFiscalData.addressInput, 'value'); expect(result).toEqual('Somewhere edited'); }); it('should confirm the postcode have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.postcodeInput); + .waitToGetProperty(selectors.clientFiscalData.postcodeInput, 'value'); expect(result).toEqual('12345'); }); it('should confirm the city have been edited', async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.cityInput); + .waitToGetProperty(selectors.clientFiscalData.cityInput, 'value'); expect(result).toEqual('N/A'); }); it(`should confirm the country have been selected`, async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.countryInput); + .waitToGetProperty(selectors.clientFiscalData.countryInput, 'value'); expect(result).toEqual('Francia'); }); it(`should confirm the province have been selected`, async () => { const result = await nightmare - .getInputValue(selectors.clientFiscalData.provinceInput); + .waitToGetProperty(selectors.clientFiscalData.provinceInput, 'value'); expect(result).toEqual('Province two'); }); @@ -368,9 +367,9 @@ describe('Client Edit fiscalData path', () => { const url = await nightmare .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('/address/index') - .url(); + .parsedUrl(); - expect(url).toContain('/address/index'); + expect(url.hash).toContain('/address/index'); }); // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2 diff --git a/e2e/paths/client-module/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js index 96556f52a..6e9b8c246 100644 --- a/e2e/paths/client-module/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -37,9 +37,9 @@ describe('Client Edit pay method path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientPayMethod.payMethodButton) .waitForURL('billing-data') - .url(); + .parsedUrl(); - expect(url).toContain('billing-data'); + expect(url.hash).toContain('billing-data'); }); it(`should attempt to edit the Pay method without an IBAN but fail`, async () => { @@ -80,21 +80,21 @@ describe('Client Edit pay method path', () => { .type(selectors.clientPayMethod.newBankEntityName, 'Gotham City Banks') .type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT') .click(selectors.clientPayMethod.acceptBankEntityButton) - .getInputValue(selectors.clientPayMethod.swiftBicInput); + .waitToGetProperty(selectors.clientPayMethod.swiftBicInput, 'value'); - expect(newcode).toEqual(''); + expect(newcode).toEqual('GTHMCT Gotham City Banks'); }); it(`should confirm the IBAN pay method is sucessfully saved`, async () => { const payMethod = await nightmare - .getInputValue(selectors.clientPayMethod.payMethodInput); + .waitToGetProperty(selectors.clientPayMethod.payMethodInput, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); }); it('should confirm the due day have been edited', async () => { const dueDate = await nightmare - .getInputValue(selectors.clientPayMethod.dueDayInput); + .waitToGetProperty(selectors.clientPayMethod.dueDayInput, 'value'); expect(dueDate).toEqual('60'); }); diff --git a/e2e/paths/client-module/05_add_address.spec.js b/e2e/paths/client-module/05_add_address.spec.js index 382f6fb7d..19e558085 100644 --- a/e2e/paths/client-module/05_add_address.spec.js +++ b/e2e/paths/client-module/05_add_address.spec.js @@ -37,36 +37,36 @@ describe('Client Add address path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('address/index') - .url(); + .parsedUrl(); - expect(url).toContain('address/index'); + expect(url.hash).toContain('address/index'); }); it(`should click on the add new address button to access to the new address form`, async () => { const url = await nightmare .waitToClick(selectors.clientAddresses.createAddress) .waitForURL('address/create') - .url(); + .parsedUrl(); - expect(url).toContain('address/create'); + expect(url.hash).toContain('address/create'); }); it(`should return to the addreses section by clicking the cancel button`, async () => { const url = await nightmare .waitToClick(selectors.clientAddresses.cancelButton) .waitForURL('address/index') - .url(); + .parsedUrl(); - expect(url).toContain('address/index'); + expect(url.hash).toContain('address/index'); }); it(`should now click on the add new address button to access to the new address form`, async () => { const url = await nightmare .waitToClick(selectors.clientAddresses.createAddress) .waitForURL('address/create') - .url(); + .parsedUrl(); - expect(url).toContain('address/create'); + expect(url.hash).toContain('address/create'); }); it('should receive an error after clicking save button as consignee, street and town fields are empty', async () => { @@ -119,9 +119,9 @@ describe('Client Add address path', () => { .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') .waitToClick(selectors.clientAddresses.firstEditButton) .waitForURL('/edit') - .url(); + .parsedUrl(); - expect(url).toContain('/edit'); + expect(url.hash).toContain('/edit'); }); it(`should click on the active checkbox and receive an error to save it because it is the default address`, async () => { diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js index 1ac6dca8b..ef58d48c5 100644 --- a/e2e/paths/client-module/06_add_address_notes.spec.js +++ b/e2e/paths/client-module/06_add_address_notes.spec.js @@ -37,9 +37,9 @@ describe('Client add address notes path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('address/index') - .url(); + .parsedUrl(); - expect(url).toContain('address/index'); + expect(url.hash).toContain('address/index'); }); it(`should click on the edit icon of the default address`, async () => { @@ -47,9 +47,9 @@ describe('Client add address notes path', () => { .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') .waitToClick(selectors.clientAddresses.firstEditButton) .waitForURL('/edit') - .url(); + .parsedUrl(); - expect(url).toContain('/edit'); + expect(url.hash).toContain('/edit'); }); it('should not save a description without observation type', async () => { diff --git a/e2e/paths/client-module/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js index 79077a74c..40e61ba98 100644 --- a/e2e/paths/client-module/07_edit_web_access.spec.js +++ b/e2e/paths/client-module/07_edit_web_access.spec.js @@ -38,9 +38,9 @@ describe('Client Edit web access path', () => { .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientWebAccess.webAccessButton) .waitForURL('web-access') - .url(); + .parsedUrl(); - expect(url).toContain('web-access'); + expect(url.hash).toContain('web-access'); }); it(`should uncheck the Enable web access checkbox and update the name`, async () => { @@ -70,7 +70,7 @@ describe('Client Edit web access path', () => { it('should confirm web access name have been updated', async () => { const result = await nightmare - .getInputValue(selectors.clientWebAccess.userNameInput); + .waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value'); expect(result).toEqual('Hulk'); }); diff --git a/e2e/paths/client-module/08_add_notes.spec.js b/e2e/paths/client-module/08_add_notes.spec.js index 56f1cadf5..7d731da1d 100644 --- a/e2e/paths/client-module/08_add_notes.spec.js +++ b/e2e/paths/client-module/08_add_notes.spec.js @@ -37,18 +37,18 @@ describe('Client Add notes path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientNotes.notesButton) .waitForURL('note/index') - .url(); + .parsedUrl(); - expect(url).toContain('note/index'); + expect(url.hash).toContain('note/index'); }); it(`should click on the add note button`, async () => { const url = await nightmare .waitToClick(selectors.clientNotes.addNoteFloatButton) .waitForURL('/note/create') - .url(); + .parsedUrl(); - expect(url).toContain('/note/create'); + expect(url.hash).toContain('/note/create'); }); it(`should create a note`, async () => { @@ -62,8 +62,7 @@ describe('Client Add notes path', () => { it('should confirm the note was created', async () => { const result = await nightmare - .wait(selectors.clientNotes.firstNoteText) - .getInnerText(selectors.clientNotes.firstNoteText); + .waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText'); expect(result).toEqual('Meeting with Black Widow 21st 9am'); }); diff --git a/e2e/paths/client-module/09_add_credit.spec.js b/e2e/paths/client-module/09_add_credit.spec.js index a34abdfaa..16761926a 100644 --- a/e2e/paths/client-module/09_add_credit.spec.js +++ b/e2e/paths/client-module/09_add_credit.spec.js @@ -37,18 +37,18 @@ describe('Client Add credit path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientCredit.creditButton) .waitForURL('credit/index') - .url(); + .parsedUrl(); - expect(url).toContain('credit/index'); + expect(url.hash).toContain('credit/index'); }); it(`should click on the add credit button`, async () => { const url = await nightmare .waitToClick(selectors.clientCredit.addCreditFloatButton) .waitForURL('/credit/create') - .url(); + .parsedUrl(); - expect(url).toContain('/credit/create'); + expect(url.hash).toContain('/credit/create'); }); it(`should edit the credit`, async () => { @@ -63,8 +63,7 @@ describe('Client Add credit path', () => { it('should confirm the credit was updated', async () => { const result = await nightmare - .wait(selectors.clientCredit.firstCreditText) - .getInnerText(selectors.clientCredit.firstCreditText); + .waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText'); expect(result).toContain(999); expect(result).toContain('salesAssistant'); diff --git a/e2e/paths/client-module/10_add_greuge.spec.js b/e2e/paths/client-module/10_add_greuge.spec.js index 9d2ba56e8..d61f5ead9 100644 --- a/e2e/paths/client-module/10_add_greuge.spec.js +++ b/e2e/paths/client-module/10_add_greuge.spec.js @@ -37,18 +37,18 @@ describe('Client Add greuge path', () => { .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientGreuge.greugeButton) .waitForURL('greuge/index') - .url(); + .parsedUrl(); - expect(url).toContain('greuge/index'); + expect(url.hash).toContain('greuge/index'); }); it(`should click on the add greuge button`, async () => { const url = await nightmare .waitToClick(selectors.clientGreuge.addGreugeFloatButton) .waitForURL('greuge/create') - .url(); + .parsedUrl(); - expect(url).toContain('greuge/create'); + expect(url.hash).toContain('greuge/create'); }); it(`should receive an error if all fields are empty but date and type on submit`, async () => { @@ -74,8 +74,7 @@ describe('Client Add greuge path', () => { it('should confirm the greuge was added to the list', async () => { const result = await nightmare - .wait(selectors.clientGreuge.firstGreugeText) - .getInnerText(selectors.clientGreuge.firstGreugeText); + .waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText'); expect(result).toContain(999); expect(result).toContain('new armor for Batman!'); diff --git a/e2e/paths/client-module/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js index ec7e792cb..a88fe525c 100644 --- a/e2e/paths/client-module/11_mandate.spec.js +++ b/e2e/paths/client-module/11_mandate.spec.js @@ -38,15 +38,14 @@ describe('Client mandate path', () => { .waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientMandate.mandateButton) .waitForURL('mandate') - .url(); + .parsedUrl(); - expect(url).toContain('mandate'); + expect(url.hash).toContain('mandate'); }); it('should confirm the client has a mandate of the CORE type', async () => { const result = await nightmare - .wait(selectors.clientMandate.firstMandateText) - .getInnerText(selectors.clientMandate.firstMandateText); + .waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText'); expect(result).toContain('1'); expect(result).toContain('VNL'); diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js index 30f52a22e..822c4f619 100644 --- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js @@ -78,8 +78,7 @@ describe('Client lock verified data path', () => { .waitToClick(selectors.clientBasicData.basicDataButton) .wait(selectors.clientBasicData.nameInput) .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput); + .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('salesPerson was here'); }); @@ -182,8 +181,7 @@ describe('Client lock verified data path', () => { .waitToClick(selectors.clientBasicData.basicDataButton) .wait(selectors.clientBasicData.nameInput) .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput); + .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('administrative was here'); }); @@ -335,8 +333,7 @@ describe('Client lock verified data path', () => { .waitToClick(selectors.clientBasicData.basicDataButton) .wait(selectors.clientBasicData.nameInput) .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .wait(selectors.clientFiscalData.socialNameInput) - .getInputValue(selectors.clientFiscalData.socialNameInput); + .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value'); expect(result).toEqual('salesAssistant was here'); }); diff --git a/e2e/paths/client-module/13_log.spec.js b/e2e/paths/client-module/13_log.spec.js index fe167e3b1..616041da6 100644 --- a/e2e/paths/client-module/13_log.spec.js +++ b/e2e/paths/client-module/13_log.spec.js @@ -64,14 +64,14 @@ describe('Client log path', () => { it('should check the previous value of the last logged change', async () => { let lastModificationPreviousValue = await nightmare - .getInnerText(selectors.clientLog.lastModificationPreviousValue); + .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText'); expect(lastModificationPreviousValue).toContain('DavidCharlesHaller'); }); it('should check the current value of the last logged change', async () => { let lastModificationCurrentValue = await nightmare - .getInnerText(selectors.clientLog.lastModificationCurrentValue); + .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText'); expect(lastModificationCurrentValue).toContain('this is a test'); }); diff --git a/e2e/paths/item-module/01_item_summary.spec.js b/e2e/paths/item-module/01_item_summary.spec.js index 6b7038806..1ba685efc 100644 --- a/e2e/paths/item-module/01_item_summary.spec.js +++ b/e2e/paths/item-module/01_item_summary.spec.js @@ -45,7 +45,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from basic data`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') - .getInnerText(selectors.itemSummary.basicData); + .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Name: Gem of Time'); }); @@ -53,7 +53,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from tags`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') - .getInnerText(selectors.itemSummary.tags); + .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Color: Yellow'); }); @@ -61,7 +61,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from niche`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') - .getInnerText(selectors.itemSummary.niche); + .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('Warehouse One: A1'); }); @@ -69,7 +69,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from botanical`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') - .getInnerText(selectors.itemSummary.botanical); + .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('Botanical: Hedera helix'); }); @@ -77,7 +77,7 @@ describe('Item summary path', () => { it(`should check the item summary preview shows fields from barcode`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.barcode, '1') - .getInnerText(selectors.itemSummary.barcode); + .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('1'); }); @@ -119,7 +119,7 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from basic data`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') - .getInnerText(selectors.itemSummary.basicData); + .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Name: Gem of Mind'); }); @@ -127,7 +127,7 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from tags`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.tags, 'Color: Red') - .getInnerText(selectors.itemSummary.tags); + .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Color: Red'); }); @@ -135,7 +135,7 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from niche`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4') - .getInnerText(selectors.itemSummary.niche); + .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('Warehouse One: A4'); }); @@ -143,7 +143,7 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from botanical`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -') - .getInnerText(selectors.itemSummary.botanical); + .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('Botanical: -'); }); @@ -151,7 +151,7 @@ describe('Item summary path', () => { it(`should now check the item summary preview shows fields from barcode`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.barcode, '4') - .getInnerText(selectors.itemSummary.barcode); + .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('4'); }); @@ -176,35 +176,35 @@ describe('Item summary path', () => { it(`should check the item summary shows fields from basic data section`, async () => { const result = await nightmare .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') - .getInnerText(selectors.itemSummary.basicData); + .waitToGetProperty(selectors.itemSummary.basicData, 'innerText'); expect(result).toContain('Name: Gem of Mind'); }); it(`should check the item summary shows fields from tags section`, async () => { const result = await nightmare - .getInnerText(selectors.itemSummary.tags); + .waitToGetProperty(selectors.itemSummary.tags, 'innerText'); expect(result).toContain('Color: Red'); }); it(`should check the item summary shows fields from niches section`, async () => { const result = await nightmare - .getInnerText(selectors.itemSummary.niche); + .waitToGetProperty(selectors.itemSummary.niche, 'innerText'); expect(result).toContain('Warehouse One: A4'); }); it(`should check the item summary shows fields from botanical section`, async () => { const result = await nightmare - .getInnerText(selectors.itemSummary.botanical); + .waitToGetProperty(selectors.itemSummary.botanical, 'innerText'); expect(result).toContain('Botanical: -'); }); it(`should check the item summary shows fields from barcodes section`, async () => { const result = await nightmare - .getInnerText(selectors.itemSummary.barcode); + .waitToGetProperty(selectors.itemSummary.barcode, 'innerText'); expect(result).toContain('4'); }); diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js index a446877b0..f154109a1 100644 --- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -35,9 +35,9 @@ describe('Item Edit basic data path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemBasicData.basicDataButton) .waitForURL('data') - .url(); + .parsedUrl(); - expect(url).toContain('data'); + expect(url.hash).toContain('data'); }); it(`should edit the item basic data`, async () => { diff --git a/e2e/paths/item-module/03_edit_item_tax.spec.js b/e2e/paths/item-module/03_edit_item_tax.spec.js index e0cf5aaad..fa9d86053 100644 --- a/e2e/paths/item-module/03_edit_item_tax.spec.js +++ b/e2e/paths/item-module/03_edit_item_tax.spec.js @@ -35,9 +35,9 @@ describe('Item edit tax path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemTax.taxButton) .waitForURL('tax') - .url(); + .parsedUrl(); - expect(url).toContain('tax'); + expect(url.hash).toContain('tax'); }); it(`should add the item tax to all countries`, async () => { @@ -61,21 +61,21 @@ describe('Item edit tax path', () => { .click(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton) .waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced') - .getInputValue(selectors.itemTax.firstClassSelect); + .waitToGetProperty(selectors.itemTax.firstClassSelect, 'value'); expect(firstVatType).toEqual('Reduced VAT'); }); it(`should confirm the second item tax class was edited`, async () => { const secondVatType = await nightmare - .getInputValue(selectors.itemTax.secondClassSelect); + .waitToGetProperty(selectors.itemTax.secondClassSelect, 'value'); expect(secondVatType).toEqual('General VAT'); }); it(`should confirm the third item tax class was edited`, async () => { const thirdVatType = await nightmare - .getInputValue(selectors.itemTax.thirdClassSelect); + .waitToGetProperty(selectors.itemTax.thirdClassSelect, 'value'); expect(thirdVatType).toEqual('Reduced VAT'); }); diff --git a/e2e/paths/item-module/04_create_item_tags.spec.js b/e2e/paths/item-module/04_create_item_tags.spec.js index 486f42f7c..e90a985ca 100644 --- a/e2e/paths/item-module/04_create_item_tags.spec.js +++ b/e2e/paths/item-module/04_create_item_tags.spec.js @@ -35,9 +35,9 @@ describe('Item create tags path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemTags.tagsButton) .waitForURL('tags') - .url(); + .parsedUrl(); - expect(url).toContain('tags'); + expect(url.hash).toContain('tags'); }); it(`should create a new tag and delete a former one`, async () => { diff --git a/e2e/paths/item-module/05_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js index fe14f4735..d743e973f 100644 --- a/e2e/paths/item-module/05_create_item_niche.spec.js +++ b/e2e/paths/item-module/05_create_item_niche.spec.js @@ -35,9 +35,9 @@ describe('Item create niche path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemNiches.nicheButton) .waitForURL('niche') - .url(); + .parsedUrl(); - expect(url).toContain('niche'); + expect(url.hash).toContain('niche'); }); it(`should click create a new niche and delete a former one`, async () => { @@ -59,22 +59,22 @@ describe('Item create niche path', () => { .wait(selectors.itemBasicData.nameInput) .click(selectors.itemNiches.nicheButton) .waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One') - .getInputValue(selectors.itemNiches.firstWarehouseSelect); + .waitToGetProperty(selectors.itemNiches.firstWarehouseSelect, 'value'); expect(result).toEqual('Warehouse One'); result = await nightmare - .getInputValue(selectors.itemNiches.firstCodeInput); + .waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value'); expect(result).toEqual('A1'); }); it(`should confirm the second niche is the expected one`, async () => { let result = await nightmare - .getInputValue(selectors.itemNiches.secondWarehouseSelect); + .waitToGetProperty(selectors.itemNiches.secondWarehouseSelect, 'value'); expect(result).toEqual('Warehouse Three'); result = await nightmare - .getInputValue(selectors.itemNiches.secondCodeInput); + .waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value'); expect(result).toEqual('A3'); @@ -82,11 +82,11 @@ describe('Item create niche path', () => { it(`should confirm the third niche is the expected one`, async () => { let result = await nightmare - .getInputValue(selectors.itemNiches.thirdWarehouseSelect); + .waitToGetProperty(selectors.itemNiches.thirdWarehouseSelect, 'value'); expect(result).toEqual('Warehouse Two'); result = await nightmare - .getInputValue(selectors.itemNiches.thirdCodeInput); + .waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value'); expect(result).toEqual('A4'); }); diff --git a/e2e/paths/item-module/06_create_item_botanical.spec.js b/e2e/paths/item-module/06_create_item_botanical.spec.js index 1c3880f88..288992a2a 100644 --- a/e2e/paths/item-module/06_create_item_botanical.spec.js +++ b/e2e/paths/item-module/06_create_item_botanical.spec.js @@ -35,9 +35,9 @@ describe('Item Create botanical path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemBotanical.botanicalButton) .waitForURL('botanical') - .url(); + .parsedUrl(); - expect(url).toContain('botanical'); + expect(url.hash).toContain('botanical'); }); it(`should create a new botanical for the item with id Mjolnir`, async () => { @@ -59,7 +59,7 @@ describe('Item Create botanical path', () => { .wait(selectors.itemBasicData.nameInput) .click(selectors.itemBotanical.botanicalButton) .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') - .getInputValue(selectors.itemBotanical.botanicalInput); + .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); expect(result).toEqual('Cicuta maculata'); }); @@ -67,14 +67,14 @@ describe('Item Create botanical path', () => { it(`should confirm the Genus for item Mjolnir was created`, async () => { const result = await nightmare .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') - .getInputValue(selectors.itemBotanical.genusSelect); + .waitToGetProperty(selectors.itemBotanical.genusSelect, 'value'); expect(result).toEqual('Abelia'); }); it(`should confirm the Species for item Mjolnir was created`, async () => { const result = await nightmare - .getInputValue(selectors.itemBotanical.speciesSelect); + .waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value'); expect(result).toEqual('dealbata'); }); @@ -99,7 +99,7 @@ describe('Item Create botanical path', () => { .wait(selectors.itemBasicData.nameInput) .click(selectors.itemBotanical.botanicalButton) .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') - .getInputValue(selectors.itemBotanical.botanicalInput); + .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value'); expect(result).toEqual('Herp Derp'); }); @@ -107,14 +107,14 @@ describe('Item Create botanical path', () => { it(`should confirm the Genus for item Mjolnir was edited`, async () => { const result = await nightmare .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') - .getInputValue(selectors.itemBotanical.genusSelect); + .waitToGetProperty(selectors.itemBotanical.genusSelect, 'value'); expect(result).toEqual('Abies'); }); it(`should confirm the Species for item Mjolnir was edited`, async () => { const result = await nightmare - .getInputValue(selectors.itemBotanical.speciesSelect); + .waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value'); expect(result).toEqual('decurrens'); }); diff --git a/e2e/paths/item-module/07_create_item_barcode.spec.js b/e2e/paths/item-module/07_create_item_barcode.spec.js index 7e4eb7fa4..6416fbe87 100644 --- a/e2e/paths/item-module/07_create_item_barcode.spec.js +++ b/e2e/paths/item-module/07_create_item_barcode.spec.js @@ -35,9 +35,9 @@ describe('Item Create barcodes path', () => { .waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemBarcodes.barcodeButton) .waitForURL('barcode') - .url(); + .parsedUrl(); - expect(url).toContain('barcode'); + expect(url.hash).toContain('barcode'); }); it(`should click create a new code and delete a former one`, async () => { @@ -58,7 +58,7 @@ describe('Item Create barcodes path', () => { .wait(selectors.itemBasicData.nameInput) .click(selectors.itemBarcodes.barcodeButton) .waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') - .getInputValue(selectors.itemBarcodes.thirdCodeInput); + .waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value'); expect(result).toEqual('5'); }); diff --git a/e2e/paths/item-module/08_item_create_and_clone.spec.js b/e2e/paths/item-module/08_item_create_and_clone.spec.js index 3959b4c67..02a00e470 100644 --- a/e2e/paths/item-module/08_item_create_and_clone.spec.js +++ b/e2e/paths/item-module/08_item_create_and_clone.spec.js @@ -73,14 +73,13 @@ describe('Item Create/Clone path', () => { it('should confirm Infinity Gauntlet item was created', async () => { let result = await nightmare - .wait(selectors.itemBasicData.nameInput) - .getInputValue(selectors.itemBasicData.nameInput); + .waitToGetProperty(selectors.itemBasicData.nameInput, 'value'); expect(result).toEqual('Infinity Gauntlet'); result = await nightmare - .getInputValue(selectors.itemBasicData.typeSelect); + .waitToGetProperty(selectors.itemBasicData.typeSelect, 'value'); expect(result).toEqual('Crisantemo'); @@ -90,7 +89,7 @@ describe('Item Create/Clone path', () => { expect(result).toEqual('6021010 Plantas vivas: Esqueje/injerto, Vid'); result = await nightmare - .getInputValue(selectors.itemBasicData.originSelect); + .waitToGetProperty(selectors.itemBasicData.originSelect, 'value'); expect(result).toEqual('Spain'); }); diff --git a/e2e/paths/item-module/09_regularize_item.spec.js b/e2e/paths/item-module/09_regularize_item.spec.js index 5b8e1d896..c21884483 100644 --- a/e2e/paths/item-module/09_regularize_item.spec.js +++ b/e2e/paths/item-module/09_regularize_item.spec.js @@ -33,9 +33,9 @@ describe('Item regularize path', () => { .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .waitToClick(selectors.itemsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should regularize the item', async () => { @@ -79,22 +79,22 @@ describe('Item regularize path', () => { .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it(`should check the ticket sale quantity is showing a negative value`, async () => { const result = await nightmare .waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100') - .getInnerText(selectors.ticketSummary.firstSaleQuantity); + .waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText'); expect(result).toContain('-100'); }); it(`should check the ticket sale discount is 100%`, async () => { const result = await nightmare - .getInnerText(selectors.ticketSummary.firstSaleDiscount); + .waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText'); expect(result).toContain('100 %'); }); @@ -126,9 +126,9 @@ describe('Item regularize path', () => { .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .waitToClick(selectors.itemsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should regularize the item once more', async () => { @@ -172,9 +172,9 @@ describe('Item regularize path', () => { .waitForTextInElement(selectors.ticketsIndex.searchResult, '22') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it(`should check the ticket contains now two sales`, async () => { diff --git a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js index 4073e9ea4..50d2794a7 100644 --- a/e2e/paths/ticket-module/01_create_ticket_observations.spec.js +++ b/e2e/paths/ticket-module/01_create_ticket_observations.spec.js @@ -10,73 +10,63 @@ describe('Ticket', () => { .waitForLogin('employee'); }); - it('should access to the tickets index by clicking the tickets button', done => { - return nightmare + it('should access to the tickets index by clicking the tickets button', async () => { + let url = await nightmare .click(selectors.moduleAccessView.ticketsSectionButton) .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/index'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toEqual('#!/ticket/index'); }); - it('should search for the ticket with id 1', done => { - return nightmare + it('should search for the ticket with id 1', async () => { + let result = await nightmare .wait(selectors.ticketsIndex.searchTicketInput) .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - done(); - }).catch(done.fail); + .countElement(selectors.ticketsIndex.searchResult); + + expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket notes`, done => { - return nightmare + it(`should click on the search result to access to the ticket notes`, async () => { + let url = await nightmare .waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketNotes.notesButton) .waitForURL('observation') - .url() - .then(url => { - expect(url).toContain('observation'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toContain('observation'); }); - it(`should click create a new note and delete a former one`, done => { - return nightmare + it(`should click create a new note and delete a former one`, async () => { + let result = await nightmare .waitToClick(selectors.ticketNotes.firstNoteRemoveButton) .waitToClick(selectors.ticketNotes.addNoteButton) .waitToClick(selectors.ticketNotes.firstNoteSelect) .waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption) .type(selectors.ticketNotes.firstDescriptionInput, 'description') .click(selectors.ticketNotes.submitNotesButton) - .waitForLastSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - done(); - }).catch(done.fail); + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); }); - it(`should confirm the note is the expected one`, done => { - return nightmare + it(`should confirm the note is the expected one`, async () => { + let firstNoteSelect = await nightmare .click(selectors.ticketPackages.packagesButton) .wait(selectors.ticketPackages.firstPackageSelect) .click(selectors.ticketNotes.notesButton) - .waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value') - .then(result => { - expect(result).toEqual('observation one'); - return nightmare - .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); - }) - .then(result => { - expect(result).toEqual('description'); - done(); - }).catch(done.fail); + .waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value'); + + expect(firstNoteSelect).toEqual('observation one'); + + let firstDescription = await nightmare + .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); + + expect(firstDescription).toEqual('description'); }); }); }); diff --git a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js index d5f5ccc70..ffd71aeee 100644 --- a/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js +++ b/e2e/paths/ticket-module/02_delete_ticket_expeditions.spec.js @@ -36,9 +36,9 @@ describe('Ticket', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketExpedition.expeditionButton) .waitForURL('expedition') - .url(); + .parsedUrl(); - expect(url).toContain('expedition'); + expect(url.hash).toContain('expedition'); }); it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => { diff --git a/e2e/paths/ticket-module/03_list_sale.spec.js b/e2e/paths/ticket-module/03_list_sale.spec.js index 06de70a4d..f6fd79869 100644 --- a/e2e/paths/ticket-module/03_list_sale.spec.js +++ b/e2e/paths/ticket-module/03_list_sale.spec.js @@ -37,47 +37,42 @@ describe('Ticket List sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it('should confirm the first ticket sale contains the colour', async () => { const value = await nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleColour); + .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText'); expect(value).toContain('Red'); }); it('should confirm the first ticket sale contains the lenght', async () => { const value = await nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleText); + .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText'); expect(value).toContain('3'); }); it('should confirm the first ticket sale contains the price', async () => { const value = await nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSalePrice); + .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); expect(value).toContain('1.30'); }); it('should confirm the first ticket sale contains the discount', async () => { const value = await nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleDiscount); + .waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText'); expect(value).toContain('0 %'); }); it('should confirm the first ticket sale contains the total import', async () => { const value = await nightmare - .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleImport); + .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); expect(value).toContain('19.50'); }); @@ -86,8 +81,8 @@ describe('Ticket List sale path', () => { const url = await nightmare .waitToClick(selectors.ticketSales.newItemButton) .waitForURL('/catalog') - .url(); + .parsedUrl(); - expect(url).toContain('/catalog'); + expect(url.hash).toContain('/catalog'); }); }); diff --git a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js index bde9a3505..f944d08b4 100644 --- a/e2e/paths/ticket-module/04_create_ticket_packages.spec.js +++ b/e2e/paths/ticket-module/04_create_ticket_packages.spec.js @@ -37,9 +37,9 @@ describe('Ticket Create packages path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketPackages.packagesButton) .waitForURL('package/index') - .url(); + .parsedUrl(); - expect(url).toContain('package/index'); + expect(url.hash).toContain('package/index'); }); it(`should delete the first package and receive and error to save a new one with blank quantity`, async () => { @@ -101,7 +101,7 @@ describe('Ticket Create packages path', () => { .wait(selectors.ticketSales.firstPackageSelect) .click(selectors.ticketPackages.packagesButton) .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box') - .getInputValue(selectors.ticketPackages.firstPackageSelect); + .waitToGetProperty(selectors.ticketPackages.firstPackageSelect, 'value'); expect(result).toEqual('7 : Legendary Box'); }); @@ -109,7 +109,7 @@ describe('Ticket Create packages path', () => { it(`should confirm the first quantity is the expected one`, async () => { const result = await nightmare .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') - .getInputValue(selectors.ticketPackages.firstQuantityInput); + .waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value'); expect(result).toEqual('99'); }); diff --git a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js index 3fab84ec8..fe15c389b 100644 --- a/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js +++ b/e2e/paths/ticket-module/05_create_new_tracking_state.spec.js @@ -10,100 +10,84 @@ describe('Ticket', () => { .waitForLogin('production'); }); - it('should click on the Tickets button of the top bar menu', done => { - return nightmare + it('should click on the Tickets button of the top bar menu', async () => { + let url = await nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.globalItems.applicationsMenuVisible) .waitToClick(selectors.globalItems.ticketsButton) .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/index'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toEqual('#!/ticket/index'); }); - it('should search for the ticket 1', done => { - return nightmare + it('should search for the ticket 1', async () => { + let result = await nightmare .wait(selectors.ticketsIndex.searchTicketInput) .type(selectors.ticketsIndex.searchTicketInput, 'id:1') .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - done(); - }).catch(done.fail); + .countElement(selectors.ticketsIndex.searchResult); + + expect(result).toEqual(1); }); - it(`should click on the search result to access to the ticket Tracking`, done => { - return nightmare + it(`should click on the search result to access to the ticket Tracking`, async () => { + let url = await nightmare .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketTracking.trackingButton) .waitForURL('tracking/index') - .url() - .then(url => { - expect(url).toContain('tracking/index'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toContain('tracking/index'); }); - it('should access to the create state view by clicking the create floating button', done => { - return nightmare + it('should access to the create state view by clicking the create floating button', async () => { + let url = await nightmare .click(selectors.ticketTracking.createStateButton) .wait(selectors.createStateView.stateInput) - .parsedUrl() - .then(url => { - expect(url.hash).toContain('tracking/edit'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toContain('tracking/edit'); }); - it(`should attempt create a new state but receive an error if state is empty`, done => { - return nightmare + it(`should attempt create a new state but receive an error if state is empty`, async () => { + let result = await nightmare .click(selectors.createStateView.saveStateButton) - .waitForLastSnackbar() - .then(result => { - expect(result).toEqual('No changes to save'); - done(); - }).catch(done.fail); + .waitForLastSnackbar(); + + expect(result).toEqual('No changes to save'); }); - it(`should attempt create a new state then clear and save it`, done => { - return nightmare + it(`should attempt create a new state then clear and save it`, async () => { + let result = await nightmare .waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.clearStateInputButton) .click(selectors.createStateView.saveStateButton) - .waitForLastSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - done(); - }).catch(done.fail); + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); }); - it('should again access to the create state view by clicking the create floating button', done => { - return nightmare + it('should again access to the create state view by clicking the create floating button', async () => { + let url = await nightmare .click(selectors.ticketTracking.createStateButton) .wait(selectors.createStateView.stateInput) - .parsedUrl() - .then(url => { - expect(url.hash).toContain('tracking/edit'); - done(); - }).catch(done.fail); + .parsedUrl(); + + expect(url.hash).toContain('tracking/edit'); }); - it(`should create a new state`, done => { - return nightmare + it(`should create a new state`, async () => { + let result = await nightmare .waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInputOptionOne) .click(selectors.createStateView.saveStateButton) - .waitForLastSnackbar() - .then(result => { - expect(result).toEqual('Data saved!'); - done(); - }).catch(done.fail); + .waitForLastSnackbar(); + + expect(result).toEqual('Data saved!'); }); }); }); diff --git a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js index 111db197c..2b0c875c5 100644 --- a/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js +++ b/e2e/paths/ticket-module/06_edit_basic_data_steps.spec.js @@ -1,162 +1,136 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/nightmare'; -describe('Ticket', () => { - describe('Edit basic data path', () => { - const nightmare = createNightmare(); +describe('Ticket Edit basic data path', () => { + const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('employee'); - }); + beforeAll(() => { + return nightmare + .waitForLogin('employee'); + }); - it('should click on the Tickets button of the top bar menu', done => { - return nightmare - .waitToClick(selectors.globalItems.applicationsMenuButton) - .wait(selectors.globalItems.applicationsMenuVisible) - .waitToClick(selectors.globalItems.ticketsButton) - .wait(selectors.ticketsIndex.searchTicketInput) - .parsedUrl() - .then(url => { - expect(url.hash).toEqual('#!/ticket/index'); - done(); - }).catch(done.fail); - }); + it('should click on the Tickets button of the top bar menu', async () => { + let url = await nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.ticketsButton) + .wait(selectors.ticketsIndex.searchTicketInput) + .parsedUrl(); - it('should search for the ticket 11', done => { - return nightmare - .wait(selectors.ticketsIndex.searchTicketInput) - .type(selectors.ticketsIndex.searchTicketInput, 'id:11') - .click(selectors.ticketsIndex.searchButton) - .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) - .countElement(selectors.ticketsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - done(); - }).catch(done.fail); - }); + expect(url.hash).toEqual('#!/ticket/index'); + }); - it(`should click on the search result to access to the ticket Basic Data`, done => { - return nightmare - .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne - .waitToClick(selectors.ticketsIndex.searchResult) - .waitToClick(selectors.ticketBasicData.basicDataButton) - .waitForURL('data/step-one') - .url() - .then(url => { - expect(url).toContain('data/step-one'); - done(); - }).catch(done.fail); - }); + it('should search for the ticket 11', async () => { + let result = await nightmare + .wait(selectors.ticketsIndex.searchTicketInput) + .type(selectors.ticketsIndex.searchTicketInput, 'id:11') + .click(selectors.ticketsIndex.searchButton) + .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) + .countElement(selectors.ticketsIndex.searchResult); - it(`should edit the client and address of the ticket then click next`, done => { - return nightmare - .waitToClick(selectors.ticketBasicData.clientSelect) - .waitToClick(selectors.ticketBasicData.clientSelectThirdOption) - .wait(500) - .waitToClick(selectors.ticketBasicData.addressSelect) - .waitToClick(selectors.ticketBasicData.addressSelectSecondOption) - .waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier') - .click(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-two') - .url() - .then(url => { - expect(url).toContain('data/step-two'); - done(); - }).catch(done.fail); - }); + expect(result).toEqual(1); + }); - it(`should have no price diference`, done => { - return nightmare - .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) - .then(result => { - expect(result).toContain('0'); - done(); - }).catch(done.fail); - }); + it(`should click on the search result to access to the ticket Basic Data`, async () => { + let url = await nightmare + .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne + .waitToClick(selectors.ticketsIndex.searchResult) + .waitToClick(selectors.ticketBasicData.basicDataButton) + .waitForURL('data/step-one') + .parsedUrl(); - it(`should click next to move on to step three`, done => { - return nightmare - .click(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-three') - .url() - .then(url => { - expect(url).toContain('data/step-three'); - done(); - }).catch(done.fail); - }); + expect(url.hash).toContain('data/step-one'); + }); - it(`should select a reason for the changes made then click on finalize`, done => { - return nightmare - .waitToClick(selectors.ticketBasicData.chargesReason) - .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) - .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios') - .click(selectors.ticketBasicData.finalizeButton) - .waitForURL('summary') - .url() - .then(url => { - expect(url).toContain('summary'); - done(); - }).catch(done.fail); - }); + it(`should edit the client and address of the ticket then click next`, async () => { + let url = await nightmare + .waitToClick(selectors.ticketBasicData.clientSelect) + .waitToClick(selectors.ticketBasicData.clientSelectThirdOption) + .wait(500) + .waitToClick(selectors.ticketBasicData.addressSelect) + .waitToClick(selectors.ticketBasicData.addressSelectSecondOption) + .waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier') + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-two') + .parsedUrl(); - it(`should go back to ticket.basicData section`, done => { - return nightmare - .waitToClick(selectors.ticketBasicData.basicDataButton) - .waitForURL('data/step-one') - .url() - .then(url => { - expect(url).toContain('data/step-one'); - done(); - }).catch(done.fail); - }); + expect(url.hash).toContain('data/step-two'); + }); - it(`should edit the ticket agency then click next`, done => { - return nightmare - .waitToClick(selectors.ticketBasicData.agencySelect) - .waitToClick(selectors.ticketBasicData.agencySelectOptionSix) - .waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive') - .click(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-two') - .url() - .then(url => { - expect(url).toContain('data/step-two'); - done(); - }).catch(done.fail); - }); + it(`should have no price diference`, async () => { + const result = await nightmare + .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); - it(`should have a price diference`, done => { - return nightmare - .getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) - .then(result => { - expect(result).toContain('-20.65 €'); - done(); - }).catch(done.fail); - }); + expect(result).toContain('0'); + }); - it(`should then click next to move on to step three`, done => { - return nightmare - .click(selectors.ticketBasicData.nextStepButton) - .waitForURL('data/step-three') - .url() - .then(url => { - expect(url).toContain('data/step-three'); - done(); - }).catch(done.fail); - }); + it(`should click next to move on to step three`, async () => { + let url = await nightmare + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-three') + .parsedUrl(); - it(`should select a new reason for the changes made then click on finalize`, done => { - return nightmare - .waitToClick(selectors.ticketBasicData.chargesReason) - .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) - .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket') - .click(selectors.ticketBasicData.finalizeButton) - .waitForURL('summary') - .url() - .then(url => { - expect(url).toContain('summary'); - done(); - }).catch(done.fail); - }); + expect(url.hash).toContain('data/step-three'); + }); + + it(`should select a reason for the changes made then click on finalize`, async () => { + let url = await nightmare + .waitToClick(selectors.ticketBasicData.chargesReason) + .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) + .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios') + .click(selectors.ticketBasicData.finalizeButton) + .waitForURL('summary') + .parsedUrl(); + + expect(url.hash).toContain('summary'); + }); + + it(`should go back to ticket.basicData section`, async () => { + let url = await nightmare + .waitToClick(selectors.ticketBasicData.basicDataButton) + .waitForURL('data/step-one') + .parsedUrl(); + + expect(url.hash).toContain('data/step-one'); + }); + + it(`should edit the ticket agency then click next`, async () => { + let url = await nightmare + .waitToClick(selectors.ticketBasicData.agencySelect) + .waitToClick(selectors.ticketBasicData.agencySelectOptionSix) + .waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive') + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-two') + .parsedUrl(); + + expect(url.hash).toContain('data/step-two'); + }); + + it(`should have a price diference`, async () => { + const result = await nightmare + .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText'); + + expect(result).toContain('-20.65 €'); + }); + + it(`should then click next to move on to step three`, async () => { + let url = await nightmare + .click(selectors.ticketBasicData.nextStepButton) + .waitForURL('data/step-three') + .parsedUrl(); + + expect(url.hash).toContain('data/step-three'); + }); + + it(`should select a new reason for the changes made then click on finalize`, async () => { + let url = await nightmare + .waitToClick(selectors.ticketBasicData.chargesReason) + .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) + .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket') + .click(selectors.ticketBasicData.finalizeButton) + .waitForURL('summary') + .parsedUrl(); + + expect(url.hash).toContain('summary'); }); }); diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index cbbe1a4bd..f568f5911 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -37,9 +37,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it(`should click on the first claim id to navigate over there`, async () => { @@ -80,9 +80,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it(`should check the zoomed image isnt present`, async () => { @@ -144,9 +144,9 @@ describe('Ticket Edit sale path', () => { const url = await nightmare .waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should return to ticket sales section', async () => { @@ -162,9 +162,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it('should try to add a higher quantity value and then receive an error', async () => { @@ -198,14 +198,14 @@ describe('Ticket Edit sale path', () => { it('should confirm the price have been updated', async () => { const result = await nightmare - .getInnerText(selectors.ticketSales.firstSalePrice); + .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText'); expect(result).toContain('5.00'); }); it('should confirm the total price for that item have been updated', async () => { const result = await nightmare - .getInnerText(selectors.ticketSales.firstSaleImport); + .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); expect(result).toContain('20.00'); }); @@ -224,7 +224,7 @@ describe('Ticket Edit sale path', () => { it('should confirm the discount have been updated', async () => { const result = await nightmare .waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %') - .getInnerText(selectors.ticketSales.firstSaleDiscount); + .waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText'); expect(result).toContain('50 %'); }); @@ -232,7 +232,7 @@ describe('Ticket Edit sale path', () => { it('should confirm the total import for that item have been updated', async () => { const result = await nightmare .waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00') - .getInnerText(selectors.ticketSales.firstSaleImport); + .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText'); expect(result).toContain('10.00'); }); @@ -298,9 +298,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it('should select the third sale and delete it', async () => { @@ -338,15 +338,15 @@ describe('Ticket Edit sale path', () => { .type(selectors.ticketSales.moveToTicketInput, 12) .waitToClick(selectors.ticketSales.moveToTicketButton) .waitForURL('ticket/12/sale') - .url(); + .parsedUrl(); - expect(result).toContain(`ticket/12/sale`); + expect(result.hash).toContain(`ticket/12/sale`); }); it('should confirm the transfered line is the correct one', async () => { const result = await nightmare .wait(selectors.ticketSales.firstSaleText) - .getInnerText(selectors.ticketSales.firstSaleText); + .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText'); expect(result).toContain(`Mark I`); }); @@ -362,9 +362,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it(`should confirm the original ticket has only two lines now`, async () => { @@ -386,9 +386,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it('should transfer the sale back to the original ticket', async () => { @@ -399,9 +399,9 @@ describe('Ticket Edit sale path', () => { .type(selectors.ticketSales.moveToTicketInput, 16) .waitToClick(selectors.ticketSales.moveToTicketButton) .waitForURL('ticket/16/sale') - .url(); + .parsedUrl(); - expect(result).toContain(`ticket/16/sale`); + expect(result.hash).toContain(`ticket/16/sale`); }); it('should confirm the original ticket received the line', async () => { @@ -445,9 +445,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); it('should confirm the new ticket received both lines', async () => { @@ -495,7 +495,7 @@ describe('Ticket Edit sale path', () => { .type(selectors.ticketSales.moreMenuUpdateDiscountInput, 100) .type('body', '\u000d') // simulates enter .waitForTextInElement(selectors.ticketSales.totalImport, '0.00') - .getInnerText(selectors.ticketSales.totalImport); + .waitToGetProperty(selectors.ticketSales.totalImport, 'innerText'); expect(result).toContain('0.00'); }); @@ -530,18 +530,18 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketTracking.trackingButton) .waitForURL('/tracking/index') - .url(); + .parsedUrl(); - expect(url).toContain('/tracking/index'); + expect(url.hash).toContain('/tracking/index'); }); it(`should click on the edit ticket tracking state button`, async () => { const url = await nightmare .waitToClick(selectors.ticketTracking.createStateButton) .waitForURL('/tracking/edit') - .url(); + .parsedUrl(); - expect(url).toContain('/tracking/edit'); + expect(url.hash).toContain('/tracking/edit'); }); it(`should set the state of the ticket to preparation`, async () => { @@ -553,18 +553,18 @@ describe('Ticket Edit sale path', () => { .waitForTextInInput(selectors.ticketTracking.stateSelectInput, 'Preparación') .click(selectors.ticketTracking.saveButton) .waitForURL('/tracking/index') - .url(); + .parsedUrl(); - expect(url).toContain('/tracking/index'); + expect(url.hash).toContain('/tracking/index'); }); it(`should click on the ticket Sale menu button`, async () => { const url = await nightmare .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); describe('when state is preparation and loged as Production', () => { @@ -622,9 +622,9 @@ describe('Ticket Edit sale path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketSales.saleButton) .waitForURL('/sale') - .url(); + .parsedUrl(); - expect(url).toContain('/sale'); + expect(url.hash).toContain('/sale'); }); }); diff --git a/e2e/paths/ticket-module/08_list_components.spec.js b/e2e/paths/ticket-module/08_list_components.spec.js index 9a83eae6a..8bf89f0a9 100644 --- a/e2e/paths/ticket-module/08_list_components.spec.js +++ b/e2e/paths/ticket-module/08_list_components.spec.js @@ -37,9 +37,9 @@ describe('Ticket List components path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketComponents.componentsButton) .waitForURL('components') - .url(); + .parsedUrl(); - expect(url).toContain('components'); + expect(url.hash).toContain('components'); }); it('should confirm the total base is correct', async () => { diff --git a/e2e/paths/ticket-module/09_ticket_weekly.spec.js b/e2e/paths/ticket-module/09_ticket_weekly.spec.js index 3c55a0178..d2624c833 100644 --- a/e2e/paths/ticket-module/09_ticket_weekly.spec.js +++ b/e2e/paths/ticket-module/09_ticket_weekly.spec.js @@ -56,9 +56,9 @@ describe('Ticket descriptor path', () => { const url = await nightmare .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should add the ticket to thirsday turn using the descriptor more menu', async () => { @@ -117,9 +117,9 @@ describe('Ticket descriptor path', () => { const url = await nightmare .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should add the ticket to saturday turn using the descriptor more menu', async () => { diff --git a/e2e/paths/ticket-module/10_ticket_request.spec.js b/e2e/paths/ticket-module/10_ticket_request.spec.js index 3cd3ecb62..8891eb9d9 100644 --- a/e2e/paths/ticket-module/10_ticket_request.spec.js +++ b/e2e/paths/ticket-module/10_ticket_request.spec.js @@ -37,9 +37,9 @@ describe('Ticket purchase request path', () => { .waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketRequests.requestButton) .waitForURL('/request') - .url(); + .parsedUrl(); - expect(url).toContain('/request'); + expect(url.hash).toContain('/request'); }); it(`should add a new request`, async () => { @@ -60,9 +60,9 @@ describe('Ticket purchase request path', () => { it(`should have been redirected to the request index`, async () => { const url = await nightmare .waitForURL('/request') - .url(); + .parsedUrl(); - expect(url).toContain('/request'); + expect(url.hash).toContain('/request'); }); it(`should confirm the new request was added`, async () => { diff --git a/e2e/paths/ticket-module/11_ticket_diary.spec.js b/e2e/paths/ticket-module/11_ticket_diary.spec.js index 0543ceee0..f37eb1954 100644 --- a/e2e/paths/ticket-module/11_ticket_diary.spec.js +++ b/e2e/paths/ticket-module/11_ticket_diary.spec.js @@ -37,9 +37,9 @@ describe('Ticket diary path', () => { .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async () => { diff --git a/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js index 00940e4a4..8be68a07e 100644 --- a/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js +++ b/e2e/paths/ticket-module/12_delete_ticket_from_descriptor.spec.js @@ -36,9 +36,9 @@ describe('Ticket descriptor path', () => { .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26') .waitToClick(selectors.ticketsIndex.searchResult) .waitForURL('/summary') - .url(); + .parsedUrl(); - expect(url).toContain('/summary'); + expect(url.hash).toContain('/summary'); }); it('should delete the ticket using the descriptor more menu', async () => { @@ -65,7 +65,7 @@ describe('Ticket descriptor path', () => { .click(selectors.ticketsIndex.searchButton) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .wait(selectors.ticketsIndex.searchResultDate) - .getInnerText(selectors.ticketsIndex.searchResultDate); + .waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText'); expect(result).toContain(2000); }); diff --git a/services/auth/server/boot/specs/routes.spec.js b/services/auth/server/boot/specs/routes.spec.js index 32c1a8a96..1127b3e6a 100644 --- a/services/auth/server/boot/specs/routes.spec.js +++ b/services/auth/server/boot/specs/routes.spec.js @@ -2,11 +2,11 @@ const app = require('../../../server/server'); const routes = require('../routes'); describe('Auth routes', () => { - beforeEach(async() => { + beforeEach(async () => { await app.models.User.destroyById(102); }); - afterAll(async() => { + afterAll(async () => { await app.models.User.destroyById(102); });