Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
Gerard 2018-11-22 16:10:44 +01:00
commit 44a2ee24bc
41 changed files with 427 additions and 509 deletions

View File

@ -39,6 +39,7 @@
field="$ctrl.client.bankEntityFk" field="$ctrl.client.bankEntityFk"
fields="['name']" fields="['name']"
initial-data="$ctrl.client.bankEntityFk" initial-data="$ctrl.client.bankEntityFk"
on-change="$ctrl.autofillBic()"
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}" search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
value-field="id" value-field="id"
show-field="bic" show-field="bic"

View File

@ -28,7 +28,6 @@ export default class Controller {
if (this.hasPaymethodChanges()) if (this.hasPaymethodChanges())
shouldNotify = true; shouldNotify = true;
this.autofillBic();
this.$scope.watcher.submit().then(() => { this.$scope.watcher.submit().then(() => {
if (shouldNotify) if (shouldNotify)
this.notifyChanges(); this.notifyChanges();
@ -87,10 +86,13 @@ export default class Controller {
if (countryCode != 'ES') return; if (countryCode != 'ES') return;
let json = encodeURIComponent(JSON.stringify(filter)); let json = encodeURIComponent(JSON.stringify(filter));
this.client.bankEntityFk = undefined;
this.$http.get(`/client/api/BankEntities?filter=${json}`).then(response => { 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; this.client.bankEntityFk = response.data[0].id;
else if (!hasData)
this.client.bankEntityFk = null;
}); });
} }
} }

View File

@ -15,24 +15,22 @@ export default class Textfield extends Input {
this.hasMouseIn = false; this.hasMouseIn = false;
this.input.addEventListener('keydown', () => { this.input.addEventListener('keydown', () => {
if (!this.oldValue) { if (!this.oldValue)
this.saveOldValue(); this.saveOldValue();
}
}); });
this.input.addEventListener('keyup', e => { this.input.addEventListener('keyup', e => {
if (e.key == "Escape") { if (e.key == 'Escape') {
this.value = this.oldValue; this.value = this.oldValue;
this.cancelled = true; this.cancelled = true;
e.stopPropagation(); e.stopPropagation();
} }
if (e.key == "Escape" || e.key == "Enter") if (e.key == 'Escape' || e.key == 'Enter')
this.input.blur(); this.input.blur();
}); });
this.input.addEventListener('blur', () => { this.input.addEventListener('blur', () => {
if (this.onChange && !this.cancelled && if (this.onChange && !this.cancelled && (this.oldValue != this.value))
(this.oldValue && this.oldValue != this.value))
this.onChange(); this.onChange();
else else
this.cancelled = false; this.cancelled = false;

View File

@ -94,20 +94,6 @@ let actions = {
.then(result => done(null, result), done); .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) { write: function(selector, text, done) {
this.wait(selector) this.wait(selector)
.type(selector, text) .type(selector, text)
@ -163,20 +149,6 @@ let actions = {
}, done, selector); }, 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) { countElement: function(selector, done) {
this.evaluate_now(selector => { this.evaluate_now(selector => {
return document.querySelectorAll(selector).length; return document.querySelectorAll(selector).length;

View File

@ -36,9 +36,9 @@ describe('Claim edit basic data path', () => {
.waitToClick(selectors.claimsIndex.searchResult) .waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton) .waitToClick(selectors.claimBasicData.basicDataButton)
.waitForURL('basic-data') .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 () => { 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) .wait(selectors.claimDetails.addItemButton)
.click(selectors.claimBasicData.basicDataButton) .click(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateSelect) .wait(selectors.claimBasicData.claimStateSelect)
.getInputValue(selectors.claimBasicData.claimStateSelect); .waitToGetProperty(selectors.claimBasicData.claimStateSelect, 'value');
expect(result).toEqual('Gestionado'); expect(result).toEqual('Gestionado');
}); });
@ -76,7 +76,7 @@ describe('Claim edit basic data path', () => {
it('should confirm the claim observation was edited', async () => { it('should confirm the claim observation was edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.claimBasicData.observationInput); .waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
expect(result).toEqual('edited observation'); expect(result).toEqual('edited observation');
}); });

View File

@ -36,9 +36,9 @@ describe('Client Edit basicData path', () => {
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary') .waitForURL('summary')
.url(); .parsedUrl();
expect(url).toContain('summary'); expect(url.hash).toContain('summary');
}); });
it('should not be able to change the salesPerson', async () => { it('should not be able to change the salesPerson', async () => {
@ -77,43 +77,42 @@ describe('Client Edit basicData path', () => {
.click(selectors.clientFiscalData.fiscalDataButton) .click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput) .wait(selectors.clientFiscalData.addressInput)
.click(selectors.clientBasicData.basicDataButton) .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
.getInputValue(selectors.clientBasicData.nameInput);
expect(result).toEqual('Ptonomy Wallace'); expect(result).toEqual('Ptonomy Wallace');
}); });
it('should confirm the contact name have been edited', async () => { it('should confirm the contact name have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.contactInput); .waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
expect(result).toEqual('David Haller'); expect(result).toEqual('David Haller');
}); });
it('should confirm the landline phone number have been added', async () => { it('should confirm the landline phone number have been added', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.phoneInput); .waitToGetProperty(selectors.clientBasicData.phoneInput, 'value');
expect(result).toEqual('987654321'); expect(result).toEqual('987654321');
}); });
it('should confirm the mobile phone number have been added', async () => { it('should confirm the mobile phone number have been added', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.mobileInput); .waitToGetProperty(selectors.clientBasicData.mobileInput, 'value');
expect(result).toEqual('123456789'); expect(result).toEqual('123456789');
}); });
it('should confirm the email have been edited', async () => { it('should confirm the email have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.emailInput); .waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
expect(result).toEqual('PWallace@verdnatura.es'); expect(result).toEqual('PWallace@verdnatura.es');
}); });
it('should confirm the channel have been selected', async () => { it('should confirm the channel have been selected', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.channelInput); .waitToGetProperty(selectors.clientBasicData.channelInput, 'value');
expect(result).toEqual('Rumors on the streets'); expect(result).toEqual('Rumors on the streets');
}); });
@ -153,9 +152,9 @@ describe('Client Edit basicData path', () => {
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace') .waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace')
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary') .waitForURL('summary')
.url(); .parsedUrl();
expect(url).toContain('summary'); expect(url.hash).toContain('summary');
}); });
it('should be able to change the salesPerson', async () => { it('should be able to change the salesPerson', async () => {
@ -196,50 +195,49 @@ describe('Client Edit basicData path', () => {
.click(selectors.clientFiscalData.fiscalDataButton) .click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput) .wait(selectors.clientFiscalData.addressInput)
.click(selectors.clientBasicData.basicDataButton) .click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .waitToGetProperty(selectors.clientBasicData.nameInput, 'value');
.getInputValue(selectors.clientBasicData.nameInput);
expect(result).toEqual('Ororo Munroe'); expect(result).toEqual('Ororo Munroe');
}); });
it('should now confirm the contact name have been edited', async () => { it('should now confirm the contact name have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.contactInput); .waitToGetProperty(selectors.clientBasicData.contactInput, 'value');
expect(result).toEqual('Black Panther'); expect(result).toEqual('Black Panther');
}); });
it('should now confirm the landline phone number have been added', async () => { it('should now confirm the landline phone number have been added', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.phoneInput); .waitToGetProperty(selectors.clientBasicData.phoneInput, 'value');
expect(result).toEqual('123456789'); expect(result).toEqual('123456789');
}); });
it('should now confirm the mobile phone number have been added', async () => { it('should now confirm the mobile phone number have been added', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.mobileInput); .waitToGetProperty(selectors.clientBasicData.mobileInput, 'value');
expect(result).toEqual('987654321'); expect(result).toEqual('987654321');
}); });
it('should now confirm the email have been edited', async () => { it('should now confirm the email have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.emailInput); .waitToGetProperty(selectors.clientBasicData.emailInput, 'value');
expect(result).toEqual('Storm@verdnatura.es'); expect(result).toEqual('Storm@verdnatura.es');
}); });
it('should confirm the sales person have been selected', async () => { it('should confirm the sales person have been selected', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.salesPersonInput); .waitToGetProperty(selectors.clientBasicData.salesPersonInput, 'value');
expect(result).toEqual('adminAssistant adminAssistant'); expect(result).toEqual('adminAssistant adminAssistant');
}); });
it('should now confirm the channel have been selected', async () => { it('should now confirm the channel have been selected', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientBasicData.channelInput); .waitToGetProperty(selectors.clientBasicData.channelInput, 'value');
expect(result).toEqual('Metropolis newspaper'); expect(result).toEqual('Metropolis newspaper');
}); });

