e2e path for add credit and gulp tasks for faster fixtures in progress
This commit is contained in:
parent
b3eac25e8a
commit
c1e798790f
|
@ -12,7 +12,7 @@ export default class App {
|
||||||
this.$rootScope = $rootScope;
|
this.$rootScope = $rootScope;
|
||||||
}
|
}
|
||||||
show(message) {
|
show(message) {
|
||||||
if (this.snackbar) this.snackbar.show({message: message});
|
if (this.snackbar) this.snackbar.show({message: message, timeout: 400});
|
||||||
}
|
}
|
||||||
showMessage(message) {
|
showMessage(message) {
|
||||||
this.show(message);
|
this.show(message);
|
||||||
|
|
|
@ -114,5 +114,12 @@ export default {
|
||||||
noteInput: `${components.vnTextarea}[label="Note"]`,
|
noteInput: `${components.vnTextarea}[label="Note"]`,
|
||||||
saveButton: `${components.vnSubmit}`,
|
saveButton: `${components.vnSubmit}`,
|
||||||
firstNoteText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-notes > vn-card > div > vn-vertical > vn-one:nth-child(2) > vn-horizontal:nth-child(2) > b'
|
firstNoteText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-notes > vn-card > div > vn-vertical > vn-one:nth-child(2) > vn-horizontal:nth-child(2) > b'
|
||||||
|
},
|
||||||
|
credit: {
|
||||||
|
creditButton: `${components.vnMenuItem}[ui-sref="clientCard.credit.list"]`,
|
||||||
|
addCreditFloatButton: `${components.vnFloatButton}`,
|
||||||
|
creditInput: `${components.vnTextfield}[name="credit"]`,
|
||||||
|
saveButton: `${components.vnSubmit}`,
|
||||||
|
firstCreditText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-credit-list > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(1) > vn-one'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ const moduleAccessViewHashURL = '#!/';
|
||||||
|
|
||||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||||
|
|
||||||
describe('Edit notes path', () => {
|
describe('Add notes path', () => {
|
||||||
describe('warm up', () => {
|
describe('warm up', () => {
|
||||||
it('should warm up login and fixtures', done => {
|
it('should warm up login and fixtures', done => {
|
||||||
nightmare
|
nightmare
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
import config from '../helpers/config.js';
|
||||||
|
import createNightmare from '../helpers/nightmare';
|
||||||
|
import selectors from '../helpers/selectors.js';
|
||||||
|
import {catchErrors} from '../../services/utils/jasmineHelpers';
|
||||||
|
import { fail } from 'assert';
|
||||||
|
const nightmare = createNightmare();
|
||||||
|
const moduleAccessViewHashURL = '#!/';
|
||||||
|
|
||||||
|
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
|
||||||
|
|
||||||
|
fdescribe('Add credit path', () => {
|
||||||
|
describe('warm up', () => {
|
||||||
|
it('should warm up login and fixtures', done => {
|
||||||
|
nightmare
|
||||||
|
.login()
|
||||||
|
.waitForURL(moduleAccessViewHashURL)
|
||||||
|
.waitToClick(selectors.globalItems.logOutButton)
|
||||||
|
.then(() => {
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should log in', done => {
|
||||||
|
nightmare
|
||||||
|
.login()
|
||||||
|
.waitForURL(moduleAccessViewHashURL)
|
||||||
|
.url()
|
||||||
|
.then(url => {
|
||||||
|
expect(url).toEqual(config.url + moduleAccessViewHashURL);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should make sure the language is English', done => {
|
||||||
|
nightmare
|
||||||
|
.changeLanguageToEnglish()
|
||||||
|
.then(() => {
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should click on the Clients button of the top bar menu', done => {
|
||||||
|
nightmare
|
||||||
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
|
.url()
|
||||||
|
.then(url => {
|
||||||
|
expect(url).toEqual(config.url + '#!/clients');
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should search for the user Petter Parker', done => {
|
||||||
|
nightmare
|
||||||
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
|
.click(selectors.clientsIndex.searchButton)
|
||||||
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual(1);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the search result to access to the client's credit`, done => {
|
||||||
|
nightmare
|
||||||
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
|
.waitToClick(selectors.credit.creditButton)
|
||||||
|
.waitForURL('credit/list')
|
||||||
|
.url()
|
||||||
|
.then(url => {
|
||||||
|
expect(url).toContain('credit/list');
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should click on the add credit button`, done => {
|
||||||
|
nightmare
|
||||||
|
.waitToClick(selectors.credit.addCreditFloatButton)
|
||||||
|
.waitForURL('/credit/create')
|
||||||
|
.url()
|
||||||
|
.then(url => {
|
||||||
|
expect(url).toContain('/credit/create');
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should edit the credit`, done => {
|
||||||
|
nightmare
|
||||||
|
.type(selectors.credit.creditInput, 999)
|
||||||
|
.click(selectors.credit.saveButton)
|
||||||
|
.wait(selectors.globalItems.snackbarIsActive)
|
||||||
|
.getInnerText(selectors.globalItems.snackbarIsActive)
|
||||||
|
.then(result => {
|
||||||
|
expect(result).toEqual('Data saved!');
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should confirm the credit was updated', done => {
|
||||||
|
nightmare
|
||||||
|
.waitForSnackbarReset()
|
||||||
|
.wait(selectors.credit.firstCreditText)
|
||||||
|
.getInnerText(selectors.credit.firstCreditText)
|
||||||
|
.then(value => {
|
||||||
|
expect(value).toContain(999);
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(catchErrors(done));
|
||||||
|
});
|
||||||
|
});
|
29
gulpfile.js
29
gulpfile.js
|
@ -152,6 +152,35 @@ gulp.task('test', callback => {
|
||||||
return require('./services_tests').start();
|
return require('./services_tests').start();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// e2e tests
|
||||||
|
gulp.task('e2e', callback => {
|
||||||
|
runSequence('docker', 'runDockerLogs', 'endToEndTests', callback);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('runDockerLogs', callback => {
|
||||||
|
let timer = 0;
|
||||||
|
let waitForLocaldb = setInterval(() => {
|
||||||
|
if (timer < 15000) {
|
||||||
|
timer += 1000;
|
||||||
|
exec('docker logs dblocal', (err, stdout, stderr) => {
|
||||||
|
if (stdout.includes('starting as process 1')) {
|
||||||
|
console.log(stdout);
|
||||||
|
clearInterval(waitForLocaldb);
|
||||||
|
callback(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
clearInterval(waitForLocaldb);
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('endToEndTests', callback => {
|
||||||
|
exec('node e2e_tests', err => {
|
||||||
|
callback(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
// docker dblocal
|
// docker dblocal
|
||||||
gulp.task('docker', callback => {
|
gulp.task('docker', callback => {
|
||||||
runSequence('deleteDockerDb', 'deleteDockerImageDb', 'buildDockerDb', 'runDockerDb', callback);
|
runSequence('deleteDockerDb', 'deleteDockerImageDb', 'buildDockerDb', 'runDockerDb', callback);
|
||||||
|
|
Loading…
Reference in New Issue