Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to run protractor with args #414

Closed
Olgagr opened this issue Mar 9, 2015 · 5 comments
Closed

Make it possible to run protractor with args #414

Olgagr opened this issue Mar 9, 2015 · 5 comments

Comments

@Olgagr
Copy link

Olgagr commented Mar 9, 2015

It will be great to make it possible to run protractor with args. For example it could be possible to run only one suite:

gulp protractor --suite signIn

or choose the browser:

gulp protractor --browser firefox
@zckrs
Copy link
Collaborator

zckrs commented Mar 23, 2015

I am not sure this issue is related to generator.
Maybe the plugin gulp-protractor should parse the cmd line.

/cc @mllrsohn

@Olgagr alternatively you can use node_modules/.bin/protractor protractor.conf.js --browser firefox with a gulp serve running in another terminal

@pdf13
Copy link

pdf13 commented Apr 24, 2015

I had the same problem and solve then modifying gulp/e2e-tests.js to make function runProtractor() looks like this:

function runProtractor (done) {
    var params = process.argv;
    var args = params.length > 3 ? [params[3], params[4]] : [];

    gulp.src(options.e2e + '/**/*.js')
      .pipe($.protractor.protractor({
        configFile: 'protractor.conf.js',
        args: args
      }))
    // (...)
  }

This is not error proof, but allows me to make calls to gulp protractor, gulp protractor --suite suiteName, gulp protractor:src --someArg someValue. I hope it can help.

@zckrs
Copy link
Collaborator

zckrs commented Apr 24, 2015

Nice 👍
PR appreciate or wait I take time to implement it

@zckrs zckrs closed this as completed in d0c178b May 27, 2015
Swiip added a commit that referenced this issue May 27, 2015
@bondarewicz
Copy link

bondarewicz commented Jun 21, 2016

just ran into following issue when running protractor with args using teamcity gulp runner...

Usage: protractor [configFile] [options]
configFile defaults to protractor.conf.js
The [options] object will override values from the config file.

Error: more than one config file specified

/.../e2e-tests.js:44

throw in

.on('error', function (err) {
   // Make sure failed tests cause gulp to exit non-zero
   throw err;
})

I guess we should only be interested in args with --, teamcity additionally adds it's own args:

--no-color --teamcity.properties.all --teamcity.properties

hence replaced:

var args = params.length > 3 ? [params[3], params[4]] : [];

with

var args = [];
  for (var i = 0; i < params.length; i++) {
    if(params[i].substring(0, 2) == '--') args.push(params[i]);
  }

to make sure all args are passed through protractor
/cc @zckrs @pdf13

@furnace915
Copy link

var args = process.argv.slice(3) also works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants