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"
fields="['name']"
initial-data="$ctrl.client.bankEntityFk"
on-change="$ctrl.autofillBic()"
search-function="{or: [{bic: {regexp: $search}}, {name: {regexp: $search}}]}"
value-field="id"
show-field="bic"

View File

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

View File

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

View File

@ -94,20 +94,6 @@ let actions = {
.then(result => done(null, result), done);
},
getInnerText: function(selector, done) {
this.wait(selector)
.evaluate_now(function(elementToSelect) {
return document.querySelector(elementToSelect).innerText;
}, done, selector);
},
getInputValue: function(selector, done) {
this.wait(selector)
.evaluate_now(function(elementToSelect) {
return document.querySelector(elementToSelect).value;
}, done, selector);
},
write: function(selector, text, done) {
this.wait(selector)
.type(selector, text)
@ -163,20 +149,6 @@ let actions = {
}, done, selector);
},
selectText: function(selector, done) {
this.wait(selector)
.evaluate(elementToSelect => {
const range = document.createRange();
range.selectNodeContents(document.querySelector(elementToSelect));
const sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}, selector)
.mouseup(selector)
.then(done)
.catch(done);
},
countElement: function(selector, done) {
this.evaluate_now(selector => {
return document.querySelectorAll(selector).length;

View File

@ -36,9 +36,9 @@ describe('Claim edit basic data path', () => {
.waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton)
.waitForURL('basic-data')
.url();
.parsedUrl();
expect(url).toContain('basic-data');
expect(url.hash).toContain('basic-data');
});
it(`should edit claim state, is paid with mana and observation fields`, async () => {
@ -60,7 +60,7 @@ describe('Claim edit basic data path', () => {
.wait(selectors.claimDetails.addItemButton)
.click(selectors.claimBasicData.basicDataButton)
.wait(selectors.claimBasicData.claimStateSelect)
.getInputValue(selectors.claimBasicData.claimStateSelect);
.waitToGetProperty(selectors.claimBasicData.claimStateSelect, 'value');
expect(result).toEqual('Gestionado');
});
@ -76,7 +76,7 @@ describe('Claim edit basic data path', () => {
it('should confirm the claim observation was edited', async () => {
const result = await nightmare
.getInputValue(selectors.claimBasicData.observationInput);
.waitToGetProperty(selectors.claimBasicData.observationInput, 'value');
expect(result).toEqual('edited observation');
});

View File

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

View File

@ -38,9 +38,9 @@ describe('Client Edit fiscalData path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url();
.parsedUrl();
expect(url).toContain('/address/index');
expect(url.hash).toContain('/address/index');
});
// Confirms all addresses have EQtax false for future propagation test step 2
@ -72,9 +72,9 @@ describe('Client Edit fiscalData path', () => {
const url = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.url();
.parsedUrl();
expect(url).toContain('fiscal-data');
expect(url.hash).toContain('fiscal-data');
});
it('should not be able to edit the verified data checkbox', async () => {
@ -121,9 +121,9 @@ describe('Client Edit fiscalData path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.url();
.parsedUrl();
expect(url).toContain('fiscal-data');
expect(url.hash).toContain('fiscal-data');
});
it('should receive an error if VIES and EQtax are being ticked together', async () => {
@ -191,9 +191,9 @@ describe('Client Edit fiscalData path', () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url();
.parsedUrl();
expect(url).toContain('/address/index');
expect(url.hash).toContain('/address/index');
});
// confirm all addresses have now EQtax checked step 2
@ -243,50 +243,49 @@ describe('Client Edit fiscalData path', () => {
it('should confirm its name have been edited', async () => {
const result = await nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput);
.waitToGetProperty(selectors.clientFiscalData.socialNameInput, 'value');
expect(result).toEqual('SMASH!');
});
it('should confirm the fiscal id have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput);
.waitToGetProperty(selectors.clientFiscalData.fiscalIdInput, 'value');
expect(result).toEqual('94980061C');
});
it('should confirm the address have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.addressInput);
.waitToGetProperty(selectors.clientFiscalData.addressInput, 'value');
expect(result).toEqual('Somewhere edited');
});
it('should confirm the postcode have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput);
.waitToGetProperty(selectors.clientFiscalData.postcodeInput, 'value');
expect(result).toEqual('12345');
});
it('should confirm the city have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.cityInput);
.waitToGetProperty(selectors.clientFiscalData.cityInput, 'value');
expect(result).toEqual('N/A');
});
it(`should confirm the country have been selected`, async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.countryInput);
.waitToGetProperty(selectors.clientFiscalData.countryInput, 'value');
expect(result).toEqual('Francia');
});
it(`should confirm the province have been selected`, async () => {
const result = await nightmare
.getInputValue(selectors.clientFiscalData.provinceInput);
.waitToGetProperty(selectors.clientFiscalData.provinceInput, 'value');
expect(result).toEqual('Province two');
});
@ -368,9 +367,9 @@ describe('Client Edit fiscalData path', () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url();
.parsedUrl();
expect(url).toContain('/address/index');
expect(url.hash).toContain('/address/index');
});
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2

View File

@ -37,9 +37,9 @@ describe('Client Edit pay method path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton)
.waitForURL('billing-data')
.url();
.parsedUrl();
expect(url).toContain('billing-data');
expect(url.hash).toContain('billing-data');
});
it(`should attempt to edit the Pay method without an IBAN but fail`, async () => {
@ -80,21 +80,21 @@ describe('Client Edit pay method path', () => {
.type(selectors.clientPayMethod.newBankEntityName, 'Gotham City Banks')
.type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
.click(selectors.clientPayMethod.acceptBankEntityButton)
.getInputValue(selectors.clientPayMethod.swiftBicInput);
.waitToGetProperty(selectors.clientPayMethod.swiftBicInput, 'value');
expect(newcode).toEqual('');
expect(newcode).toEqual('GTHMCT Gotham City Banks');
});
it(`should confirm the IBAN pay method is sucessfully saved`, async () => {
const payMethod = await nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput);
.waitToGetProperty(selectors.clientPayMethod.payMethodInput, 'value');
expect(payMethod).toEqual('PayMethod with IBAN');
});
it('should confirm the due day have been edited', async () => {
const dueDate = await nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput);
.waitToGetProperty(selectors.clientPayMethod.dueDayInput, 'value');
expect(dueDate).toEqual('60');
});

