From bf4cbe6c1a29c428add38ed3521a4e18d73d1840 Mon Sep 17 00:00:00 2001 From: Carlos Date: Sun, 29 Oct 2017 19:43:39 +0100 Subject: [PATCH] e2e warm up added for 1st usage of fixtures. --- e2e/helpers/extensions.js | 2 +- e2e/helpers/selectors.js | 1 + e2e/paths/create_client_path.spec.js | 18 +++++++++++++++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 234df5c0f9..b4359098fe 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -126,7 +126,7 @@ Nightmare.action('waitForSnackbarReset', function(done) { Nightmare.action('waitForURL', function(hashURL, done) { this.wait(200); this.wait(hash => { - return document.location.hash === hash; + return document.location.hash.includes(hash); }, hashURL) .then(done); }); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index fbc1047de4..0ef70177f0 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -7,6 +7,7 @@ export default { }, globalItems: { topBar: 'vn-topbar', + logOutButton: 'body > vn-app > vn-vertical > vn-topbar > header > vn-main-menu > div > vn-icon:nth-child(4)', snackbarIsActive: '.mdl-snackbar--active > .mdl-snackbar__text', applicationsMenuButton: '#apps > i', applicationsMenuVisible: 'body > vn-app > vn-vertical > vn-topbar > header > vn-main-menu > div .is-visible > div', diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/create_client_path.spec.js index 8de5bf166b..f62513527c 100644 --- a/e2e/paths/create_client_path.spec.js +++ b/e2e/paths/create_client_path.spec.js @@ -4,7 +4,19 @@ import selectors from '../helpers/selectors.js'; import {catchErrors} from '../../services/utils/jasmineHelpers'; const nightmare = createNightmare(); const moduleAccessViewHashURL = '#!/'; -const basicDataViewHashURL = '#!/clients/14/basic-data'; + +describe('warm up', () => { + it('should warm up login and fixtures', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .waitToClick(selectors.globalItems.logOutButton) + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); +}); describe('Clients path', () => { describe('Create', () => { @@ -215,10 +227,10 @@ describe('Clients path', () => { // nightmare // .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) // .waitToClick(selectors.clientsIndex.searchResult) // this is targeting Bruce Wayne 1 of 10 times instead of Carol Danvers watchout for intermitence - // .waitForURL(basicDataViewHashURL) + // .waitForURL('basic-data') // .url() // .then(url => { - // expect(url).toBe(config.url + basicDataViewHashURL); + // expect(url).toContain('basic-data'); // done(); // }) // .catch(catchErrors(done));