2017-11-03 17:32:58 +00:00
|
|
|
import config from '../helpers/config.js';
|
|
|
|
import createNightmare from '../helpers/nightmare';
|
|
|
|
import selectors from '../helpers/selectors.js';
|
|
|
|
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
const moduleAccessViewHashURL = '#!/';
|
|
|
|
|
2017-12-13 10:25:50 +00:00
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
|
|
|
|
2017-11-03 17:32:58 +00:00
|
|
|
describe('Edit basicData path', () => {
|
|
|
|
describe('warm up', () => {
|
|
|
|
it('should warm up login and fixtures', done => {
|
|
|
|
nightmare
|
|
|
|
.login()
|
|
|
|
.waitForURL(moduleAccessViewHashURL)
|
|
|
|
.waitToClick(selectors.globalItems.logOutButton)
|
|
|
|
.then(() => {
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should log in', done => {
|
|
|
|
nightmare
|
|
|
|
.login()
|
|
|
|
.waitForURL(moduleAccessViewHashURL)
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(url).toEqual(config.url + moduleAccessViewHashURL);
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-07 14:40:16 +00:00
|
|
|
it('should make sure the language is English', done => {
|
|
|
|
nightmare
|
2017-12-07 14:51:48 +00:00
|
|
|
.changeLanguageToEnglish()
|
|
|
|
.then(() => {
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
2017-12-07 14:40:16 +00:00
|
|
|
});
|
|
|
|
|
2017-11-03 17:32:58 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', done => {
|
|
|
|
nightmare
|
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(url).toEqual(config.url + '#!/clients');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should search for the user Bruce Wayne', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(result).toEqual(1);
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should click on the search result to access to the clients basic data', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
|
|
|
.waitForURL('basic-data')
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toContain('basic-data');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should edit the name', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.wait(selectors.basicData.nameInput)
|
|
|
|
.clearInput(selectors.basicData.nameInput)
|
2017-12-05 14:28:48 +00:00
|
|
|
.type(selectors.basicData.nameInput, 'Ororo Munroe')
|
2017-11-03 17:32:58 +00:00
|
|
|
.click(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should confirm the name have been edited', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
|
|
|
.click(selectors.fiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.fiscalData.addressInput)
|
|
|
|
.click(selectors.basicData.basicDataButton)
|
|
|
|
.wait(selectors.basicData.nameInput)
|
|
|
|
.getInputValue(selectors.basicData.nameInput)
|
|
|
|
.then(result => {
|
2017-12-05 14:28:48 +00:00
|
|
|
expect(result).toEqual('Ororo Munroe');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should edit the contact name', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
2017-12-05 14:28:48 +00:00
|
|
|
.wait(selectors.basicData.contactInput)
|
|
|
|
.clearInput(selectors.basicData.contactInput)
|
|
|
|
.type(selectors.basicData.contactInput, 'Black Panther')
|
2017-11-03 17:32:58 +00:00
|
|
|
.click(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should confirm the contact name have been edited', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
|
|
|
.click(selectors.fiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.fiscalData.addressInput)
|
|
|
|
.click(selectors.basicData.basicDataButton)
|
2017-12-05 14:28:48 +00:00
|
|
|
.wait(selectors.basicData.contactInput)
|
|
|
|
.getInputValue(selectors.basicData.contactInput)
|
2017-11-03 17:32:58 +00:00
|
|
|
.then(result => {
|
2017-12-05 14:28:48 +00:00
|
|
|
expect(result).toEqual('Black Panther');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should add the landline phone number', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.wait(selectors.basicData.phoneInput)
|
|
|
|
.clearInput(selectors.basicData.phoneInput)
|
|
|
|
.type(selectors.basicData.phoneInput, '123456789')
|
|
|
|
.click(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should confirm the landline phone number have been added', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
|
|
|
.click(selectors.fiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.fiscalData.addressInput)
|
|
|
|
.click(selectors.basicData.basicDataButton)
|
|
|
|
.wait(selectors.basicData.phoneInput)
|
|
|
|
.getInputValue(selectors.basicData.phoneInput)
|
|
|
|
.then(result => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(result).toEqual('123456789');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should add the mobile phone number', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.wait(selectors.basicData.mobileInput)
|
|
|
|
.clearInput(selectors.basicData.mobileInput)
|
|
|
|
.type(selectors.basicData.mobileInput, '987654321')
|
|
|
|
.click(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should confirm the mobile phone number have been added', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
|
|
|
.click(selectors.fiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.fiscalData.addressInput)
|
|
|
|
.click(selectors.basicData.basicDataButton)
|
|
|
|
.wait(selectors.basicData.mobileInput)
|
|
|
|
.getInputValue(selectors.basicData.mobileInput)
|
|
|
|
.then(result => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(result).toEqual('987654321');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should edit the email', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
2017-12-05 14:28:48 +00:00
|
|
|
.wait(selectors.basicData.emailInput)
|
|
|
|
.clearInput(selectors.basicData.emailInput)
|
|
|
|
.type(selectors.basicData.emailInput, 'Storm@verdnatura.es')
|
2017-11-03 17:32:58 +00:00
|
|
|
.click(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should confirm the email have been edited', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
|
|
|
.click(selectors.fiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.fiscalData.addressInput)
|
|
|
|
.click(selectors.basicData.basicDataButton)
|
2017-12-05 14:28:48 +00:00
|
|
|
.wait(selectors.basicData.emailInput)
|
|
|
|
.getInputValue(selectors.basicData.emailInput)
|
2017-11-03 17:32:58 +00:00
|
|
|
.then(result => {
|
2017-12-05 14:28:48 +00:00
|
|
|
expect(result).toEqual('Storm@verdnatura.es');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should select the sales person', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.basicData.salesPersonInput)
|
|
|
|
.waitToClick(selectors.basicData.salesBruceBannerOption)
|
2017-12-07 12:35:40 +00:00
|
|
|
.wait(200)
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.basicData.saveButton)
|
2017-11-03 17:32:58 +00:00
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-12-05 14:28:48 +00:00
|
|
|
it('should confirm the sales person have been selected', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.fiscalData.fiscalDataButton)
|
2017-11-03 17:32:58 +00:00
|
|
|
.wait(selectors.fiscalData.addressInput)
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.basicData.basicDataButton)
|
2017-12-07 12:35:40 +00:00
|
|
|
.wait(200)
|
2017-12-05 14:28:48 +00:00
|
|
|
.getInputValue(selectors.basicData.salesPersonInput)
|
2017-11-03 17:32:58 +00:00
|
|
|
.then(result => {
|
2017-12-05 14:28:48 +00:00
|
|
|
expect(result).toEqual('Bruce Banner');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should select the channel', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitToClick(selectors.basicData.channelInput)
|
|
|
|
.waitToClick(selectors.basicData.channelMetropolisOption)
|
2017-12-07 12:35:40 +00:00
|
|
|
.wait(400)
|
2017-11-03 17:32:58 +00:00
|
|
|
.waitToClick(selectors.basicData.saveButton)
|
|
|
|
.wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
.then(result => {
|
2017-12-07 14:40:16 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2017-11-09 12:54:06 +00:00
|
|
|
it('should confirm the channel have been selected', done => {
|
2017-11-03 17:32:58 +00:00
|
|
|
nightmare
|
|
|
|
.waitForSnackbarReset()
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.fiscalData.fiscalDataButton)
|
2017-11-03 17:32:58 +00:00
|
|
|
.wait(selectors.fiscalData.addressInput)
|
2017-12-05 14:28:48 +00:00
|
|
|
.waitToClick(selectors.basicData.basicDataButton)
|
2017-12-07 12:35:40 +00:00
|
|
|
.wait(400)
|
2017-11-03 17:32:58 +00:00
|
|
|
.getInputValue(selectors.basicData.channelInput)
|
|
|
|
.then(result => {
|
2017-11-08 14:43:34 +00:00
|
|
|
expect(result).toEqual('Metropolis newspaper');
|
2017-11-03 17:32:58 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
});
|