successfully merged sequences for gulp docker and end to end tests

This commit is contained in:
Carlos Jimenez 2018-01-08 13:40:05 +01:00
parent 2715699a35
commit 32a542a81d
4 changed files with 15 additions and 15 deletions

View File

@ -2,13 +2,12 @@ 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('Add credit path', () => {
describe('warm up', () => {
it('should warm up login and fixtures', done => {
nightmare
@ -104,7 +103,7 @@ fdescribe('Add credit path', () => {
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
expect(result).toEqual('Data saved');
expect(result).toEqual('Data saved!');
done();
})
.catch(catchErrors(done));

View File

@ -18,8 +18,8 @@ var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
jasmine.loadConfig({
spec_files: [
'./e2e/helpers/extensions.js',
'./e2e/**/*[sS]pec.js'
'./e2e/**/*[sS]pec.js',
'./e2e/helpers/extensions.js'
],
helpers: [
'/services/utils/jasmineHelpers.js'

View File

@ -1,4 +1,5 @@
var gulp = require('gulp');
const jasmine = require('gulp-jasmine');
var gutil = require('gulp-util');
var wrap = require('gulp-wrap');
var concat = require('gulp-concat');
@ -154,18 +155,19 @@ gulp.task('test', callback => {
// e2e tests
gulp.task('e2e', callback => {
runSequence('docker', 'runDockerLogs', 'endToEndTests', callback);
runSequence('docker', 'waitForMySQL', 'endToEndTests', callback);
});
gulp.task('runDockerLogs', callback => {
gulp.task('waitForMySQL', callback => {
let maxInterval = 15000;
let interval = 1000;
let timer = 0;
console.log('Waiting for MySQL init process...');
let waitForLocaldb = setInterval(() => {
if (timer < 15000) {
timer += 1000;
if (timer < maxInterval) {
timer += interval;
exec('docker logs --tail 4 dblocal', (err, stdout, stderr) => {
if (stdout.includes('MySQL init process done. Ready for start up.')) {
console.log('MySQL init process done.');
clearInterval(waitForLocaldb);
callback(err);
}
@ -174,14 +176,12 @@ gulp.task('runDockerLogs', callback => {
console.log('MySQL connection not established whithin 15 secs!');
clearInterval(waitForLocaldb);
}
}, 1000);
}, interval);
});
gulp.task('endToEndTests', callback => {
exec('npm run e2e', (err, stdout, stderr) => {
console.log(stdout);
callback(err);
});
gulp.src('./e2e_tests.js')
.pipe(jasmine({reporter: 'none'}));
});
// docker dblocal

View File

@ -44,6 +44,7 @@
"gulp-concat": "^2.6.0",
"gulp-extend": "^0.2.0",
"gulp-install": "^1.1.0",
"gulp-jasmine": "^3.0.0",
"gulp-print": "^2.0.1",
"gulp-util": "^3.0.7",
"gulp-wrap": "^0.13.0",