fixed url() problems for e2e create clients path, plus extension implementation.

This commit is contained in:
Carlos 2017-09-18 17:28:47 +02:00
parent 59a533473c
commit 26a1d7fb29
2 changed files with 12 additions and 3 deletions

View File

@ -10,8 +10,9 @@ function child(selector, childNumber) {
Nightmare.action('login', function(done) {
try {
this.goto(`${config.url}auth/?apiKey=salix`)
.wait(selectors.login.textFieldInput)
.write(`${child(selectors.login.textFieldInput, 1)}`, 'nightmare')
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmare')
.write(`${child(selectors.login.textFieldInput, 2)}`, 'nightmarePassword')
.click(selectors.login.submitButton)
.then(done);
} catch (err) {
@ -121,3 +122,10 @@ Nightmare.action('waitForSnackbarReset', function(done) {
})
.then(done);
});
Nightmare.action('waitForURL', function(hashURL, done) {
this.wait(hash => {
return document.location.hash === hash;
}, hashURL)
.then(done);
});

View File

@ -3,6 +3,7 @@ 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;
@ -10,10 +11,10 @@ describe('Clients path', () => {
it('should log in', done => {
nightmare
.login()
.wait(selectors.globalItems.topBar)
.waitForURL(moduleAccessViewHashURL)
.url()
.then(url => {
expect(url).toBe(config.url + '#!/');
expect(url).toBe(config.url + moduleAccessViewHashURL);
done();
})
.catch(catchErrors(done));