2017-12-15 09:07:52 +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 = '#!/';
|
|
|
|
|
|
|
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
|
|
|
|
2018-02-12 12:19:54 +00:00
|
|
|
describe('Add address notes path', () => {
|
2017-12-15 09:07:52 +00:00
|
|
|
it('should log in', done => {
|
|
|
|
nightmare
|
|
|
|
.login()
|
|
|
|
.waitForURL(moduleAccessViewHashURL)
|
|
|
|
.url()
|
|
|
|
.then(url => {
|
|
|
|
expect(url).toEqual(config.url + moduleAccessViewHashURL);
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should make sure the language is English', done => {
|
|
|
|
nightmare
|
|
|
|
.changeLanguageToEnglish()
|
|
|
|
.then(() => {
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
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 => {
|
|
|
|
expect(url).toEqual(config.url + '#!/clients');
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the user Bruce Banner', done => {
|
|
|
|
nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2018-02-12 12:19:54 +00:00
|
|
|
it(`should click on the search result to access to the client addresses`, done => {
|
2017-12-15 09:07:52 +00:00
|
|
|
nightmare
|
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
2018-02-12 12:19:54 +00:00
|
|
|
.waitToClick(selectors.addresses.addressesButton)
|
|
|
|
.waitForURL('addresses/list')
|
2017-12-15 09:07:52 +00:00
|
|
|
.url()
|
|
|
|
.then(url => {
|
2018-02-12 12:19:54 +00:00
|
|
|
expect(url).toContain('addresses/list');
|
2017-12-15 09:07:52 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2018-02-12 12:19:54 +00:00
|
|
|
it(`should click on the edit icon of the default address`, done => {
|
2017-12-15 09:07:52 +00:00
|
|
|
nightmare
|
2018-02-12 12:19:54 +00:00
|
|
|
.waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand')
|
|
|
|
.waitToClick(selectors.addresses.firstEditButton)
|
|
|
|
.waitForURL('/edit')
|
2017-12-15 11:51:06 +00:00
|
|
|
.url()
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(result => {
|
2018-02-12 12:19:54 +00:00
|
|
|
expect(result).toContain('/edit');
|
2017-12-15 09:07:52 +00:00
|
|
|
done();
|
|
|
|
})
|
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
|
2018-02-12 12:19:54 +00:00
|
|
|
it('should add as many notes as observation types', done => {
|
2017-12-15 09:07:52 +00:00
|
|
|
nightmare
|
2018-02-12 12:19:54 +00:00
|
|
|
.waitToClick(selectors.addresses.defaultCheckboxInput)
|
|
|
|
// .waitToClick(selectors.fiscalData.saveButton)
|
|
|
|
// .wait(selectors.globalItems.snackbarIsActive)
|
|
|
|
// .getInnerText(selectors.globalItems.snackbarIsActive)
|
|
|
|
// .then(result => {
|
|
|
|
// expect(result).toContain('Some fields are invalid');
|
|
|
|
// done();
|
|
|
|
// })
|
2017-12-15 09:07:52 +00:00
|
|
|
.catch(catchErrors(done));
|
|
|
|
});
|
|
|
|
});
|