gruntjscucumberprotractorstubsstub-data-generation

Grunt-stubby and protractor task


I use Grunt in my project with angular and node. For the tests i use cucumber + protractor + grunt-stubby here is my register task from Gruntfile.js

grunt.registerTask('test', [
    'selenium_start',
    'clean:server',    
    'ngconstant:testing',
    'concurrent:test',
    'autoprefixer',
    'connect:test',
    'karma',
    'stubby',
    'protractor',
    'selenium_stop',
  ]);

My problem is when protractor task run, stubbys task is over.


Solution

  • My guess - you need to make use of grunt-protractor-runner and grunt-protractor-webdriver and tell grunt and protractor on which port stubby is listening, for example:

    grunt.initConfig({
        ..
        // Grunt server settings
        connect: {
            stubby: {
                options: {
                    ..
                    port: 8001
                    .. 
                }
            }
        },
        ..
        protractor: {
            ..
            stubby: {
                options: {
                    ..
                    args: {
                         baseUrl: 'http://localhost:8001'
                    }
                    ..
                }
            }
            ..
        }
        ..
    
    });
    ..
    grunt.registerTask('test', [    
        ..,
        'karma',
        'connect:stubby',
        'stubby',
        'protractor:stubby'
    ]);
    ..