These are chat archives for webdriverio/grunt-webdriver

21st
Jul 2016
Dan Jones
@danrhjones
Jul 21 2016 15:55
hi all, new to using grunt, but am trying to get it to run my webdriverio tests
I have a gruntfile that is as follows

`module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
webdriver: {
test: {
configFile: 'wdio.conf.js'
}
}
});

grunt.loadNpmTasks('grunt-webdriver');
// Default task(s).
grunt.registerTask('default', ['webdriver']);
};`

When I run ` grunt``` I get this error message
does markdown not work here or I am rubbish at that too?
andreascc
@andreascc
Jul 21 2016 15:57
``` <---- for markdown
Dan Jones
@danrhjones
Jul 21 2016 15:58
Running "webdriver:test" (webdriver) task
Warning: Cannot read property 'indexOf' of undefined Use --force to continue.

Aborted due to warnings.
I give up!
Josh Cypher
@dcypherthis
Jul 21 2016 15:58
```
newline
andreascc
@andreascc
Jul 21 2016 15:58
you need a line in between
Josh Cypher
@dcypherthis
Jul 21 2016 15:59
module.exports = function(grunt) {
        grunt.initConfig({
                pkg: grunt.file.readJSON('package.json'),
                webdriver: {
                        test: {
                                configFile: 'wdio.conf.js'
                        }
                }
        });

grunt.loadNpmTasks('grunt-webdriver');
// Default task(s).
grunt.registerTask('default', ['webdriver']);
};
thats your code, i just md'd it
Dan Jones
@danrhjones
Jul 21 2016 16:00
thanks
Josh Cypher
@dcypherthis
Jul 21 2016 16:01
so the command would be grunt webdriver:test ?
Dan Jones
@danrhjones
Jul 21 2016 16:01
that throws the same error
Josh Cypher
@dcypherthis
Jul 21 2016 16:01
hmm
let me find my grunt file and post it
after i edit out the secret stuff
hmmm, this seems to be working perfectly for me:

module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        webdriver: {
            test: {
                configFile: './test/config/suite.conf.js'
            },
            testSauce: {
                configFile: './test/config/suite.sauce.conf.js'
            },
            prod: {
                configFile: './test/config/prod.conf.js'
            }
        },
        cucumberjs: {
            src: 'test/features',
            options: {
                steps: 'test/support/stepDefinitions/',
                format: 'pretty'
            }
        }

    });

    grunt.loadNpmTasks('grunt-cucumberjs');
    grunt.loadNpmTasks('grunt-webdriver');
    grunt.registerTask('default', ['cucumberjs']);

};
thats essentially identical
what version of grunt/ grunt webdriver are you using?
also can you post your config file in a gist?
Dan Jones
@danrhjones
Jul 21 2016 16:05
exports.config = {


    specs: [
        './test/specs/**/*.js'
    ],
    exclude: [
        // 'path/to/excluded/files'
    ],
    capabilities: [{
        browserName: 'firefox'
    }],
    logLevel: 'silent',
    coloredLogs: true,
    screenshotPath: './errorShots/',
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    framework: 'mocha',
    reporter: 'dot',
    mochaOpts: {
        ui: 'bdd'
    },
    onPrepare: function() {
        // do something
    },
    before: function() {
        // do something
    },
    after: function(failures, pid) {
        // do something
    },
    onComplete: function() {
        // do something
    }
};
isi the config
I am also using webdriverio@2.4.5 because I am trying to get webdrivercss work, and that needs an old verion of wdio
Josh Cypher
@dcypherthis
Jul 21 2016 16:07
hmm, that does introduce complications
Dan Jones
@danrhjones
Jul 21 2016 16:08
as I suspected
I think I am going to leave it all for a while
there are other things I need to look at, so will come back to this
Josh Cypher
@dcypherthis
Jul 21 2016 16:08
yeah, it might be better to just roll with npm scripts for the time being
Dan Jones
@danrhjones
Jul 21 2016 16:08
hopefully by then webdrivercss will be updated to use the latest version
cool, thanks for your help anyway!
Josh Cypher
@dcypherthis
Jul 21 2016 16:09
welcome, wish i could do more!