selectors.js refactor plus e2e tests

This commit is contained in:
Carlos 2017-11-08 15:43:34 +01:00
parent 97da7e5c10
commit 60a478e5c6
7 changed files with 96 additions and 72 deletions

View File

@ -11,10 +11,10 @@
<vn-title>Fiscal data</vn-title> <vn-title>Fiscal data</vn-title>
<vn-horizontal> <vn-horizontal>
<vn-one> <vn-one>
<vn-check label="Facturar" field="$ctrl.client.hasToInvoice"></vn-check> <vn-check label="Has to invoice" field="$ctrl.client.hasToInvoice"></vn-check>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-check label="Factura impresa" field="$ctrl.client.invoiceByEmail"></vn-check> <vn-check label="Invoice by mail" field="$ctrl.client.invoiceByEmail"></vn-check>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
@ -37,7 +37,7 @@
url="/client/api/Countries" url="/client/api/Countries"
show-field="name" show-field="name"
value-field="id" value-field="id"
label="País"> label="CountryFk">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
</vn-vertical> </vn-vertical>

View File

@ -1,5 +1,8 @@
{ {
"Client": "Cliente", "Client": "Cliente",
"Clients": "Clientes", "Clients": "Clientes",
"Fiscal data": "Datos Fiscales" "Fiscal data": "Datos Fiscales",
"Has to invoice": "Factura",
"Invoice by mail": "Factura impresa",
"CountryFk": "País"
} }

View File

@ -13,5 +13,6 @@ export default {
vnItemClient: 'vn-item-client', vnItemClient: 'vn-item-client',
vnFloatButton: 'vn-float-button > button', vnFloatButton: 'vn-float-button > button',
vnMenuItem: 'vn-menu-item > li > a', vnMenuItem: 'vn-menu-item > li > a',
vnAutocomplete: 'vn-autocomplete' vnAutocomplete: 'vn-autocomplete',
vnCheck: 'vn-check'
}; };

View File

@ -1,16 +1,6 @@
// eslint max-len: ["error", 500] // eslint max-len: ["error", 500]
// eslint key-spacing: ["error", 500] // eslint key-spacing: ["error", 500]
import components from './selector_variables.js'; import components from './components_selectors.js';
function checkElement(selector, attributeValue) {
let aux = selector.split(' ');
if (aux[0] === 'vn-autocomplete') {
return selector.replace(aux[0], `${aux[0]}[field="${attributeValue}"]`);
}
if (aux[0] === 'vn-textfield') {
return selector.replace(aux[4], `${aux[4]}[name="${attributeValue}"]`);
}
}
export default { export default {
login: { login: {
@ -35,34 +25,34 @@ export default {
createClientButton: `${components.vnFloatButton}` createClientButton: `${components.vnFloatButton}`
}, },
createClientView: { createClientView: {
name: `${checkElement(components.vnTextfield, 'name')}`, name: `${components.vnTextfield}[name="name"]`,
taxNumber: `${checkElement(components.vnTextfield, 'fi')}`, taxNumber: `${components.vnTextfield}[name="fi"]`,
socialName: `${checkElement(components.vnTextfield, 'socialName')}`, socialName: `${components.vnTextfield}[name="socialName"]`,
userName: `${checkElement(components.vnTextfield, 'userName')}`, userName: `${components.vnTextfield}[name="userName"]`,
email: `${checkElement(components.vnTextfield, 'email')}`, email: `${components.vnTextfield}[name="email"]`,
createButton: `${components.vnSubmit}` createButton: `${components.vnSubmit}`
}, },
basicData: { basicData: {
basicDataButton: `${components.vnMenuItem}`, basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`,
nameInput: `${checkElement(components.vnTextfield, 'name')}`, nameInput: `${components.vnTextfield}[name="name"]`,
taxNumberInput: `${checkElement(components.vnTextfield, 'fi')}`, taxNumberInput: `${components.vnTextfield}[name="fi"]`,
socialNameInput: `${checkElement(components.vnTextfield, 'socialName')}`, socialNameInput: `${components.vnTextfield}[name="socialName"]`,
phoneInput: `${checkElement(components.vnTextfield, 'phone')}`, phoneInput: `${components.vnTextfield}[name="phone"]`,
mobileInput: `${checkElement(components.vnTextfield, 'mobile')}`, mobileInput: `${components.vnTextfield}[name="mobile"]`,
faxInput: `${checkElement(components.vnTextfield, 'fax')}`, faxInput: `${components.vnTextfield}[name="fax"]`,
emailInput: `${checkElement(components.vnTextfield, 'email')}`, emailInput: `${components.vnTextfield}[name="email"]`,
salesPersonInput: `${checkElement(components.vnAutocomplete, '$ctrl.client.salesPersonFk')}`, salesPersonInput: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"]`,
channelInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-textfield > div > input', channelInput: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > ${components.vnTextfield}`,
channelMetropolisOption: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(4) > vn-autocomplete:nth-child(3) > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)', channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(3)`,
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-basic-data > form > vn-button-bar > vn-submit > input' saveButton: `${components.vnSubmit}`
}, },
fiscalData: { fiscalData: {
fiscalDataButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-empty > vn-left-menu > vn-card > div > vn-vertical > vn-actions > vn-horizontal > ul > vn-menu-item:nth-child(2) > li > a', fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`,
addressInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-textfield:nth-child(1) > div > input', hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`,
hasToInvoiceCheckboxLabel: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label', hasToInvoiceCheckboxInput: `${components.vnCheck}[label='Has to invoice'] > label > label > input`,
hasToInvoiceCheckboxInput: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-check > label > input', invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
// printToInvoiceCheckboxLabel: '', invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
// printInvoiceCheckboxInput: '', addressInput: `${components.vnTextfield}[name="street"]`,
saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input' saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input'
} }
}; };

