From 864413b5d6ed99fbceefd07b36a0e19edb5be2b3 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Mon, 30 Jan 2017 18:38:06 -0700 Subject: [PATCH] Fixed issues with e2e --- bin/cli-setup | 11 ++++++++--- bin/cli-users | 21 +++++++++++---------- scripts/pree2e.sh | 4 ++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bin/cli-setup b/bin/cli-setup index 7645e171d..eaa2b90b1 100755 --- a/bin/cli-setup +++ b/bin/cli-setup @@ -22,17 +22,22 @@ util.onshutdown([ program .description('runs the setup wizard to setup the application') + .option('--defaults', 'apply defaults for config instead of prompting') .parse(process.argv); //============================================================================== // Setup the application //============================================================================== -console.log('We\'ll ask you some questions in order to setup your installation of Talk.\n'); - SettingsService .init() .then((settings) => { + if (program.defaults) { + return settings.save(); + } + + console.log('We\'ll ask you some questions in order to setup your installation of Talk.\n'); + return inquirer.prompt([ { type: 'input', @@ -74,7 +79,7 @@ SettingsService }); }) .then(() => { - console.log('\nTalk is now installed!'); + console.log('Talk is now installed!'); util.shutdown(); }) .catch((err) => { diff --git a/bin/cli-users b/bin/cli-users index ab89626eb..072a143ee 100755 --- a/bin/cli-users +++ b/bin/cli-users @@ -28,18 +28,19 @@ util.onshutdown([ function getUserCreateAnswers(options) { if (options.flag_mode) { + let user = { + email: options.email, + password: options.password, + confirmPassword: options.password, + displayName: options.name, + roles: [] + }; + if (options.role && UserModel.USER_ROLES.indexOf(options.role) > -1) { - - let roles = {}; - roles[options.role] = true; - - return Promise.resolve({ - email: options.email, - password: options.password, - displayName: options.name, - roles - }); + user.roles = [options.role]; } + + return Promise.resolve(user); } return inquirer.prompt([ diff --git a/scripts/pree2e.sh b/scripts/pree2e.sh index 6210c09f0..9ed5b7b89 100755 --- a/scripts/pree2e.sh +++ b/scripts/pree2e.sh @@ -3,8 +3,8 @@ # install selenium selenium-standalone install --config=./selenium.config.js -#Init settings -./bin/cli settings init +# Init application +./bin/cli setup --defaults # Creating Admin Test User ./bin/cli users create --flag_mode --email "admin@test.com" --password "testtest" --name "AdminTestUser" --role "ADMIN"