import selectors from '../helpers/selectors'; import createNightmare from '../helpers/nightmare'; describe('create client path', () => { let nightmare = createNightmare(); beforeAll(() => { return nightmare .waitForLogin('employee'); }); it('should access to the clients index by clicking the clients button', () => { return nightmare .click(selectors.moduleAccessView.clientsSectionButton) .wait(selectors.clientsIndex.createClientButton) .parsedUrl() .then(url => { expect(url.hash).toEqual('#!/client/index'); }); }); it('should access to the create client view by clicking the create-client floating button', () => { return nightmare .click(selectors.clientsIndex.createClientButton) .wait(selectors.createClientView.createButton) .parsedUrl() .then(url => { expect(url.hash).toEqual('#!/client/create'); }); }); it('should cancel the client creation to go back to clients index', () => { return nightmare .waitToClick(selectors.globalItems.applicationsMenuButton) .waitToClick(selectors.globalItems.clientsButton) .wait(selectors.clientsIndex.createClientButton) .parsedUrl() .then(url => { expect(url.hash).toEqual('#!/client/index'); }); }); });