refactor on e2e selectors and discal data spec

This commit is contained in:
Carlos 2017-11-09 09:03:41 +01:00
parent f6d9f44df4
commit bc43d5c3c4
3 changed files with 63 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.DS_Store
node_modules
build
npm-debug.log

View File

@ -53,6 +53,7 @@ export default {
invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
addressInput: `${components.vnTextfield}[name="street"]`,
cityInput: `${components.vnTextfield}[name="city"]`,
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

@ -132,4 +132,64 @@ describe('Edit fiscalData path', () => {
})
.catch(catchErrors(done));
});
it(`should edit the address`, done => {
nightmare
.wait(selectors.fiscalData.addressInput)
.clearInput(selectors.fiscalData.addressInput)
.type(selectors.fiscalData.addressInput, 'Alpha Flight Low-Orbit')
.click(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 the address have been edited`, done => {
nightmare
.waitForSnackbarReset()
.click(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.click(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.addressInput)
.getInputValue(selectors.fiscalData.addressInput)
.then(result => {
expect(result).toEqual(`Alpha Flight Low-Orbit`);
done();
})
.catch(catchErrors(done));
});
it(`should edit the city`, done => {
nightmare
.wait(selectors.fiscalData.cityInput)
.clearInput(selectors.fiscalData.cityInput)
.type(selectors.fiscalData.cityInput, 'N/A')
.click(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 the acity have been edited`, done => {
nightmare
.waitForSnackbarReset()
.click(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.click(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.cityInput)
.getInputValue(selectors.fiscalData.cityInput)
.then(result => {
expect(result).toEqual(`N/A`);
done();
})
.catch(catchErrors(done));
});
});