Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Allow for custom configuration in the test #32

Closed
juliemr opened this issue Jul 19, 2013 · 11 comments
Closed

Allow for custom configuration in the test #32

juliemr opened this issue Jul 19, 2013 · 11 comments
Assignees
Milestone

Comments

@juliemr
Copy link
Member

juliemr commented Jul 19, 2013

Folks may want to introduce most custom configuration via the command line than just the baseUrl. Should allow for this.

@juliemr
Copy link
Member Author

juliemr commented Jul 19, 2013

e.g. username / password for login

@jgrund
Copy link

jgrund commented Sep 10, 2013

👍

@juliemr
Copy link
Member Author

juliemr commented Sep 12, 2013

Here's my proposal for this: protractor should export its configuration object as protractor.config. A 'params' section will be added, and made modifiable by command line. So the config file

exports.config = {
  params: {
    username: 'julie',
    password: '1234'
  },
  // ... whatever else you need
}

and then the command line
protractor --params username=fred --params additional=foo

Would result in your tests having access to:

protractor.config; // equals {username: 'fred', password: '1234', additional: 'foo'}

Does this meet everyone's needs?

@ghost ghost assigned juliemr Sep 12, 2013
@dgurjar22
Copy link

👍

@andresdominguez
Copy link
Contributor

Would you allow the config params to have a deep structure? For example, would you be able to modify this?

exports.config = {
  params: {
    login: {
      user: 'julie',
      password: '1234'
    }
  }
}

Would you be able to change this?

protractor --params login.user=fred

@zakrhol
Copy link

zakrhol commented Aug 12, 2014

protractor.config; // equals {username: 'fred', password: '1234', additional: 'foo'}

config is always undefined with protractor version 1.0.0.
According to the changeset (Commit) it must be
protractor.getInstance().params.username

@stevenmanton
Copy link

or just browser.params.password works for me

@nvega-ms
Copy link

nvega-ms commented Sep 3, 2015

Can I remove a parameter byu command line?

@orgimeno
Copy link

Hi, i have two questions.

// conf.js
exports.config = {
    framework: 'jasmine',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: [],
    multiCapabilities: [{
        'browserName': 'chrome',
        'specs': ['protractor-spec.js'],
        'count': 5, //number of instances
        'shardTestFiles': true, //execute instances of browser simultaneously
    },
    ],
    params: {
        answers: {
            max:10,
            min:1,
        }
    },
}
  • I have this configuration and i want change count value in multiCapabilities via command line. its that possible?
  • Can i run different instances of webDriver i the same browser but different tabs?

@felippenardi
Copy link

Just for the records, the way to do it is:

protractor --params.login.user 'Joe' --params.login.password 'abc'

As in 02cb819

@djom202
Copy link

djom202 commented Jun 2, 2017

Can I use it for pass to config.js file the tags that I would like run?. For example:

protractor --params.tags '@issues, @results, ~@todo'

In my config.js file:

exports.config = {
    framework: 'jasmine',
    specs: [],
    multiCapabilities: [{
        'browserName': 'chrome',
        'specs': ['features/*.feature'],
        'shardTestFiles': true, //execute instances of browser simultaneously
    }],
    cucumberOpts: {
        require: ['step_definitions/**/*_steps.js'],
        format: 'pretty',
        tags: config.tags,
        keepAlive: false
    },
    params: {
        tags: "@complete"
    },
}

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

No branches or pull requests

10 participants