View File

@ -38,9 +38,9 @@ describe('Client Edit fiscalData path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .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 // 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 const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .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 () => { 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.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data') .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 () => { 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 const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .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 // 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 () => { it('should confirm its name have been edited', async () => {
const result = await nightmare const result = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
.getInputValue(selectors.clientFiscalData.socialNameInput);
expect(result).toEqual('SMASH!'); expect(result).toEqual('SMASH!');
}); });
it('should confirm the fiscal id have been edited', async () => { it('should confirm the fiscal id have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput); .waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
expect(result).toEqual('94980061C'); expect(result).toEqual('94980061C');
}); });
it('should confirm the address have been edited', async () => { it('should confirm the address have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.addressInput); .waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
expect(result).toEqual('Somewhere edited'); expect(result).toEqual('Somewhere edited');
}); });
it('should confirm the postcode have been edited', async () => { it('should confirm the postcode have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput); .waitToGetProperty(selectors.clientFiscalData.postcodeInput, 'value');
expect(result).toEqual('12345'); expect(result).toEqual('12345');
}); });
it('should confirm the city have been edited', async () => { it('should confirm the city have been edited', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.cityInput); .waitToGetProperty(selectors.clientFiscalData.cityInput, 'value');
expect(result).toEqual('N/A'); expect(result).toEqual('N/A');
}); });
it(`should confirm the country have been selected`, async () => { it(`should confirm the country have been selected`, async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.countryInput); .waitToGetProperty(selectors.clientFiscalData.countryInput, 'value');
expect(result).toEqual('Francia'); expect(result).toEqual('Francia');
}); });
it(`should confirm the province have been selected`, async () => { it(`should confirm the province have been selected`, async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientFiscalData.provinceInput); .waitToGetProperty(selectors.clientFiscalData.provinceInput, 'value');
expect(result).toEqual('Province two'); expect(result).toEqual('Province two');
}); });
@ -368,9 +367,9 @@ describe('Client Edit fiscalData path', () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index') .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 // confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2

View File

@ -37,9 +37,9 @@ describe('Client Edit pay method path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton) .waitToClick(selectors.clientPayMethod.payMethodButton)
.waitForURL('billing-data') .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 () => { 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.newBankEntityName, 'Gotham City Banks')
.type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT') .type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
.click(selectors.clientPayMethod.acceptBankEntityButton) .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 () => { it(`should confirm the IBAN pay method is sucessfully saved`, async () => {
const payMethod = await nightmare const payMethod = await nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput); .waitToGetProperty(selectors.clientPayMethod.payMethodInput, 'value');
expect(payMethod).toEqual('PayMethod with IBAN'); expect(payMethod).toEqual('PayMethod with IBAN');
}); });
it('should confirm the due day have been edited', async () => { it('should confirm the due day have been edited', async () => {
const dueDate = await nightmare const dueDate = await nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput); .waitToGetProperty(selectors.clientPayMethod.dueDayInput, 'value');
expect(dueDate).toEqual('60'); expect(dueDate).toEqual('60');
}); });

View File

