0
votes

I am using protractor for running e2e tests. I have a base config file and two other config files that override some options in the base config file. I want to be able to specify different configurations in the angular-cli.json for running e2e tests. As I can see it now, you can only specify one config file for e2e in angular-cli:

"e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  }

How can you have multiple configurations defined that use different config files?

2

2 Answers

0
votes

You can either have several config files and run them from CLI, like: ./node_modules/protractor/bin/protractor ./config/localhost.js, ./node_modules/protractor/bin/protractor ./config/preprod.js and so on.

or

you can override options, like baseUrl:

./node_modules/protractor/bin/protractor ./config/localhost.js --baseUrl='http://google.com'

0
votes

You can extend the original config as below (this is one I use to target scenarios with a "@dev" tag that are currently under development):

import { config as cfg } from './config';

export const config = cfg;
config.cucumberOpts.tags = '@dev';

...then run protractor using the config you want:

protractor {path}/config.dev.js