From 8aed4013e1d09115dc522dac3ce2e76db8829641 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Wed, 6 Feb 2019 16:08:23 +0100 Subject: [PATCH] #1051 --- e2e/helpers/extensions.js | 1 + e2e/helpers/nightmare.js | 8 +++----- e2e/tests.js | 36 ------------------------------------ gulpfile.js | 33 ++++++++++++++++++++++++++++++--- loopback/locale/en.json | 5 ++++- 5 files changed, 38 insertions(+), 45 deletions(-) delete mode 100644 e2e/tests.js diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index b635de9de..1ba440d31 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -53,6 +53,7 @@ let actions = { if (currentUser === userName) { return this.waitToClick('vn-topbar a[ui-sref="home"]') .waitForURL('#!/') + .changeLanguageToEnglish() .then(done) .catch(done); } diff --git a/e2e/helpers/nightmare.js b/e2e/helpers/nightmare.js index 53fac12df..664af43c9 100644 --- a/e2e/helpers/nightmare.js +++ b/e2e/helpers/nightmare.js @@ -1,9 +1,9 @@ /* eslint no-console: 0 */ -import Nightmare from 'nightmare'; +const Nightmare = require('nightmare'); let nightmare; -export default function createNightmare(width = 1280, height = 720) { +module.exports = function createNightmare(width = 1280, height = 720) { if (nightmare) return nightmare; @@ -24,6 +24,4 @@ export default function createNightmare(width = 1280, height = 720) { nightmare.header('Accept-Language', 'en'); return nightmare; -} - -jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; +}; diff --git a/e2e/tests.js b/e2e/tests.js deleted file mode 100644 index 93bec8857..000000000 --- a/e2e/tests.js +++ /dev/null @@ -1,36 +0,0 @@ -require('@babel/register')({presets: ['@babel/preset-env']}); -require('@babel/polyfill'); - -process.on('warning', warning => { - console.log(warning.name); - console.log(warning.message); - console.log(warning.stack); -}); - -let verbose = false; - -if (process.argv[2] === '--v') - verbose = true; - -let Jasmine = require('jasmine'); -let jasmine = new Jasmine(); -let SpecReporter = require('jasmine-spec-reporter').SpecReporter; - -jasmine.loadConfig({ - spec_files: [ - `${__dirname}/**/*[sS]pec.js`, - `${__dirname}/helpers/extensions.js` - ], - helpers: [] -}); - -jasmine.addReporter(new SpecReporter({ - spec: { - // displayStacktrace: 'summary', - displaySuccessful: verbose, - displayFailedSpec: true, - displaySpecDuration: true - } -})); - -jasmine.execute(); diff --git a/gulpfile.js b/gulpfile.js index 831ae6dde..eb071a931 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -21,6 +21,7 @@ let backSources = [ '!node_modules', 'loopback', 'modules/*/back/**', + 'modules/*/back/*', 'back', 'print' ]; @@ -50,7 +51,6 @@ function backWatch(done) { nodemon({ exec: commands.join(' && '), - ext: 'js html css', args: ['backOnly'], watch: backSources, done: done @@ -112,13 +112,40 @@ backTest.description = `Watches for changes in modules to execute backTest task` // End to end tests function e2eOnly() { + require('@babel/register')({presets: ['@babel/preset-env']}); + require('@babel/polyfill'); + const jasmine = require('gulp-jasmine'); + const SpecReporter = require('jasmine-spec-reporter').SpecReporter; + const createNightmare = require('./e2e/helpers/nightmare'); if (argv.show || argv.s) process.env.E2E_SHOW = true; - return gulp.src('./e2e/tests.js') - .pipe(jasmine({reporter: 'none'})); + const specFiles = [ + `${__dirname}/e2e/paths/**/*[sS]pec.js`, + `${__dirname}/e2e/helpers/extensions.js` + ]; + + return gulp.src(specFiles).pipe(jasmine({ + errorOnFail: false, + timeout: 10000, + reporter: [ + new SpecReporter({ + spec: { + displayStacktrace: 'summary', + displaySuccessful: true, + displayFailedSpec: true, + displaySpecDuration: true, + } + }) + ] + }) + .on('jasmineDone', function() { + const nightmare = createNightmare(); + + nightmare.end(() => {}); + })); } e2eOnly.description = `Runs the e2e tests only`; diff --git a/loopback/locale/en.json b/loopback/locale/en.json index b94e67a0c..5b07cbe67 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -31,5 +31,8 @@ "Worker cannot be blank": "Worker cannot be blank", "You must delete the claim id %d first": "You must delete the claim id %d first", "You don't have enough privileges": "You don't have enough privileges", - "Tag value cannot be blank": "Tag value cannot be blank" + "Tag value cannot be blank": "Tag value cannot be blank", + "A client with that Web User name already exists": "A client with that Web User name already exists", + "The warehouse can't be repeated": "The warehouse can't be repeated", + "Barcode must be unique": "Barcode must be unique" } \ No newline at end of file