@ -37,36 +37,36 @@ describe('Client Add address path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index') .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 () => { it(`should click on the add new address button to access to the new address form`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.createAddress) .waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create') .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 () => { it(`should return to the addreses section by clicking the cancel button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.cancelButton) .waitToClick(selectors.clientAddresses.cancelButton)
.waitForURL('address/index') .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 () => { it(`should now click on the add new address button to access to the new address form`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientAddresses.createAddress) .waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create') .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 () => { 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') .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit') .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 () => { it(`should click on the active checkbox and receive an error to save it because it is the default address`, async () => {

View File

@ -37,9 +37,9 @@ describe('Client add address notes path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton) .waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index') .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 () => { 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') .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton) .waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit') .waitForURL('/edit')
.url(); .parsedUrl();
expect(url).toContain('/edit'); expect(url.hash).toContain('/edit');
}); });
it('should not save a description without observation type', async () => { it('should not save a description without observation type', async () => {

View File

@ -38,9 +38,9 @@ describe('Client Edit web access path', () => {
.waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton) .waitToClick(selectors.clientWebAccess.webAccessButton)
.waitForURL('web-access') .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 () => { 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 () => { it('should confirm web access name have been updated', async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.clientWebAccess.userNameInput); .waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
expect(result).toEqual('Hulk'); expect(result).toEqual('Hulk');
}); });

View File

@ -37,18 +37,18 @@ describe('Client Add notes path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientNotes.notesButton) .waitToClick(selectors.clientNotes.notesButton)
.waitForURL('note/index') .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 () => { it(`should click on the add note button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientNotes.addNoteFloatButton) .waitToClick(selectors.clientNotes.addNoteFloatButton)
.waitForURL('/note/create') .waitForURL('/note/create')
.url(); .parsedUrl();
expect(url).toContain('/note/create'); expect(url.hash).toContain('/note/create');
}); });
it(`should create a note`, async () => { it(`should create a note`, async () => {
@ -62,8 +62,7 @@ describe('Client Add notes path', () => {
it('should confirm the note was created', async () => { it('should confirm the note was created', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.clientNotes.firstNoteText) .waitToGetProperty(selectors.clientNotes.firstNoteText, 'innerText');
.getInnerText(selectors.clientNotes.firstNoteText);
expect(result).toEqual('Meeting with Black Widow 21st 9am'); expect(result).toEqual('Meeting with Black Widow 21st 9am');
}); });

View File

@ -37,18 +37,18 @@ describe('Client Add credit path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientCredit.creditButton) .waitToClick(selectors.clientCredit.creditButton)
.waitForURL('credit/index') .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 () => { it(`should click on the add credit button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientCredit.addCreditFloatButton) .waitToClick(selectors.clientCredit.addCreditFloatButton)
.waitForURL('/credit/create') .waitForURL('/credit/create')
.url(); .parsedUrl();
expect(url).toContain('/credit/create'); expect(url.hash).toContain('/credit/create');
}); });
it(`should edit the credit`, async () => { it(`should edit the credit`, async () => {
@ -63,8 +63,7 @@ describe('Client Add credit path', () => {
it('should confirm the credit was updated', async () => { it('should confirm the credit was updated', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.clientCredit.firstCreditText) .waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
.getInnerText(selectors.clientCredit.firstCreditText);
expect(result).toContain(999); expect(result).toContain(999);
expect(result).toContain('salesAssistant'); expect(result).toContain('salesAssistant');

View File

@ -37,18 +37,18 @@ describe('Client Add greuge path', () => {
.waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientGreuge.greugeButton) .waitToClick(selectors.clientGreuge.greugeButton)
.waitForURL('greuge/index') .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 () => { it(`should click on the add greuge button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.clientGreuge.addGreugeFloatButton) .waitToClick(selectors.clientGreuge.addGreugeFloatButton)
.waitForURL('greuge/create') .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 () => { 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 () => { it('should confirm the greuge was added to the list', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.clientGreuge.firstGreugeText) .waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
.getInnerText(selectors.clientGreuge.firstGreugeText);
expect(result).toContain(999); expect(result).toContain(999);
expect(result).toContain('new armor for Batman!'); expect(result).toContain('new armor for Batman!');

View File

@ -38,15 +38,14 @@ describe('Client mandate path', () => {
.waitToClick(selectors.clientsIndex.othersButton) .waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientMandate.mandateButton) .waitToClick(selectors.clientMandate.mandateButton)
.waitForURL('mandate') .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 () => { it('should confirm the client has a mandate of the CORE type', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.clientMandate.firstMandateText) .waitToGetProperty(selectors.clientMandate.firstMandateText, 'innerText');
.getInnerText(selectors.clientMandate.firstMandateText);
expect(result).toContain('1'); expect(result).toContain('1');
expect(result).toContain('VNL'); expect(result).toContain('VNL');

View File

@ -78,8 +78,7 @@ describe('Client lock verified data path', () => {
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
.getInputValue(selectors.clientFiscalData.socialNameInput);
expect(result).toEqual('salesPerson was here'); expect(result).toEqual('salesPerson was here');
}); });
@ -182,8 +181,7 @@ describe('Client lock verified data path', () => {
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
.getInputValue(selectors.clientFiscalData.socialNameInput);
expect(result).toEqual('administrative was here'); expect(result).toEqual('administrative was here');
}); });
@ -335,8 +333,7 @@ describe('Client lock verified data path', () => {
.waitToClick(selectors.clientBasicData.basicDataButton) .waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput) .wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput) .waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
.getInputValue(selectors.clientFiscalData.socialNameInput);
expect(result).toEqual('salesAssistant was here'); expect(result).toEqual('salesAssistant was here');
}); });

View File

@ -64,14 +64,14 @@ describe('Client log path', () => {
it('should check the previous value of the last logged change', async () => { it('should check the previous value of the last logged change', async () => {
let lastModificationPreviousValue = await nightmare let lastModificationPreviousValue = await nightmare
.getInnerText(selectors.clientLog.lastModificationPreviousValue); .waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller'); expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
}); });
it('should check the current value of the last logged change', async () => { it('should check the current value of the last logged change', async () => {
let lastModificationCurrentValue = await nightmare let lastModificationCurrentValue = await nightmare
.getInnerText(selectors.clientLog.lastModificationCurrentValue); .waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
expect(lastModificationCurrentValue).toContain('this is a test'); expect(lastModificationCurrentValue).toContain('this is a test');
}); });

View File

@ -45,7 +45,7 @@ describe('Item summary path', () => {
it(`should check the item summary preview shows fields from basic data`, async () => { it(`should check the item summary preview shows fields from basic data`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
.getInnerText(selectors.itemSummary.basicData); .waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Name: Gem of Time'); 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 () => { it(`should check the item summary preview shows fields from tags`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
.getInnerText(selectors.itemSummary.tags); .waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Color: Yellow'); 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 () => { it(`should check the item summary preview shows fields from niche`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1') .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
.getInnerText(selectors.itemSummary.niche); .waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('Warehouse One: A1'); 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 () => { it(`should check the item summary preview shows fields from botanical`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix') .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
.getInnerText(selectors.itemSummary.botanical); .waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('Botanical: Hedera helix'); 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 () => { it(`should check the item summary preview shows fields from barcode`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1') .waitForTextInElement(selectors.itemSummary.barcode, '1')
.getInnerText(selectors.itemSummary.barcode); .waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('1'); 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 () => { it(`should now check the item summary preview shows fields from basic data`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
.getInnerText(selectors.itemSummary.basicData); .waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Name: Gem of Mind'); 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 () => { it(`should now check the item summary preview shows fields from tags`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Red') .waitForTextInElement(selectors.itemSummary.tags, 'Color: Red')
.getInnerText(selectors.itemSummary.tags); .waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Color: Red'); 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 () => { it(`should now check the item summary preview shows fields from niche`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4') .waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4')
.getInnerText(selectors.itemSummary.niche); .waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('Warehouse One: A4'); 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 () => { it(`should now check the item summary preview shows fields from botanical`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -') .waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -')
.getInnerText(selectors.itemSummary.botanical); .waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('Botanical: -'); 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 () => { it(`should now check the item summary preview shows fields from barcode`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '4') .waitForTextInElement(selectors.itemSummary.barcode, '4')
.getInnerText(selectors.itemSummary.barcode); .waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('4'); 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 () => { it(`should check the item summary shows fields from basic data section`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind') .waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
.getInnerText(selectors.itemSummary.basicData); .waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
expect(result).toContain('Name: Gem of Mind'); expect(result).toContain('Name: Gem of Mind');
}); });
it(`should check the item summary shows fields from tags section`, async () => { it(`should check the item summary shows fields from tags section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.tags); .waitToGetProperty(selectors.itemSummary.tags, 'innerText');
expect(result).toContain('Color: Red'); expect(result).toContain('Color: Red');
}); });
it(`should check the item summary shows fields from niches section`, async () => { it(`should check the item summary shows fields from niches section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.niche); .waitToGetProperty(selectors.itemSummary.niche, 'innerText');
expect(result).toContain('Warehouse One: A4'); expect(result).toContain('Warehouse One: A4');
}); });
it(`should check the item summary shows fields from botanical section`, async () => { it(`should check the item summary shows fields from botanical section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.botanical); .waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
expect(result).toContain('Botanical: -'); expect(result).toContain('Botanical: -');
}); });
it(`should check the item summary shows fields from barcodes section`, async () => { it(`should check the item summary shows fields from barcodes section`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.itemSummary.barcode); .waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
expect(result).toContain('4'); expect(result).toContain('4');
}); });

View File

@ -35,9 +35,9 @@ describe('Item Edit basic data path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBasicData.basicDataButton) .waitToClick(selectors.itemBasicData.basicDataButton)
.waitForURL('data') .waitForURL('data')
.url(); .parsedUrl();
expect(url).toContain('data'); expect(url.hash).toContain('data');
}); });
it(`should edit the item basic data`, async () => { it(`should edit the item basic data`, async () => {

View File

@ -35,9 +35,9 @@ describe('Item edit tax path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton)
.waitForURL('tax') .waitForURL('tax')
.url(); .parsedUrl();
expect(url).toContain('tax'); expect(url.hash).toContain('tax');
}); });
it(`should add the item tax to all countries`, async () => { it(`should add the item tax to all countries`, async () => {
@ -61,21 +61,21 @@ describe('Item edit tax path', () => {
.click(selectors.itemTax.taxButton) .click(selectors.itemTax.taxButton)
.waitToClick(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton)
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced') .waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced')
.getInputValue(selectors.itemTax.firstClassSelect); .waitToGetProperty(selectors.itemTax.firstClassSelect, 'value');
expect(firstVatType).toEqual('Reduced VAT'); expect(firstVatType).toEqual('Reduced VAT');
}); });
it(`should confirm the second item tax class was edited`, async () => { it(`should confirm the second item tax class was edited`, async () => {
const secondVatType = await nightmare const secondVatType = await nightmare
.getInputValue(selectors.itemTax.secondClassSelect); .waitToGetProperty(selectors.itemTax.secondClassSelect, 'value');
expect(secondVatType).toEqual('General VAT'); expect(secondVatType).toEqual('General VAT');
}); });
it(`should confirm the third item tax class was edited`, async () => { it(`should confirm the third item tax class was edited`, async () => {
const thirdVatType = await nightmare const thirdVatType = await nightmare
.getInputValue(selectors.itemTax.thirdClassSelect); .waitToGetProperty(selectors.itemTax.thirdClassSelect, 'value');
expect(thirdVatType).toEqual('Reduced VAT'); expect(thirdVatType).toEqual('Reduced VAT');
}); });

View File

@ -35,9 +35,9 @@ describe('Item create tags path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.tagsButton) .waitToClick(selectors.itemTags.tagsButton)
.waitForURL('tags') .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 () => { it(`should create a new tag and delete a former one`, async () => {

View File

@ -35,9 +35,9 @@ describe('Item create niche path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemNiches.nicheButton) .waitToClick(selectors.itemNiches.nicheButton)
.waitForURL('niche') .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 () => { 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) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton) .click(selectors.itemNiches.nicheButton)
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One') .waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
.getInputValue(selectors.itemNiches.firstWarehouseSelect); .waitToGetProperty(selectors.itemNiches.firstWarehouseSelect, 'value');
expect(result).toEqual('Warehouse One'); expect(result).toEqual('Warehouse One');
result = await nightmare result = await nightmare
.getInputValue(selectors.itemNiches.firstCodeInput); .waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value');
expect(result).toEqual('A1'); expect(result).toEqual('A1');
}); });
it(`should confirm the second niche is the expected one`, async () => { it(`should confirm the second niche is the expected one`, async () => {
let result = await nightmare let result = await nightmare
.getInputValue(selectors.itemNiches.secondWarehouseSelect); .waitToGetProperty(selectors.itemNiches.secondWarehouseSelect, 'value');
expect(result).toEqual('Warehouse Three'); expect(result).toEqual('Warehouse Three');
result = await nightmare result = await nightmare
.getInputValue(selectors.itemNiches.secondCodeInput); .waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
expect(result).toEqual('A3'); expect(result).toEqual('A3');
@ -82,11 +82,11 @@ describe('Item create niche path', () => {
it(`should confirm the third niche is the expected one`, async () => { it(`should confirm the third niche is the expected one`, async () => {
let result = await nightmare let result = await nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseSelect); .waitToGetProperty(selectors.itemNiches.thirdWarehouseSelect, 'value');
expect(result).toEqual('Warehouse Two'); expect(result).toEqual('Warehouse Two');
result = await nightmare result = await nightmare
.getInputValue(selectors.itemNiches.thirdCodeInput); .waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
expect(result).toEqual('A4'); expect(result).toEqual('A4');
}); });

View File

@ -35,9 +35,9 @@ describe('Item Create botanical path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBotanical.botanicalButton) .waitToClick(selectors.itemBotanical.botanicalButton)
.waitForURL('botanical') .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 () => { 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) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBotanical.botanicalButton) .click(selectors.itemBotanical.botanicalButton)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata') .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.getInputValue(selectors.itemBotanical.botanicalInput); .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
expect(result).toEqual('Cicuta maculata'); 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 () => { it(`should confirm the Genus for item Mjolnir was created`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia') .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
.getInputValue(selectors.itemBotanical.genusSelect); .waitToGetProperty(selectors.itemBotanical.genusSelect, 'value');
expect(result).toEqual('Abelia'); expect(result).toEqual('Abelia');
}); });
it(`should confirm the Species for item Mjolnir was created`, async () => { it(`should confirm the Species for item Mjolnir was created`, async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.itemBotanical.speciesSelect); .waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value');
expect(result).toEqual('dealbata'); expect(result).toEqual('dealbata');
}); });
@ -99,7 +99,7 @@ describe('Item Create botanical path', () => {
.wait(selectors.itemBasicData.nameInput) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBotanical.botanicalButton) .click(selectors.itemBotanical.botanicalButton)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp') .waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
.getInputValue(selectors.itemBotanical.botanicalInput); .waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
expect(result).toEqual('Herp Derp'); 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 () => { it(`should confirm the Genus for item Mjolnir was edited`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies') .waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
.getInputValue(selectors.itemBotanical.genusSelect); .waitToGetProperty(selectors.itemBotanical.genusSelect, 'value');
expect(result).toEqual('Abies'); expect(result).toEqual('Abies');
}); });
it(`should confirm the Species for item Mjolnir was edited`, async () => { it(`should confirm the Species for item Mjolnir was edited`, async () => {
const result = await nightmare const result = await nightmare
.getInputValue(selectors.itemBotanical.speciesSelect); .waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value');
expect(result).toEqual('decurrens'); expect(result).toEqual('decurrens');
}); });

View File

@ -35,9 +35,9 @@ describe('Item Create barcodes path', () => {
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBarcodes.barcodeButton) .waitToClick(selectors.itemBarcodes.barcodeButton)
.waitForURL('barcode') .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 () => { 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) .wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBarcodes.barcodeButton) .click(selectors.itemBarcodes.barcodeButton)
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5') .waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
.getInputValue(selectors.itemBarcodes.thirdCodeInput); .waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
expect(result).toEqual('5'); expect(result).toEqual('5');
}); });

