如何在Gruntfile中添加量角器选项

时间:2015-09-15 21:13:41

标签: selenium grep gruntjs protractor

我可以使用参数运行一个量角器测试用例:

protractor: {
  options: {
    keepAlive: false,
    configFile: "./config/protractorConf.js"
  },
  e2eTest: {
    options: {
      args: {
        specs: ['tests/e2e/login.js'],
        grep: "SingleLoginTest"
      }
    }
  }
}

我在Gruntfile中有一个量角器任务:

{{1}}

当我尝试使用grunt运行它时,它会运行所有登录测试用例。

如何在grunt中添加量角器选项?

1 个答案:

答案 0 :(得分:1)

它适用于我的套房:

在conf文件中:

suites: {
    login: 'tests/e2e/login.js',
},

在gruntfile中:

e2eTest: {
    options: {
      args: {
        suite: "login"
      }
    }
  }

顺便说一下,我使用grunt-protractor-runner我相信它也传递了论据,所以grunt e2eTest --specs='tests/e2e/login.js'也应该有效。

相关问题