1

I am using grunt-protractor-runner plugin and in the protractor target I want to send the specs param containing the test to run. In the grunt file my target looks as follows:

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

The protractor parent task option contains setting of the protractor config file.

When running this target I get this error: $ grunt protractor:testIntegration Running "protractor:testIntegration" (protractor) task Starting selenium standalone server... Selenium standalone server started at ... Warning: pattern t did not match any files. Warning: pattern e did not match any files. Warning: pattern s did not match any files. Warning: pattern t did not match any files. Warning: pattern 1 did not match any files. Warning: pattern j did not match any files. Warning: pattern s did not match any files.

and then some more errors. the same line works well in Protractor config file. Tried a few other variation but no success.

What am I missing? Any ideas?

EricSchaefer
  • 25,272
  • 21
  • 67
  • 103

1 Answers1

2

Try this configuration:

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']);
};

Funny, if you read every error message, it spells out "test1.js". Looks like it's not reading in the config file correctly, probably because you're not using grunt.file.readJSON('FILENAME.json')

Apollo Clark
  • 806
  • 9
  • 16