View File

@ -73,14 +73,13 @@ describe('Item Create/Clone path', () => {
it('should confirm Infinity Gauntlet item was created', async () => { it('should confirm Infinity Gauntlet item was created', async () => {
let result = await nightmare let result = await nightmare
.wait(selectors.itemBasicData.nameInput) .waitToGetProperty(selectors.itemBasicData.nameInput, 'value');
.getInputValue(selectors.itemBasicData.nameInput);
expect(result).toEqual('Infinity Gauntlet'); expect(result).toEqual('Infinity Gauntlet');
result = await nightmare result = await nightmare
.getInputValue(selectors.itemBasicData.typeSelect); .waitToGetProperty(selectors.itemBasicData.typeSelect, 'value');
expect(result).toEqual('Crisantemo'); expect(result).toEqual('Crisantemo');
@ -90,7 +89,7 @@ describe('Item Create/Clone path', () => {
expect(result).toEqual('6021010 Plantas vivas: Esqueje/injerto, Vid'); expect(result).toEqual('6021010 Plantas vivas: Esqueje/injerto, Vid');
result = await nightmare result = await nightmare
.getInputValue(selectors.itemBasicData.originSelect); .waitToGetProperty(selectors.itemBasicData.originSelect, 'value');
expect(result).toEqual('Spain'); expect(result).toEqual('Spain');
}); });

View File

@ -33,9 +33,9 @@ describe('Item regularize path', () => {
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('/summary') .waitForURL('/summary')
.url(); .parsedUrl();
expect(url).toContain('/summary'); expect(url.hash).toContain('/summary');
}); });
it('should regularize the item', async () => { it('should regularize the item', async () => {
@ -79,22 +79,22 @@ describe('Item regularize path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'Missing')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .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 () => { it(`should check the ticket sale quantity is showing a negative value`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100') .waitForTextInElement(selectors.ticketSummary.firstSaleQuantity, '-100')
.getInnerText(selectors.ticketSummary.firstSaleQuantity); .waitToGetProperty(selectors.ticketSummary.firstSaleQuantity, 'innerText');
expect(result).toContain('-100'); expect(result).toContain('-100');
}); });
it(`should check the ticket sale discount is 100%`, async () => { it(`should check the ticket sale discount is 100%`, async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.ticketSummary.firstSaleDiscount); .waitToGetProperty(selectors.ticketSummary.firstSaleDiscount, 'innerText');
expect(result).toContain('100 %'); expect(result).toContain('100 %');
}); });
@ -126,9 +126,9 @@ describe('Item regularize path', () => {
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir') .waitForTextInElement(selectors.itemsIndex.searchResult, 'Mjolnir')
.waitToClick(selectors.itemsIndex.searchResult) .waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('/summary') .waitForURL('/summary')
.url(); .parsedUrl();
expect(url).toContain('/summary'); expect(url.hash).toContain('/summary');
}); });
it('should regularize the item once more', async () => { it('should regularize the item once more', async () => {
@ -172,9 +172,9 @@ describe('Item regularize path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, '22') .waitForTextInElement(selectors.ticketsIndex.searchResult, '22')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .waitForURL('/summary')
.url(); .parsedUrl();
expect(url).toContain('/summary'); expect(url.hash).toContain('/summary');
}); });
it(`should check the ticket contains now two sales`, async () => { it(`should check the ticket contains now two sales`, async () => {

View File

@ -10,73 +10,63 @@ describe('Ticket', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should access to the tickets index by clicking the tickets button', done => { it('should access to the tickets index by clicking the tickets button', async () => {
return nightmare let url = await nightmare
.click(selectors.moduleAccessView.ticketsSectionButton) .click(selectors.moduleAccessView.ticketsSectionButton)
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
}); });
it('should search for the ticket with id 1', done => { it('should search for the ticket with id 1', async () => {
return nightmare let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult);
.then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket notes`, done => { it(`should click on the search result to access to the ticket notes`, async () => {
return nightmare let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, '1') .waitForTextInElement(selectors.ticketsIndex.searchResult, '1')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketNotes.notesButton) .waitToClick(selectors.ticketNotes.notesButton)
.waitForURL('observation') .waitForURL('observation')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('observation'); expect(url.hash).toContain('observation');
done();
}).catch(done.fail);
}); });
it(`should click create a new note and delete a former one`, done => { it(`should click create a new note and delete a former one`, async () => {
return nightmare let result = await nightmare
.waitToClick(selectors.ticketNotes.firstNoteRemoveButton) .waitToClick(selectors.ticketNotes.firstNoteRemoveButton)
.waitToClick(selectors.ticketNotes.addNoteButton) .waitToClick(selectors.ticketNotes.addNoteButton)
.waitToClick(selectors.ticketNotes.firstNoteSelect) .waitToClick(selectors.ticketNotes.firstNoteSelect)
.waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption) .waitToClick(selectors.ticketNotes.firstNoteSelectSecondOption)
.type(selectors.ticketNotes.firstDescriptionInput, 'description') .type(selectors.ticketNotes.firstDescriptionInput, 'description')
.click(selectors.ticketNotes.submitNotesButton) .click(selectors.ticketNotes.submitNotesButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
}); });
it(`should confirm the note is the expected one`, done => { it(`should confirm the note is the expected one`, async () => {
return nightmare let firstNoteSelect = await nightmare
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
.wait(selectors.ticketPackages.firstPackageSelect) .wait(selectors.ticketPackages.firstPackageSelect)
.click(selectors.ticketNotes.notesButton) .click(selectors.ticketNotes.notesButton)
.waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value') .waitToGetProperty(selectors.ticketNotes.firstNoteSelect, 'value');
.then(result => {
expect(result).toEqual('observation one'); expect(firstNoteSelect).toEqual('observation one');
return nightmare
let firstDescription = await nightmare
.waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value'); .waitToGetProperty(selectors.ticketNotes.firstDescriptionInput, 'value');
})
.then(result => { expect(firstDescription).toEqual('description');
expect(result).toEqual('description');
done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -36,9 +36,9 @@ describe('Ticket', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton) .waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition') .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 () => { it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {

View File

@ -37,47 +37,42 @@ describe('Ticket List sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
it('should confirm the first ticket sale contains the colour', async () => { it('should confirm the first ticket sale contains the colour', async () => {
const value = await nightmare const value = await nightmare
.wait(selectors.ticketSales.firstSaleText) .waitToGetProperty(selectors.ticketSales.firstSaleColour, 'innerText');
.getInnerText(selectors.ticketSales.firstSaleColour);
expect(value).toContain('Red'); expect(value).toContain('Red');
}); });
it('should confirm the first ticket sale contains the lenght', async () => { it('should confirm the first ticket sale contains the lenght', async () => {
const value = await nightmare const value = await nightmare
.wait(selectors.ticketSales.firstSaleText) .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
.getInnerText(selectors.ticketSales.firstSaleText);
expect(value).toContain('3'); expect(value).toContain('3');
}); });
it('should confirm the first ticket sale contains the price', async () => { it('should confirm the first ticket sale contains the price', async () => {
const value = await nightmare const value = await nightmare
.wait(selectors.ticketSales.firstSaleText) .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
.getInnerText(selectors.ticketSales.firstSalePrice);
expect(value).toContain('1.30'); expect(value).toContain('1.30');
}); });
it('should confirm the first ticket sale contains the discount', async () => { it('should confirm the first ticket sale contains the discount', async () => {
const value = await nightmare const value = await nightmare
.wait(selectors.ticketSales.firstSaleText) .waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
.getInnerText(selectors.ticketSales.firstSaleDiscount);
expect(value).toContain('0 %'); expect(value).toContain('0 %');
}); });
it('should confirm the first ticket sale contains the total import', async () => { it('should confirm the first ticket sale contains the total import', async () => {
const value = await nightmare const value = await nightmare
.wait(selectors.ticketSales.firstSaleText) .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
.getInnerText(selectors.ticketSales.firstSaleImport);
expect(value).toContain('19.50'); expect(value).toContain('19.50');
}); });
@ -86,8 +81,8 @@ describe('Ticket List sale path', () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.ticketSales.newItemButton) .waitToClick(selectors.ticketSales.newItemButton)
.waitForURL('/catalog') .waitForURL('/catalog')
.url(); .parsedUrl();
expect(url).toContain('/catalog'); expect(url.hash).toContain('/catalog');
}); });
}); });

View File

@ -37,9 +37,9 @@ describe('Ticket Create packages path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.packagesButton) .waitToClick(selectors.ticketPackages.packagesButton)
.waitForURL('package/index') .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 () => { 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) .wait(selectors.ticketSales.firstPackageSelect)
.click(selectors.ticketPackages.packagesButton) .click(selectors.ticketPackages.packagesButton)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box') .waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.getInputValue(selectors.ticketPackages.firstPackageSelect); .waitToGetProperty(selectors.ticketPackages.firstPackageSelect, 'value');
expect(result).toEqual('7 : Legendary Box'); 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 () => { it(`should confirm the first quantity is the expected one`, async () => {
const result = await nightmare const result = await nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99') .waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
.getInputValue(selectors.ticketPackages.firstQuantityInput); .waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
expect(result).toEqual('99'); expect(result).toEqual('99');
}); });

View File

@ -10,100 +10,84 @@ describe('Ticket', () => {
.waitForLogin('production'); .waitForLogin('production');
}); });
it('should click on the Tickets button of the top bar menu', done => { it('should click on the Tickets button of the top bar menu', async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
}); });
it('should search for the ticket 1', done => { it('should search for the ticket 1', async () => {
return nightmare let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:1') .type(selectors.ticketsIndex.searchTicketInput, 'id:1')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult);
.then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Tracking`, done => { it(`should click on the search result to access to the ticket Tracking`, async () => {
return nightmare let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton) .waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('tracking/index') .waitForURL('tracking/index')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('tracking/index'); expect(url.hash).toContain('tracking/index');
done();
}).catch(done.fail);
}); });
it('should access to the create state view by clicking the create floating button', done => { it('should access to the create state view by clicking the create floating button', async () => {
return nightmare let url = await nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
done();
}).catch(done.fail);
}); });
it(`should attempt create a new state but receive an error if state is empty`, done => { it(`should attempt create a new state but receive an error if state is empty`, async () => {
return nightmare let result = await nightmare
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('No changes to save'); expect(result).toEqual('No changes to save');
done();
}).catch(done.fail);
}); });
it(`should attempt create a new state then clear and save it`, done => { it(`should attempt create a new state then clear and save it`, async () => {
return nightmare let result = await nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
.waitToClick(selectors.createStateView.clearStateInputButton) .waitToClick(selectors.createStateView.clearStateInputButton)
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
}); });
it('should again access to the create state view by clicking the create floating button', done => { it('should again access to the create state view by clicking the create floating button', async () => {
return nightmare let url = await nightmare
.click(selectors.ticketTracking.createStateButton) .click(selectors.ticketTracking.createStateButton)
.wait(selectors.createStateView.stateInput) .wait(selectors.createStateView.stateInput)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toContain('tracking/edit'); expect(url.hash).toContain('tracking/edit');
done();
}).catch(done.fail);
}); });
it(`should create a new state`, done => { it(`should create a new state`, async () => {
return nightmare let result = await nightmare
.waitToClick(selectors.createStateView.stateInput) .waitToClick(selectors.createStateView.stateInput)
.waitToClick(selectors.createStateView.stateInputOptionOne) .waitToClick(selectors.createStateView.stateInputOptionOne)
.click(selectors.createStateView.saveStateButton) .click(selectors.createStateView.saveStateButton)
.waitForLastSnackbar() .waitForLastSnackbar();
.then(result => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
}); });
}); });
}); });

