From 91f90a930c41c4d6beed461fad89e8f777f218f3 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Fri, 9 Mar 2018 20:04:03 +0100 Subject: [PATCH] smoke e2e tests plus gulp tasks --- e2e/smokes/01_client_path.spec.js | 42 +++++++++++++++++++++++++++++++ gulpfile.js | 12 ++++++++- smokes_tests.js | 38 ++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 e2e/smokes/01_client_path.spec.js create mode 100644 smokes_tests.js diff --git a/e2e/smokes/01_client_path.spec.js b/e2e/smokes/01_client_path.spec.js new file mode 100644 index 000000000..f441d4f7b --- /dev/null +++ b/e2e/smokes/01_client_path.spec.js @@ -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'); + }); + }); +}); diff --git a/gulpfile.js b/gulpfile.js index 303b15bc2..7c9be4d95 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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) {} diff --git a/smokes_tests.js b/smokes_tests.js new file mode 100644 index 000000000..3cf9d182e --- /dev/null +++ b/smokes_tests.js @@ -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();