如何在cucumber.conf.js文件中设置动态URL?

时间:2017-07-27 09:10:50

标签: javascript angular typescript protractor cucumber

我配置了黄瓜配置文件。我已经定义了baseURL。但现在我想在运行时设置动态URL。如何设置动态网址?

例如,现在基本URL指向我的localhost。稍后,在测试或生产环境中,IP地址将更改为其他服务器。如何设置动态URL?

//cucumber.conf.js
exports.config = {
  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),
  //seleniumAddress: 'http://localhost:4444/wd/hub',
  directConnect: true,
  specs: ['test/e2e/cucumber/sample.feature'],
  capabilities: {
    'browserName': 'chrome',
    chromeOptions: {
      args: [
        //"--headless",
        "--disable-gpu",
        '--disable-extensions',
        '--no-sandbox',
        '--disable-web-security'
      ],
    },

  },
  baseUrl: 'http://localhost:8080/dashboard/#/',
  useAllAngular2AppRoots: true,


  // cucumber command line options
  cucumberOpts: {
    require: ['test/e2e/cucumber/menu.steps.js'],
    tags: [],
    strict: true,
    format: ["pretty"],
    dryRun: false,
    compiler: []
  },

  onPrepare: function() {
    browser.manage().window().maximize();
  },

  resultJsonOutputFile: './test/e2e/results.json'
}

0 个答案:

没有答案