View File

@ -1,8 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare'; import createNightmare from '../../helpers/nightmare';
describe('Ticket', () => { describe('Ticket Edit basic data path', () => {
describe('Edit basic data path', () => {
const nightmare = createNightmare(); const nightmare = createNightmare();
beforeAll(() => { beforeAll(() => {
@ -10,47 +9,41 @@ describe('Ticket', () => {
.waitForLogin('employee'); .waitForLogin('employee');
}); });
it('should click on the Tickets button of the top bar menu', done => { it('should click on the Tickets button of the top bar menu', async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible) .wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton) .waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.parsedUrl() .parsedUrl();
.then(url => {
expect(url.hash).toEqual('#!/ticket/index'); expect(url.hash).toEqual('#!/ticket/index');
done();
}).catch(done.fail);
}); });
it('should search for the ticket 11', done => { it('should search for the ticket 11', async () => {
return nightmare let result = await nightmare
.wait(selectors.ticketsIndex.searchTicketInput) .wait(selectors.ticketsIndex.searchTicketInput)
.type(selectors.ticketsIndex.searchTicketInput, 'id:11') .type(selectors.ticketsIndex.searchTicketInput, 'id:11')
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult) .countElement(selectors.ticketsIndex.searchResult);
.then(result => {
expect(result).toEqual(1); expect(result).toEqual(1);
done();
}).catch(done.fail);
}); });
it(`should click on the search result to access to the ticket Basic Data`, done => { it(`should click on the search result to access to the ticket Basic Data`, async () => {
return nightmare let url = await nightmare
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') // should be Bruce Wayne
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one') .waitForURL('data/step-one')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-one'); expect(url.hash).toContain('data/step-one');
done();
}).catch(done.fail);
}); });
it(`should edit the client and address of the ticket then click next`, done => { it(`should edit the client and address of the ticket then click next`, async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.ticketBasicData.clientSelect) .waitToClick(selectors.ticketBasicData.clientSelect)
.waitToClick(selectors.ticketBasicData.clientSelectThirdOption) .waitToClick(selectors.ticketBasicData.clientSelectThirdOption)
.wait(500) .wait(500)
@ -59,104 +52,85 @@ describe('Ticket', () => {
.waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier') .waitForTextInInput(selectors.ticketBasicData.addressSelect, 'Charles Xavier')
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two') .waitForURL('data/step-two')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-two'); expect(url.hash).toContain('data/step-two');
done();
}).catch(done.fail);
}); });
it(`should have no price diference`, done => { it(`should have no price diference`, async () => {
return nightmare const result = await nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
.then(result => {
expect(result).toContain('0'); expect(result).toContain('0');
done();
}).catch(done.fail);
}); });
it(`should click next to move on to step three`, done => { it(`should click next to move on to step three`, async () => {
return nightmare let url = await nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-three'); expect(url.hash).toContain('data/step-three');
done();
}).catch(done.fail);
}); });
it(`should select a reason for the changes made then click on finalize`, done => { it(`should select a reason for the changes made then click on finalize`, async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFourthOption) .waitToClick(selectors.ticketBasicData.chargesReasonFourthOption)
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios') .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'No realizar modificaciones en precios')
.click(selectors.ticketBasicData.finalizeButton) .click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary') .waitForURL('summary')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('summary'); expect(url.hash).toContain('summary');
done();
}).catch(done.fail);
}); });
it(`should go back to ticket.basicData section`, done => { it(`should go back to ticket.basicData section`, async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.ticketBasicData.basicDataButton) .waitToClick(selectors.ticketBasicData.basicDataButton)
.waitForURL('data/step-one') .waitForURL('data/step-one')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-one'); expect(url.hash).toContain('data/step-one');
done();
}).catch(done.fail);
}); });
it(`should edit the ticket agency then click next`, done => { it(`should edit the ticket agency then click next`, async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.ticketBasicData.agencySelect) .waitToClick(selectors.ticketBasicData.agencySelect)
.waitToClick(selectors.ticketBasicData.agencySelectOptionSix) .waitToClick(selectors.ticketBasicData.agencySelectOptionSix)
.waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive') .waitForTextInInput(selectors.ticketBasicData.agencySelect, 'Expensive')
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-two') .waitForURL('data/step-two')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-two'); expect(url.hash).toContain('data/step-two');
done();
}).catch(done.fail);
}); });
it(`should have a price diference`, done => { it(`should have a price diference`, async () => {
return nightmare const result = await nightmare
.getInnerText(selectors.ticketBasicData.stepTwoTotalPriceDif) .waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
.then(result => {
expect(result).toContain('-20.65 €'); expect(result).toContain('-20.65 €');
done();
}).catch(done.fail);
}); });
it(`should then click next to move on to step three`, done => { it(`should then click next to move on to step three`, async () => {
return nightmare let url = await nightmare
.click(selectors.ticketBasicData.nextStepButton) .click(selectors.ticketBasicData.nextStepButton)
.waitForURL('data/step-three') .waitForURL('data/step-three')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('data/step-three'); expect(url.hash).toContain('data/step-three');
done();
}).catch(done.fail);
}); });
it(`should select a new reason for the changes made then click on finalize`, done => { it(`should select a new reason for the changes made then click on finalize`, async () => {
return nightmare let url = await nightmare
.waitToClick(selectors.ticketBasicData.chargesReason) .waitToClick(selectors.ticketBasicData.chargesReason)
.waitToClick(selectors.ticketBasicData.chargesReasonFirstOption) .waitToClick(selectors.ticketBasicData.chargesReasonFirstOption)
.waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket') .waitForTextInInput(selectors.ticketBasicData.chargesReason, 'Cambiar los precios en el ticket')
.click(selectors.ticketBasicData.finalizeButton) .click(selectors.ticketBasicData.finalizeButton)
.waitForURL('summary') .waitForURL('summary')
.url() .parsedUrl();
.then(url => {
expect(url).toContain('summary'); expect(url.hash).toContain('summary');
done();
}).catch(done.fail);
});
}); });
}); });

