salix/e2e/paths/client-module/06_add_address_notes.spec.js

64 lines
2.3 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Add address notes path', () => {
const nightmare = createNightmare();
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.urlParsed()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});
});
it('should search for the user Bruce Banner', () => {
return 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);
});
});
it(`should click on the search result to access to the client addresses`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('addresses/list')
.url()
.then(url => {
expect(url).toContain('addresses/list');
});
});
it(`should click on the edit icon of the default address`, () => {
return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url()
.then(result => {
expect(result).toContain('/edit');
});
});
// it('should add as many notes as observation types', () => {
// return nightmare
// .waitToClick(selectors.clientAddresses.defaultCheckboxInput)
// .waitToClick(selectors.clientFiscalData.saveButton)
// .waitForSnackbar()
// .then(result => {
// expect(result).toContain('Some fields are invalid');
// })
// });
});