【问题标题】:Sending specs in grunt using grunt-protractor-runner使用 grunt-protractor-runner 在 grunt 中发送规格
【发布时间】:2014-03-02 23:18:04
【问题描述】:

我正在使用 grunt-protractor-runner 插件,并且在量角器目标中我想发送包含要运行的测试的规范参数。 在 grunt 文件中,我的目标如下所示:

testIntegration: 
{
  options: 
  {
    args: {
      specs: ['test1.js'],
      browser: 'firefox'
  } 
}

量角器父任务选项包含量角器配置文件的设置。

运行此目标时,我收到此错误: $ grunt量角器:testIntegration 运行“量角器:testIntegration”(量角器)任务 正在启动 selenium 独立服务器... Selenium 独立服务器开始于... 警告:模式 t 不匹配任何文件。 警告:模式 e 不匹配任何文件。 警告:模式 s 不匹配任何文件。 警告:模式 t 不匹配任何文件。 警告:模式 1 不匹配任何文件。 警告:模式 j 不匹配任何文件。 警告:模式 s 不匹配任何文件。

然后还有一些错误。 同一行在量角器配置文件中效果很好。 尝试了其他一些变体,但没有成功。

我错过了什么?有什么想法吗?

【问题讨论】:

    标签: gruntjs protractor specs runner


    【解决方案1】:

    试试这个配置:

    module.exports = function(grunt) {
    
      // Project configuration
      grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
      protractor: {
        options: {
          keepAlive: true,
          singleRun: false,
          configFile: "PROTRACTOR_CONFIG_FILE.js"
        },
        run_firefox: {
          options: {
            args: {
              browser: "firefox"
            }
          }
        }
      });
    
      // load grunt-protractor-runner
      grunt.loadNpmTasks('grunt-protractor-runner');
    
      // register tasks
      grunt.registerTask('default', 'Run Protractor using Firefox',
        ['protractor:run_firefox']);
    };
    

    有趣的是,如果您阅读每条错误消息,它都会拼出“test1.js”。看起来它没有正确读取配置文件,可能是因为您没有使用 grunt.file.readJSON('FILENAME.json')

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-11
      • 2014-04-15
      • 2016-06-17
      • 2018-04-30
      • 2013-10-04
      • 1970-01-01
      相关资源
      最近更新 更多