e2e tests for create client path - basic data
This commit is contained in:
parent
19a5907c4d
commit
b049d8832f
|
@ -24,6 +24,13 @@ Nightmare.action('getInnerText', function(selector, done) {
|
|||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('getInputValue', function(selector, done) {
|
||||
this.wait(selector)
|
||||
.evaluate_now(function(elementToSelect) {
|
||||
return document.querySelectorAll(elementToSelect)[0].value;
|
||||
}, done, selector);
|
||||
});
|
||||
|
||||
Nightmare.action('clearInput', function(selector, done) {
|
||||
let backSpaces = [];
|
||||
for (let i = 0; i < 50; i += 1) {
|
||||
|
@ -129,7 +136,7 @@ Nightmare.action('waitForSnackbarReset', function(done) {
|
|||
|
||||
Nightmare.action('waitForURL', function(hashURL, done) {
|
||||
this.wait(hash => {
|
||||
return document.location.href.includes(hash);
|
||||
return document.location.hash.includes(hash);
|
||||
}, hashURL)
|
||||
.then(done);
|
||||
});
|
||||
|
|
|
@ -32,6 +32,7 @@ export default {
|
|||
createButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-create > form > div > vn-button-bar > vn-button > button'
|
||||
},
|
||||
basicData: {
|
||||
basicDataButton: '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(1) > li > a',
|
||||
nameInput: '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(2) > vn-textfield:nth-child(1) > div > input',
|
||||
taxNumberInput: '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(2) > vn-textfield:nth-child(2) > div > input',
|
||||
socialNameInput: '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(2) > vn-textfield:nth-child(3) > div > input',
|
||||
|
@ -42,5 +43,9 @@ export default {
|
|||
salesPersonInput: '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(2) > vn-vertical > vn-textfield > div > input',
|
||||
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',
|
||||
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'
|
||||
},
|
||||
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',
|
||||
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'
|
||||
}
|
||||
};
|
||||
|
|
|
@ -249,6 +249,21 @@ describe('Clients path', () => {
|
|||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should confirm the name have been edited`, done => {
|
||||
nightmare
|
||||
.waitForSnackbarReset()
|
||||
.click(selectors.fiscalData.fiscalDataButton)
|
||||
.wait(selectors.fiscalData.addressInput)
|
||||
.click(selectors.basicData.basicDataButton)
|
||||
.wait(selectors.basicData.nameInput)
|
||||
.getInputValue(selectors.basicData.nameInput)
|
||||
.then(result => {
|
||||
expect(result).toBe(`Carol Danvers Edited`);
|
||||
done();
|
||||
})
|
||||
.catch(catchErrors(done));
|
||||
});
|
||||
|
||||
it(`should edit the tax number`, done => {
|
||||
nightmare
|
||||
.wait(selectors.basicData.taxNumberInput)
|
||||
|
|
Loading…
Reference in New Issue