grunt-webdriver is a grunt plugin to run selenium tests with the WebdriverIO testrunner
Branch: master
Clone or download
jlchereau and christian-bromann Attempt at fixing issue #91: upgrade to webdriverio v5 (#92)
Hello @christian-bromann,

This is a proposal to fix #91. I have also upgraded all packages including migration to Babel v7. The resulting grunt-webdriver runs my project tests without issue.

Neverthess, the grunt plugin tests (See ./test/webdriver.js') do not work. Considering I do not run OSX, I can't trigger tests in your Travis-CI environment and there are still pending issues with v5 that I have reported (incl. #3196, #3198, #3203), there is not much more that I can do except reporting the logs (Window 10). You might want to check 1bbb5a2.

Also you need to bump version as you see fit.

```
C:\grunt-webdriver>grunt webdriver --debug
Running "webdriver:testTargetConfigFile" (webdriver) task
[D] Task source: tasks\webdriver.js
2018-12-29T12:56:28.898Z DEBUG wdio-config: wdio-sync found, running tests synchronous
 RUNNING  0-0 in firefox - \test\webdriver.js

Test Suites:     0 passed, 1 total (0% completed)
Time:            �  5.14s
[0-0] 2018-12-29T12:56:31.686Z INFO webdriver: COMMAND navigateTo("http://webdriver.io/")
[0-0] 2018-12-29T12:56:31.687Z INFO webdriver: [POST] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101/url
[0-0] 2018-12-29T12:56:31.687Z INFO webdriver: DATA { url: 'http://webdriver.io/' }
[0-0] 2018-12-29T12:56:33.550Z INFO webdriver: COMMAND getTitle()
[0-0] 2018-12-29T12:56:33.550Z INFO webdriver: [GET] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101/title
[0-0] 2018-12-29T12:56:33.558Z INFO webdriver: RESULT WebdriverIO · Next-gen WebDriver test framework for Node.js
[0-0] 2018-12-29T12:56:33.561Z INFO webdriver: COMMAND deleteSession()
[0-0] 2018-12-29T12:56:33.561Z INFO webdriver: [DELETE] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101
2018-12-29T12:56:34.126Z DEBUG wdio-local-runner: Runner 0-0 finished with exit code 1

Test Suites:     0 passed, 1 failed, 1 total (100% completed)
Time:            �  5.23s

"dot" Reporter:
F.

Stdout:
[D] spawn wdio with these attributes:
{
  "logLevel": "trace",
  "waitforTimeout": 12345,
  "framework": "mocha",
  "coloredLogs": true,
  "configFile": "./test/wdio.conf.js",
  "foo": "bar"
}
2018-12-29T12:56:28.969Z INFO wdio-cli:Launcher: Run onPrepare hook
2018-12-29T12:56:28.971Z INFO wdio-local-runner: Start worker 0-0 with arg: webdriver,--debug
[0-0] 2018-12-29T12:56:29.127Z DEBUG wdio-config: wdio-sync found, running tests synchronous
[0-0] 2018-12-29T12:56:29.309Z INFO wdio-local-runner: Run worker command: run

"dot" Reporter:
F.

Stdout:
[D] spawn wdio with these attributes:
{
  "logLevel": "trace",
  "waitforTimeout": 12345,
  "framework": "mocha",
  "coloredLogs": true,
  "configFile": "./test/wdio.conf.js",
  "foo": "bar"
}
2018-12-29T12:56:28.969Z INFO wdio-cli:Launcher: Run onPrepare hook
2018-12-29T12:56:28.971Z INFO wdio-local-runner: Start worker 0-0 with arg: webdriver,--debug
[0-0] 2018-12-29T12:56:29.127Z DEBUG wdio-config: wdio-sync found, running tests synchronous
[0-0] 2018-12-29T12:56:29.309Z INFO wdio-local-runner: Run worker command: run
[0-0] 2018-12-29T12:56:29.320Z DEBUG wdio-local-runner:utils: init remote session
[0-0] 2018-12-29T12:56:29.351Z INFO webdriver: [POST] http://127.0.0.1:4445/wd/hub/session
[0-0] 2018-12-29T12:56:29.351Z INFO webdriver: DATA { capabilities:
   { alwaysMatch: { browserName: 'firefox' }, firstMatch: [ {} ] },
  desiredCapabilities: { browserName: 'firefox' } }
[0-0] 2018-12-29T12:56:31.686Z INFO webdriver: COMMAND navigateTo("http://webdriver.io/")
[0-0] 2018-12-29T12:56:31.687Z INFO webdriver: [POST] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101/url
[0-0] 2018-12-29T12:56:31.687Z INFO webdriver: DATA { url: 'http://webdriver.io/' }
[0-0] 2018-12-29T12:56:33.550Z INFO webdriver: COMMAND getTitle()
[0-0] 2018-12-29T12:56:33.550Z INFO webdriver: [GET] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101/title
[0-0] 2018-12-29T12:56:33.558Z INFO webdriver: RESULT WebdriverIO · Next-gen WebDriver test framework for Node.js
[0-0] 2018-12-29T12:56:33.561Z INFO webdriver: COMMAND deleteSession()
[0-0] 2018-12-29T12:56:33.561Z INFO webdriver: [DELETE] http://127.0.0.1:4445/wd/hub/session/9e8c549d-dabc-4fe4-8cd1-d681406ff101
2018-12-29T12:56:34.126Z DEBUG wdio-local-runner: Runner 0-0 finished with exit code 1

Test Suites:     0 passed, 1 failed, 1 total (100% completed)
Time:            �  5.43s

[D] wdio testrunner finished with exit code 1
Warning: Task "webdriver:testTargetConfigFile" failed. Use --force to continue.
```
Latest commit 8a11283 Dec 30, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018
test Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018
.babelrc Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018
.editorconfig updated package to use webdriverio v4 May 6, 2016
.eslintignore updated package to use webdriverio v4 May 6, 2016
.eslintrc ESLint pass Dec 9, 2016
.gitignore move compiled files to tasks directory May 11, 2016
.npmignore move compiled files to tasks directory May 11, 2016
.travis.yml Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018
CHANGELOG.md updated changelog Dec 9, 2016
Gruntfile.js Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018
LICENSE-MIT first commit, generated boilerplate code with grunt-init Mar 13, 2013
README.md Update dependency description in README Dec 9, 2016
package-lock.json
package.json Attempt at fixing issue #91: upgrade to webdriverio v5 (#92) Dec 30, 2018

README.md

grunt-webdriver Code Climate Build Status Join the chat at https://gitter.im/webdriverio/grunt-webdriver

grunt-webdriver is a grunt plugin to run selenium tests with the WebdriverIO testrunner

Getting Started

This plugin requires Grunt ~1.0.1

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install --save-dev grunt-webdriver

Once the plugin has been installed, it may be enabled inside your gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-webdriver');

The "webdriver" task

Overview

In your project's Gruntfile, add a section named webdriver to the data object passed into grunt.initConfig(). Your test should contain a configFile property with a path to your wdio config. You can pass in additional options as cli arguments.

Run this task with the grunt webdriver command.

grunt.initConfig({
  webdriver: {
    test: {
        configFile: './test/wdio.conf.js'
    }
  },
  // ...
})

The plugin is an easy helper to run WebdriverIO tests using the wdio test runner. You can find more information about the test runner on our docs page.

Example using Sauce Labs

To use a cloud service like Sauce Labs make sure you define user and key properties like in the example below to authenticate yourself with your username and access key.

grunt.initConfig({
  webdriver: {
    options: {
        user: SAUCE_USERNAME,
        key: SAUCE_ACCESS_KEY
    },
    test: {
        configFile: './test/wdio.conf.js'
    }
  },
  // ...
})

Options

All options get passed into to the wdio testrunner. You should define your main configurations within your wdio config file. The plugin allows you to easy overwrite them. You can find all available cli arguments here: http://webdriver.io/guide/testrunner/gettingstarted.html

Contributing

Please fork, add specs, and send pull requests! In lieu of a formal styleguide, take care to maintain the existing coding style.