View File

@ -37,36 +37,36 @@ describe('Client Add address path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url();
.parsedUrl();
expect(url).toContain('address/index');
expect(url.hash).toContain('address/index');
});
it(`should click on the add new address button to access to the new address form`, async () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create')
.url();
.parsedUrl();
expect(url).toContain('address/create');
expect(url.hash).toContain('address/create');
});
it(`should return to the addreses section by clicking the cancel button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.cancelButton)
.waitForURL('address/index')
.url();
.parsedUrl();
expect(url).toContain('address/index');
expect(url.hash).toContain('address/index');
});
it(`should now click on the add new address button to access to the new address form`, async () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create')
.url();
.parsedUrl();
expect(url).toContain('address/create');
expect(url.hash).toContain('address/create');
});
it('should receive an error after clicking save button as consignee, street and town fields are empty', async () => {
@ -119,9 +119,9 @@ describe('Client Add address path', () => {
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url();
.parsedUrl();
expect(url).toContain('/edit');
expect(url.hash).toContain('/edit');
});
it(`should click on the active checkbox and receive an error to save it because it is the default address`, async () => {

View File

@ -37,9 +37,9 @@ describe('Client add address notes path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url();
.parsedUrl();
expect(url).toContain('address/index');
expect(url.hash).toContain('address/index');
});
it(`should click on the edit icon of the default address`, async () => {
@ -47,9 +47,9 @@ describe('Client add address notes path', () => {
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url();
.parsedUrl();
expect(url).toContain('/edit');
expect(url.hash).toContain('/edit');
});
it('should not save a description without observation type', async () => {

View File

@ -38,9 +38,9 @@ describe('Client Edit web access path', () => {
.waitToClick(selectors.clientsIndex.othersButton)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.waitForURL('web-access')
.url();
.parsedUrl();
expect(url).toContain('web-access');
expect(url.hash).toContain('web-access');
});
it(`should uncheck the Enable web access checkbox and update the name`, async () => {
@ -70,7 +70,7 @@ describe('Client Edit web access path', () => {
it('should confirm web access name have been updated', async () => {
const result = await nightmare
.getInputValue(selectors.clientWebAccess.userNameInput);
.waitToGetProperty(selectors.clientWebAccess.userNameInput, 'value');
expect(result).toEqual('Hulk');
});

View File

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

View File

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

View File

@ -37,18 +37,18 @@ describe('Client Add greuge path', () => {
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientGreuge.greugeButton)
.waitForURL('greuge/index')
.url();
.parsedUrl();
expect(url).toContain('greuge/index');
expect(url.hash).toContain('greuge/index');
});
it(`should click on the add greuge button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
.waitForURL('greuge/create')
.url();
.parsedUrl();
expect(url).toContain('greuge/create');
expect(url.hash).toContain('greuge/create');
});
it(`should receive an error if all fields are empty but date and type on submit`, async () => {
@ -74,8 +74,7 @@ describe('Client Add greuge path', () => {
it('should confirm the greuge was added to the list', async () => {
const result = await nightmare
.wait(selectors.clientGreuge.firstGreugeText)
.getInnerText(selectors.clientGreuge.firstGreugeText);
.waitToGetProperty(selectors.clientGreuge.firstGreugeText, 'innerText');
expect(result).toContain(999);
expect(result).toContain('new armor for Batman!');

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,9 +35,9 @@ describe('Item create tags path', () => {
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.tagsButton)
.waitForURL('tags')
.url();
.parsedUrl();
expect(url).toContain('tags');
expect(url.hash).toContain('tags');
});
it(`should create a new tag and delete a former one`, async () => {

View File

@ -35,9 +35,9 @@ describe('Item create niche path', () => {
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemNiches.nicheButton)
.waitForURL('niche')
.url();
.parsedUrl();
expect(url).toContain('niche');
expect(url.hash).toContain('niche');
});
it(`should click create a new niche and delete a former one`, async () => {
@ -59,22 +59,22 @@ describe('Item create niche path', () => {
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton)
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
.getInputValue(selectors.itemNiches.firstWarehouseSelect);
.waitToGetProperty(selectors.itemNiches.firstWarehouseSelect, 'value');
expect(result).toEqual('Warehouse One');
result = await nightmare
.getInputValue(selectors.itemNiches.firstCodeInput);
.waitToGetProperty(selectors.itemNiches.firstCodeInput, 'value');
expect(result).toEqual('A1');
});
it(`should confirm the second niche is the expected one`, async () => {
let result = await nightmare
.getInputValue(selectors.itemNiches.secondWarehouseSelect);
.waitToGetProperty(selectors.itemNiches.secondWarehouseSelect, 'value');
expect(result).toEqual('Warehouse Three');
result = await nightmare
.getInputValue(selectors.itemNiches.secondCodeInput);
.waitToGetProperty(selectors.itemNiches.secondCodeInput, 'value');
expect(result).toEqual('A3');
@ -82,11 +82,11 @@ describe('Item create niche path', () => {
it(`should confirm the third niche is the expected one`, async () => {
let result = await nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseSelect);
.waitToGetProperty(selectors.itemNiches.thirdWarehouseSelect, 'value');
expect(result).toEqual('Warehouse Two');
result = await nightmare
.getInputValue(selectors.itemNiches.thirdCodeInput);
.waitToGetProperty(selectors.itemNiches.thirdCodeInput, 'value');
expect(result).toEqual('A4');
});

View File

@ -35,9 +35,9 @@ describe('Item Create botanical path', () => {
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBotanical.botanicalButton)
.waitForURL('botanical')
.url();
.parsedUrl();
expect(url).toContain('botanical');
expect(url.hash).toContain('botanical');
});
it(`should create a new botanical for the item with id Mjolnir`, async () => {
@ -59,7 +59,7 @@ describe('Item Create botanical path', () => {
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBotanical.botanicalButton)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Cicuta maculata')
.getInputValue(selectors.itemBotanical.botanicalInput);
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
expect(result).toEqual('Cicuta maculata');
});
@ -67,14 +67,14 @@ describe('Item Create botanical path', () => {
it(`should confirm the Genus for item Mjolnir was created`, async () => {
const result = await nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abelia')
.getInputValue(selectors.itemBotanical.genusSelect);
.waitToGetProperty(selectors.itemBotanical.genusSelect, 'value');
expect(result).toEqual('Abelia');
});
it(`should confirm the Species for item Mjolnir was created`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBotanical.speciesSelect);
.waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value');
expect(result).toEqual('dealbata');
});
@ -99,7 +99,7 @@ describe('Item Create botanical path', () => {
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBotanical.botanicalButton)
.waitForTextInInput(selectors.itemBotanical.botanicalInput, 'Herp Derp')
.getInputValue(selectors.itemBotanical.botanicalInput);
.waitToGetProperty(selectors.itemBotanical.botanicalInput, 'value');
expect(result).toEqual('Herp Derp');
});
@ -107,14 +107,14 @@ describe('Item Create botanical path', () => {
it(`should confirm the Genus for item Mjolnir was edited`, async () => {
const result = await nightmare
.waitForTextInInput(selectors.itemBotanical.genusSelect, 'Abies')
.getInputValue(selectors.itemBotanical.genusSelect);
.waitToGetProperty(selectors.itemBotanical.genusSelect, 'value');
expect(result).toEqual('Abies');
});
it(`should confirm the Species for item Mjolnir was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBotanical.speciesSelect);
.waitToGetProperty(selectors.itemBotanical.speciesSelect, 'value');
expect(result).toEqual('decurrens');
});

View File

@ -35,9 +35,9 @@ describe('Item Create barcodes path', () => {
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBarcodes.barcodeButton)
.waitForURL('barcode')
.url();
.parsedUrl();
expect(url).toContain('barcode');
expect(url.hash).toContain('barcode');
});
it(`should click create a new code and delete a former one`, async () => {
@ -58,7 +58,7 @@ describe('Item Create barcodes path', () => {
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemBarcodes.barcodeButton)
.waitForTextInInput(selectors.itemBarcodes.thirdCodeInput, '5')
.getInputValue(selectors.itemBarcodes.thirdCodeInput);
.waitToGetProperty(selectors.itemBarcodes.thirdCodeInput, 'value');
expect(result).toEqual('5');
});

View File

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

View File

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

View File

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

View File

@ -36,9 +36,9 @@ describe('Ticket', () => {
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketExpedition.expeditionButton)
.waitForURL('expedition')
.url();
.parsedUrl();
expect(url).toContain('expedition');
expect(url.hash).toContain('expedition');
});
it(`should delete a former expedition and confirm the remaining expedition are the expected ones`, async () => {

View File

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

View File

@ -37,9 +37,9 @@ describe('Ticket Create packages path', () => {
.waitToClick(selectors.ticketsIndex.searchResult)
.waitToClick(selectors.ticketPackages.packagesButton)
.waitForURL('package/index')
.url();
.parsedUrl();
expect(url).toContain('package/index');
expect(url.hash).toContain('package/index');
});
it(`should delete the first package and receive and error to save a new one with blank quantity`, async () => {
@ -101,7 +101,7 @@ describe('Ticket Create packages path', () => {
.wait(selectors.ticketSales.firstPackageSelect)
.click(selectors.ticketPackages.packagesButton)
.waitForTextInInput(selectors.ticketPackages.firstPackageSelect, 'Legendary Box')
.getInputValue(selectors.ticketPackages.firstPackageSelect);
.waitToGetProperty(selectors.ticketPackages.firstPackageSelect, 'value');
expect(result).toEqual('7 : Legendary Box');
});
@ -109,7 +109,7 @@ describe('Ticket Create packages path', () => {
it(`should confirm the first quantity is the expected one`, async () => {
const result = await nightmare
.waitForTextInInput(selectors.ticketPackages.firstQuantityInput, '99')
.getInputValue(selectors.ticketPackages.firstQuantityInput);
.waitToGetProperty(selectors.ticketPackages.firstQuantityInput, 'value');
expect(result).toEqual('99');
});

View File

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

View File

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

View File

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

View File

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

View File

@ -56,9 +56,9 @@ describe('Ticket descriptor path', () => {
const url = await nightmare
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.url();
.parsedUrl();
expect(url).toContain('/summary');
expect(url.hash).toContain('/summary');
});
it('should add the ticket to thirsday turn using the descriptor more menu', async () => {
@ -117,9 +117,9 @@ describe('Ticket descriptor path', () => {
const url = await nightmare
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.url();
.parsedUrl();
expect(url).toContain('/summary');
expect(url.hash).toContain('/summary');
});
it('should add the ticket to saturday turn using the descriptor more menu', async () => {

View File

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

View File

@ -37,9 +37,9 @@ describe('Ticket diary path', () => {
.waitForTextInElement(selectors.ticketsIndex.searchResult, 'address 21')
.waitToClick(selectors.ticketsIndex.searchResult)
.waitForURL('/summary')
.url();
.parsedUrl();
expect(url).toContain('/summary');
expect(url.hash).toContain('/summary');
});
it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async () => {

View File

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

View File

@ -2,11 +2,11 @@ const app = require('../../../server/server');
const routes = require('../routes');
describe('Auth routes', () => {
beforeEach(async() => {
beforeEach(async () => {
await app.models.User.destroyById(102);
});
afterAll(async() => {
afterAll(async () => {
await app.models.User.destroyById(102);
});

View File

@ -1,15 +1,30 @@
var UserError = require('../helpers').UserError;
var getFinalState = require('../helpers').getFinalState;
var isMultiple = require('../helpers').isMultiple;
let UserError = require('../helpers').UserError;
let getFinalState = require('../helpers').getFinalState;
let isMultiple = require('../helpers').isMultiple;
module.exports = Self => {
Self.validate('isDefaultAddress', isActive,
{message: 'Unable to default a disabled consignee'}
);
function isActive(err) {
if (!this.isActive && this.isDefaultAddress) err();
}
Self.validateAsync('isEqualizated', cannotHaveET, {
message: 'Cannot check Equalization Tax in this NIF/CIF'
});
async function cannotHaveET(err, done) {
let client = await Self.app.models.Client.findById(this.clientFk);
let tin = client.fi.toUpperCase();
let cannotHaveET = /^[A-B]/.test(tin);
if (cannotHaveET && this.isEqualizated)
err();
done();
}
Self.beforeRemote('findById', function(ctx, modelInstance, next) {
ctx.args.filter = {
include: [{

View File

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