diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 6e5393455c..36052d76d7 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -114,3 +114,10 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) { }, selectors.clientsView.searchResult, count) .then(done); }); + +Nightmare.action('waitForSnackbarReset', function(done) { + this.wait(() => { + return document.querySelector('vn-snackbar').innerText === ''; + }) + .then(done); +}); diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/create_client_path.spec.js index b7a0e85d5a..2f7cf72c88 100644 --- a/e2e/paths/create_client_path.spec.js +++ b/e2e/paths/create_client_path.spec.js @@ -6,7 +6,7 @@ const nightmare = createNightmare(); let longWait = 3000; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; +// jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; describe('Clients path', () => { it('should log in', done => { @@ -76,7 +76,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but name', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .type(selectors.createClientView.name, 'Bruce Wayne') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) @@ -90,7 +90,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but Tax Number', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .clearInput(selectors.createClientView.name) .type(selectors.createClientView.taxNumber, 'Wayne Industries Tax Number') .click(selectors.createClientView.createButton) @@ -105,7 +105,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but Business Name', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .clearInput(selectors.createClientView.taxNumber) .type(selectors.createClientView.businessName, 'Wayne Industries') .click(selectors.createClientView.createButton) @@ -120,7 +120,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but User Name', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .clearInput(selectors.createClientView.businessName) .type(selectors.createClientView.userName, 'Batman') .click(selectors.createClientView.createButton) @@ -135,7 +135,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but email while email have incorrect format', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .clearInput(selectors.createClientView.userName) .type(selectors.createClientView.email, 'I will save Gotham!') .click(selectors.createClientView.createButton) @@ -150,7 +150,7 @@ describe('Clients path', () => { it('should receive an error when clicking the create button having all the form fields empty but email', done => { nightmare - .wait(longWait) + .waitForSnackbarReset() .clearInput(selectors.createClientView.email) .type(selectors.createClientView.email, 'IAmBatman@WayneIndustries.gotham') .click(selectors.createClientView.createButton)