View File

@ -25,7 +25,7 @@ describe('create client path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -37,7 +37,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -51,7 +51,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 0)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(0); expect(result).toEqual(0);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -63,7 +63,7 @@ describe('create client path', () => {
.wait(selectors.createClientView.createButton) .wait(selectors.createClientView.createButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/create'); expect(url).toEqual(config.url + '#!/create');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -75,7 +75,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe('No hay cambios que guardar'); expect(result).toEqual('No hay cambios que guardar');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -149,7 +149,7 @@ describe('create client path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`Algunos campos no son válidos`); expect(result).toEqual(`Algunos campos no son válidos`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -198,7 +198,7 @@ describe('create client path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -212,7 +212,7 @@ describe('create client path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit basicData path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit basicData path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit basicData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -81,7 +81,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -96,7 +96,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.nameInput) .wait(selectors.basicData.nameInput)
.getInputValue(selectors.basicData.nameInput) .getInputValue(selectors.basicData.nameInput)
.then(result => { .then(result => {
expect(result).toBe(`Carol Danvers Edited`); expect(result).toEqual(`Carol Danvers Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -111,7 +111,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -126,7 +126,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.taxNumberInput) .wait(selectors.basicData.taxNumberInput)
.getInputValue(selectors.basicData.taxNumberInput) .getInputValue(selectors.basicData.taxNumberInput)
.then(result => { .then(result => {
expect(result).toBe(`AVG tax Edited`); expect(result).toEqual(`AVG tax Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -141,7 +141,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -156,7 +156,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.socialNameInput) .wait(selectors.basicData.socialNameInput)
.getInputValue(selectors.basicData.socialNameInput) .getInputValue(selectors.basicData.socialNameInput)
.then(result => { .then(result => {
expect(result).toBe(`Avengers Team Edited`); expect(result).toEqual(`Avengers Team Edited`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -171,7 +171,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -186,7 +186,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.phoneInput) .wait(selectors.basicData.phoneInput)
.getInputValue(selectors.basicData.phoneInput) .getInputValue(selectors.basicData.phoneInput)
.then(result => { .then(result => {
expect(result).toBe('123456789'); expect(result).toEqual('123456789');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -201,7 +201,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -216,7 +216,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.mobileInput) .wait(selectors.basicData.mobileInput)
.getInputValue(selectors.basicData.mobileInput) .getInputValue(selectors.basicData.mobileInput)
.then(result => { .then(result => {
expect(result).toBe('987654321'); expect(result).toEqual('987654321');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -231,7 +231,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -246,7 +246,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.faxInput) .wait(selectors.basicData.faxInput)
.getInputValue(selectors.basicData.faxInput) .getInputValue(selectors.basicData.faxInput)
.then(result => { .then(result => {
expect(result).toBe('432198765'); expect(result).toEqual('432198765');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -261,7 +261,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -276,7 +276,7 @@ describe('Edit basicData path', () => {
.wait(selectors.basicData.emailInput) .wait(selectors.basicData.emailInput)
.getInputValue(selectors.basicData.emailInput) .getInputValue(selectors.basicData.emailInput)
.then(result => { .then(result => {
expect(result).toBe('CarolDanversEdited@verdnatura.es'); expect(result).toEqual('CarolDanversEdited@verdnatura.es');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -290,7 +290,7 @@ describe('Edit basicData path', () => {
// .wait(selectors.globalItems.snackbarIsActive) // .wait(selectors.globalItems.snackbarIsActive)
// .getInnerText(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive)
// .then(result => { // .then(result => {
// expect(result).toBe(`¡Datos guardados!`); // expect(result).toEqual(`¡Datos guardados!`);
// done(); // done();
// }) // })
// .catch(catchErrors(done)); // .catch(catchErrors(done));
@ -305,7 +305,7 @@ describe('Edit basicData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe(`¡Datos guardados!`); expect(result).toEqual(`¡Datos guardados!`);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -320,7 +320,7 @@ describe('Edit basicData path', () => {
.wait(100) .wait(100)
.getInputValue(selectors.basicData.channelInput) .getInputValue(selectors.basicData.channelInput)
.then(result => { .then(result => {
expect(result).toBe('Metropolis newspaper'); expect(result).toEqual('Metropolis newspaper');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));

View File

@ -25,7 +25,7 @@ describe('Edit fiscalData path', () => {
.waitForURL(moduleAccessViewHashURL) .waitForURL(moduleAccessViewHashURL)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + moduleAccessViewHashURL); expect(url).toEqual(config.url + moduleAccessViewHashURL);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -39,7 +39,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.clientsIndex.createClientButton) .wait(selectors.clientsIndex.createClientButton)
.url() .url()
.then(url => { .then(url => {
expect(url).toBe(config.url + '#!/clients'); expect(url).toEqual(config.url + '#!/clients');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -53,7 +53,7 @@ describe('Edit fiscalData path', () => {
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult) .countSearchResults(selectors.clientsIndex.searchResult)
.then(result => { .then(result => {
expect(result).toBe(1); expect(result).toEqual(1);
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -80,7 +80,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.globalItems.snackbarIsActive) .wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => { .then(result => {
expect(result).toBe('¡Datos guardados!'); expect(result).toEqual('¡Datos guardados!');
done(); done();
}) })
.catch(catchErrors(done)); .catch(catchErrors(done));
@ -95,7 +95,37 @@ describe('Edit fiscalData path', () => {
.wait(selectors.fiscalData.hasToInvoiceCheckboxLabel) .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).checked; return document.querySelector(selector).checked;
}, selectors.fiscalData.hasToInvoiceCheckboxInput) }, selectors.fiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
done();
})
.catch(catchErrors(done));
});
it(`should uncheck the invoiceByMail checkbox`, done => {
nightmare
.waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toEqual('¡Datos guardados!');
done();
})
.catch(catchErrors(done));
});
it(`should confirm invoiceByMail checkbox is unchecked`, done => {
nightmare
.waitForSnackbarReset()
.waitToClick(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.invoiceByMailCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.fiscalData.invoiceByMailCheckboxLabel)
.then(value => { .then(value => {
expect(value).toBeFalsy(); expect(value).toBeFalsy();
done(); done();