smoke e2e tests plus gulp tasks

This commit is contained in:
Carlos Jimenez 2018-03-09 20:04:03 +01:00
parent 4ffaa1b177
commit 91f90a930c
3 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,42 @@
import selectors from '../helpers/selectors';
import createNightmare from '../helpers/helpers';
describe('create client path', () => {
let nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
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('#!/clients');
});
});
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('#!/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('#!/clients');
});
});
});

View File

@ -67,6 +67,10 @@ gulp.task('e2e', ['docker-rebuild'], async () => {
await runSequenceP('e2e-only');
});
gulp.task('smokes', ['docker-rebuild'], async () => {
await runSequenceP('smokes-only');
});
/**
* Runs the e2e tests.
*/
@ -76,6 +80,12 @@ gulp.task('e2e-only', () => {
.pipe(jasmine({reporter: 'none'}));
});
gulp.task('smokes-only', () => {
const jasmine = require('gulp-jasmine');
return gulp.src('./smokes_tests.js')
.pipe(jasmine({reporter: 'none'}));
});
/**
* Runs the backend tests.
*/
@ -391,7 +401,7 @@ gulp.task('watch', function() {
* Rebuilds the docker and it's image, if these already exist, destroys and
* rebuilds them.
*/
gulp.task('docker-rebuild', async () => {
gulp.task('docker', async () => {
try {
await execP('docker rm -f dblocal');
} catch (e) {}

38
smokes_tests.js Normal file
View File

@ -0,0 +1,38 @@
require('babel-core/register')({presets: ['es2015']});
process.on('warning', warning => {
console.log(warning.name);
console.log(warning.message);
console.log(warning.stack);
});
var verbose = false;
if (process.argv[2] === '--v') {
verbose = true;
}
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
jasmine.loadConfig({
spec_files: [
'./e2e/smokes/**/*[sS]pec.js',
'./e2e/helpers/extensions.js'
],
helpers: [
'/services/utils/jasmineHelpers.js'
]
});
jasmine.addReporter(new SpecReporter({
spec: {
// displayStacktrace: 'summary',
displaySuccessful: verbose,
displayFailedSpec: true,
displaySpecDuration: true
}
}));
jasmine.execute();