View File

@ -37,9 +37,9 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .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 () => { 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.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
it(`should check the zoomed image isnt present`, async () => { it(`should check the zoomed image isnt present`, async () => {
@ -144,9 +144,9 @@ describe('Ticket Edit sale path', () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton) .waitToClick(selectors.ticketSales.saleDescriptorPopoverSummaryButton)
.waitForURL('/summary') .waitForURL('/summary')
.url(); .parsedUrl();
expect(url).toContain('/summary'); expect(url.hash).toContain('/summary');
}); });
it('should return to ticket sales section', async () => { it('should return to ticket sales section', async () => {
@ -162,9 +162,9 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .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 () => { 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 () => { it('should confirm the price have been updated', async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.ticketSales.firstSalePrice); .waitToGetProperty(selectors.ticketSales.firstSalePrice, 'innerText');
expect(result).toContain('5.00'); expect(result).toContain('5.00');
}); });
it('should confirm the total price for that item have been updated', async () => { it('should confirm the total price for that item have been updated', async () => {
const result = await nightmare const result = await nightmare
.getInnerText(selectors.ticketSales.firstSaleImport); .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('20.00'); expect(result).toContain('20.00');
}); });
@ -224,7 +224,7 @@ describe('Ticket Edit sale path', () => {
it('should confirm the discount have been updated', async () => { it('should confirm the discount have been updated', async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %') .waitForTextInElement(selectors.ticketSales.firstSaleDiscount, '50 %')
.getInnerText(selectors.ticketSales.firstSaleDiscount); .waitToGetProperty(selectors.ticketSales.firstSaleDiscount, 'innerText');
expect(result).toContain('50 %'); 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 () => { it('should confirm the total import for that item have been updated', async () => {
const result = await nightmare const result = await nightmare
.waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00') .waitForTextInElement(selectors.ticketSales.firstSaleImport, '10.00')
.getInnerText(selectors.ticketSales.firstSaleImport); .waitToGetProperty(selectors.ticketSales.firstSaleImport, 'innerText');
expect(result).toContain('10.00'); expect(result).toContain('10.00');
}); });
@ -298,9 +298,9 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
it('should select the third sale and delete it', async () => { it('should select the third sale and delete it', async () => {
@ -338,15 +338,15 @@ describe('Ticket Edit sale path', () => {
.type(selectors.ticketSales.moveToTicketInput, 12) .type(selectors.ticketSales.moveToTicketInput, 12)
.waitToClick(selectors.ticketSales.moveToTicketButton) .waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/12/sale') .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 () => { it('should confirm the transfered line is the correct one', async () => {
const result = await nightmare const result = await nightmare
.wait(selectors.ticketSales.firstSaleText) .wait(selectors.ticketSales.firstSaleText)
.getInnerText(selectors.ticketSales.firstSaleText); .waitToGetProperty(selectors.ticketSales.firstSaleText, 'innerText');
expect(result).toContain(`Mark I`); expect(result).toContain(`Mark I`);
}); });
@ -362,9 +362,9 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .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 () => { 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.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
it('should transfer the sale back to the original ticket', async () => { 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) .type(selectors.ticketSales.moveToTicketInput, 16)
.waitToClick(selectors.ticketSales.moveToTicketButton) .waitToClick(selectors.ticketSales.moveToTicketButton)
.waitForURL('ticket/16/sale') .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 () => { 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.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
it('should confirm the new ticket received both lines', async () => { 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(selectors.ticketSales.moreMenuUpdateDiscountInput, 100)
.type('body', '\u000d') // simulates enter .type('body', '\u000d') // simulates enter
.waitForTextInElement(selectors.ticketSales.totalImport, '0.00') .waitForTextInElement(selectors.ticketSales.totalImport, '0.00')
.getInnerText(selectors.ticketSales.totalImport); .waitToGetProperty(selectors.ticketSales.totalImport, 'innerText');
expect(result).toContain('0.00'); expect(result).toContain('0.00');
}); });
@ -530,18 +530,18 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketTracking.trackingButton) .waitToClick(selectors.ticketTracking.trackingButton)
.waitForURL('/tracking/index') .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 () => { it(`should click on the edit ticket tracking state button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.ticketTracking.createStateButton) .waitToClick(selectors.ticketTracking.createStateButton)
.waitForURL('/tracking/edit') .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 () => { 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') .waitForTextInInput(selectors.ticketTracking.stateSelectInput, 'Preparación')
.click(selectors.ticketTracking.saveButton) .click(selectors.ticketTracking.saveButton)
.waitForURL('/tracking/index') .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 () => { it(`should click on the ticket Sale menu button`, async () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
describe('when state is preparation and loged as Production', () => { describe('when state is preparation and loged as Production', () => {
@ -622,9 +622,9 @@ describe('Ticket Edit sale path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketSales.saleButton) .waitToClick(selectors.ticketSales.saleButton)
.waitForURL('/sale') .waitForURL('/sale')
.url(); .parsedUrl();
expect(url).toContain('/sale'); expect(url.hash).toContain('/sale');
}); });
}); });

View File

@ -37,9 +37,9 @@ describe('Ticket List components path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketComponents.componentsButton) .waitToClick(selectors.ticketComponents.componentsButton)
.waitForURL('components') .waitForURL('components')
.url(); .parsedUrl();
expect(url).toContain('components'); expect(url.hash).toContain('components');
}); });
it('should confirm the total base is correct', async () => { it('should confirm the total base is correct', async () => {

View File

@ -56,9 +56,9 @@ describe('Ticket descriptor path', () => {
const url = await nightmare const url = await nightmare
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .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 () => { 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 const url = await nightmare
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .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 () => { it('should add the ticket to saturday turn using the descriptor more menu', async () => {

View File

@ -37,9 +37,9 @@ describe('Ticket purchase request path', () => {
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketRequests.requestButton) .waitToClick(selectors.ticketRequests.requestButton)
.waitForURL('/request') .waitForURL('/request')
.url(); .parsedUrl();
expect(url).toContain('/request'); expect(url.hash).toContain('/request');
}); });
it(`should add a new request`, async () => { 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 () => { it(`should have been redirected to the request index`, async () => {
const url = await nightmare const url = await nightmare
.waitForURL('/request') .waitForURL('/request')
.url(); .parsedUrl();
expect(url).toContain('/request'); expect(url.hash).toContain('/request');
}); });
it(`should confirm the new request was added`, async () => { it(`should confirm the new request was added`, async () => {

View File

@ -37,9 +37,9 @@ describe('Ticket diary path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .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 () => { it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async () => {

View File

@ -36,9 +36,9 @@ describe('Ticket descriptor path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26') .waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 26')
.waitToClick(selectors.ticketsIndex.searchResult) .waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary') .waitForURL('/summary')
.url(); .parsedUrl();
expect(url).toContain('/summary'); expect(url.hash).toContain('/summary');
}); });
it('should delete the ticket using the descriptor more menu', async () => { it('should delete the ticket using the descriptor more menu', async () => {
@ -65,7 +65,7 @@ describe('Ticket descriptor path', () => {
.click(selectors.ticketsIndex.searchButton) .click(selectors.ticketsIndex.searchButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1) .waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.wait(selectors.ticketsIndex.searchResultDate) .wait(selectors.ticketsIndex.searchResultDate)
.getInnerText(selectors.ticketsIndex.searchResultDate); .waitToGetProperty(selectors.ticketsIndex.searchResultDate, 'innerText');
expect(result).toContain(2000); expect(result).toContain(2000);
}); });

View File

@ -1,15 +1,30 @@
var UserError = require('../helpers').UserError; let UserError = require('../helpers').UserError;
var getFinalState = require('../helpers').getFinalState; let getFinalState = require('../helpers').getFinalState;
var isMultiple = require('../helpers').isMultiple; let isMultiple = require('../helpers').isMultiple;
module.exports = Self => { module.exports = Self => {
Self.validate('isDefaultAddress', isActive, Self.validate('isDefaultAddress', isActive,
{message: 'Unable to default a disabled consignee'} {message: 'Unable to default a disabled consignee'}
); );
function isActive(err) { function isActive(err) {
if (!this.isActive && this.isDefaultAddress) 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) { Self.beforeRemote('findById', function(ctx, modelInstance, next) {
ctx.args.filter = { ctx.args.filter = {
include: [{ include: [{

View File

@ -129,11 +129,9 @@ module.exports = Self => {
}); });
function hasBic(err, done) { function hasBic(err, done) {
Self.app.models.PayMethod.findById(this.payMethodFk, (_, instance) => { if (this.iban && !this.bankEntityFk)
if (instance && instance.ibanRequired && !this.bankEntityFk)
err(); err();
done(); done();
});
} }
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {