Git Product home page Git Product logo

gulp-webdriver's People

Contributors

aliokan avatar christian-bromann avatar dependabot[bot] avatar is2ei avatar jimschubert avatar jonn-set avatar m-a-r-c-e-l-i-n-o avatar michaelbenin avatar risto-stevcev avatar silvenon avatar ttk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gulp-webdriver's Issues

Gulp or Grunt ?

The title says gulp-webdriver but the README file says it needs to install Grunt ?

Still cannot use pageObject to reference click();

as of wdio v.4.0.7, you can write code like this:

it('A user searches for "qa testing" and submits', function () {
  Home.searchBar.click();
  Home.searchBar.keys('qa testing');
  Home.searchButton.click();
});

i've updated the gulp-webdriver package to install v.4.0.7 for itself, rather than 4.0.5, yet i still get the same error as wdio < 4.0.5

selector needs to be typeof `string`

i would think this is a very easy fix, let me know if there is anything i can do or if you think i've missed something.

thanks!

Explain use of browser global in README

I don't know if I'm just missing something but I couldn't see anywhere that tells you that the browser object is available inside the mocha tests. Found it in an external blog post instead!

'output' option doesn't work

The readme mentions a 'output' options for piping reporter output.
Doesn't look like it works and there's no reference to options.output in the source.
(looks like the text for 'output' was copied straight from grunt-webdriver too)

When tests fail gulp execution breaks

Errors in gulp-webdriver should be handled more gracefully and report what those errors are instead of throwing an error into console:

[15:15:53] Error in plugin 'gulp-webdriver'
Message:
    wdio exited with code 1

Can't run gulp-webdriver plugin for chrome extensions testing

So, currently extensions are injected into Webdriver as base64 strings from browser capabilities.
1.0.0 had been rewritten as a simple wdio process spawning, and this causes E2BIG error - there is no way such long args (200Kb+) can be passed to child process.

Maybe it's better just to create a temporary config file for wdio, with all extensions as base64 strings in it, instead of passing opts as command line args ?

1/2 of tests failing unexpectedly because of Uncaught RuntimeError

Every time I run my tests the first half run correctly while the second half all fail with the same error:

     Uncaught RuntimeError
     (UnknownError:13) An unknown server-side error occurred while processing the command.
     Problem: POST /session//url
Build info: version: '2.46.0', revision: '87c69e2', time: '2015-06-04 16:16:47'
System info: host: 'eruditorum.att.net', ip: '192.168.1.222', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.4', java.version: '1.8.0_51'
Driver info: driver.version: unknown

Looking around online I found a few people having similar issues but no fixes for running the tests through gulp. Any advice here or am I fucking something up?

Running tests is not dependent on key --suite

From @demshin on February 14, 2017 11:27

The problem

I'm runing tests with wdio (also cucumber) with key --suite nameOfSuite, but all tests run.

Environment

  • WebdriverIO version: 4.6.2
  • Node.js version: 6.9.5
  • I run test via gulp gulp test:remote --maxinstances 10 --suite nameOfSuite
  • it's running on remote grid
  • I'm using allure report

Details

there is part of my wdio.conf.js:
`exports.config = {

host: argv.seleniumhost || '10.241.5.140',
port: 4444,
path: '/wd/hub',

specs: [
    './features/**/*.feature'
],
suites: {

    regression: [
        './features/nsi/kpgz-spgz/*.feature',
        './features/bktz/libcontract/*.feature',
        './features/nsi/participant/*.feature',
        './features/nsi/reference/*.feature',
        './features/normalization/*.feature',
        './features/comission/*.feature'
    ],
    scrum: [
        './features/scrum/**/*.feature'
    ],
    nsi: [
        './features/nsi/kpgz-spgz/*.feature',
        './features/nsi/participant/*.feature',
        './features/nsi/reference/*.feature'
    ],
    bktz: [
        './features/bktz/libcontract/*.feature',
        './features/bktz/criteria/*.feature'
    ],
    normalization: [
        './features/normalization/*.feature'
    ],
    comission: [
        './features/comission/*.feature'
    ]

}`

If you need more information I will provide.

Copied from original issue: webdriverio/webdriverio#1872

Error: spawn .\node_modules\webdriverio\bin\wdio ENOENT

Just tried to use gulp-webdriver following these reproduction steps (in an empty folder):

npm install gulp gulp-webdriver webdriver --save-dev
node_modules\.bin\wdio config

I confirmed all wdio questions with default values:

=========================
WDIO Configuration Helper
=========================

? Where do you want to execute your tests? On my local machine
? Which framework do you want to use? mocha
? Where are your test specs located? ./test/specs/**/*.js
? Which reporter do you want to use? (see http://webdriver.io/guide/testrunner/reporters.html) dot
? Level of logging verbosity: silent
? In which directory should screenshots gets saved if a command fails? ./errorShots/
? What is the base url? http://localhost

Configuration file was created successfully!
To run your tests, execute:

        $ wdio wdio.conf.js

Then I create the gulpfile.js as simple as possible:

var gulp = require('gulp'),
    webdriver = require('gulp-webdriver');

gulp.task('test:e2e', function() {
    return gulp.src('wdio.conf.js').pipe(webdriver());
});

This is what I finally got when trying to run it:

c:\Temp\e2e>gulp test:e2e
[14:45:18] Using gulpfile c:\Temp\e2e\gulpfile.js
[14:45:18] Starting 'test:e2e'...
[14:45:18] spawn wdio with these attributes:
 c:\Temp\e2e\wdio.conf.js
--logLevel=verbose
--waitforTimeout=10000
--reporter=spec
events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: spawn c:\Temp\e2e\node_modules\webdriverio\bin\wdio ENOENT
    at exports._errnoException (util.js:746:11)
    at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
    at child_process.js:1144:20
    at process._tickCallback (node.js:355:11)

Environment: Win7x64, NodeJs v0.12.7

Latest version no longer recognises mocha 'describe' syntax.

homepageFeature.js

var expect = require('chai').expect;

describe('Feature: Homepage', function() {

  before(function(done) {
    browser
      .url('http://localhost:3000')
      .call(done)
  });

  it('has a title', function(done) {
    browser
      .getTitle(function(err, title) {
        expect(err).to.not.be.true
        expect(title).to.eql('Welcome to the Homepage');
      })
      .call(done)
  });

});

gulpfile.js

var gulp = require('gulp');
var webdriver = require('gulp-webdriver');

var server = gls.new('./app/server.js');

gulp.task('test-features', function() {
  return gulp.src('test/features/*.js')
  .pipe(webdriver({
    framework: 'mocha',
    desiredCapabilities: {
      browserName: 'chrome'
    }
  }))
  .once('end', function() {
    server.stop();
  });
});

Works in v0.1.1 but not in v1.0.1.

ReferenceError: describe is not defined

require('gulp-webdriver') fails

I installed the plugin using npm install gulp-webdriver --save-dev, and then when I try to use it in my code, I get:

    module.js:338
    throw err;
          ^
Error: Cannot find module 'gulp-webdriver'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Projects\test\selenium\testBrowser.js:4:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17) 

Looking in node_modules\gulp-webdriver folder, apparently index.js is not present.

Looking at package.json, the property "main": "Gruntfile.js" apparently is incorrect.
Shouldn't it be index.js?

Cannot configure browsers

gulp.task('test:e2e', function() {
    return gulp.src('wdio.conf.js').pipe(webdriver({
        capabilities: [{
            browserName: 'firefox'
        }],
        logLevel: 'verbose',
        waitforTimeout: 10000,
        reporter: 'spec'
    }));
});

When running the task "capabilities" is not applied instead config in wdio.conf.js is used.

webdrive cannot cope with spaces in the path

I am trying to use the gulp-webdriver in a path that sits under C:\program files\ I am getting an error saying that 'C:\Program' is not recognized as an internal or external command. When I move it to a location that has no spaces in the path it runs ok.

Unfortunately where I want to run it on the server has to have spaces in so is there a way of running this in a path with spaces?

Plugin does not successfully exit gulp task

The problem

Running gulp e2e task does not successfully end task once finished running my test suite.

I'm assuming that it's me, and not you, but I've stripped out everything that I can and it's still not completing the task. I have to manually kill Gulp in the command line.

Environment

  • Mac OSX 10.12.3
  • WebdriverIO version: 4.6.2
  • Node.js version: 6.7.0

Details

I've created a temporary stripped-down repository that can run a basic tests:

https://github.com/shamrt/wdio-issue

Thanks so much for your help!

v2 (gulp-webdriver with WebdriverIO v4)

some requirements:

  • bump WebdriverIO version to latest
  • add Babel to enable ES2016 compatible syntax (see wdio-mocha-framework as example)
  • add Grunt for task management (Gulp is fine too but it is easier to just copy from existing project structures like that one above)
  • instead of launching wdio as process, require the webdriverio launcher package and run wdio manually
  • adapt integration tests (have at minimum a simple test run using the mocha or jasmine framework)
  • integrate codeclimate (should be done by one of the maintainers)
  • if website isn't updated add disclaimer with information how to use

Finish on error

The task doesn't finish when tests fail, so gulp just waits forever.

import webdriver from 'gulp-webdriver';

gulp.src('webdriver', () => {
  return gulp.src('wdio.conf.js')
    .pipe(webdriver());
});

Task execution stuck on "start selenium standalone server"

tl;dr gulp task is stuck on "start selenium standalone server" step, I'm asking for help. I blame the corporate proxy settings but am not sure about anything.


I use pretty much the code from the README example in my gulpfile:

// gulpfile.js
var gulp = require('gulp')
  , webdriver = require('gulp-webdriver');

gulp.task('test', function() {
  return gulp.src('*/*.spec.js', { read: false })
             .pipe(webdriver({
                  desiredCapabilities: { browserName: 'chrome' },
                  proxy: {
                      httpProxy: // my companies proxy here
                      sslProxy:   // same here
                  }
             });
});

As dependencies i have installed

// package.json, devDependencies section
"gulp": "^3.9.0",
"gulp-webdriver": "^0.1.1",
"mocha": "^2.2.5",
"webdriverio": "^3.1.0"

When I run gulp test, it gets stuck on the start selenium standalone server step:

[08:57:00] {{ my workspace here }}\gulpfile.js
[08:57:00] Starting 'test'...
[08:57:00] run webdriverio with following capabilities: {"desiredCapabilities":{"browserName":"chrome"},"proxy":{"httpPr
oxy":"{{ my companies proxy here }}","sslProxy":"{{ and here }}"}}
[08:57:00] checking if selenium is running
[08:57:01] selenium is not running
[08:57:01] installing driver if needed
[08:57:02] driver installed
[08:57:02] start selenium standalone server

I'm on a windows (:disappointed:) 8.1. 64bit machine with node -v v0.12.7 and npm -v 2.11.3.

I'd expect the task to start the selenium server and run my specs. What am I missing?

Help required with Appium example

Hello @christian-bromann ,
Sorry for the trouble but I was just looking for starting and stopping appium as a child process and came across this example.

Here selenium server is started before the test as a child process and once the test is done, the child process is killed.

Could you please help me to do the same for appium.cmd where I can utilize the wdio.conf.js file and mocha?

I was trying to create a gulp task using gulp-run and was able to start the appium server using appium.cmd.

gulp.task('startApp', function() {
  return run(path.join('node_modules', '.bin', 'appium.cmd')).exec()
    .pipe(gulp.dest('appiumo.log')) ;
})

But wanted to start it as child process which can be killed later and it should be async(may be).

Unhandled 'error' event when assertion fails

When assertion fails an error appears in command line

events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: wdio exited with code 1

Plumber says that error is in gulp-webdriver plugin

Plumber found unhandled error:
 Error in plugin 'gulp-webdriver'
Message:
    wdio exited with code 1

My gulpfile

gulp.task('webio', function() {
    gulp.src('wdio.conf.js')
        //.pipe(plumber())
        .pipe(webdriver());
});

Test script

var chai = require('chai'),
    assert = chai.assert;

describe('tests', function () {
    it('fail', function () {
        assert.equal(1, 0);
    });

    it('success', function () {
        assert.equal(1,1);
    });
});

Everything seems to be working except the error at the end.
This error appears since version 2.0.1.
Is it a normal behaviour or I am doing something wrong?
I am using [email protected] and [email protected]
Thanks!

`gulp.src('wdio.conf.js').pipe(webdriver({...}))` does nothing

I can't get gulp-webdriver to use my wdio.conf.js, as described in the README of this repository. I've been debugging this for a while, but I'm pretty stumped...

My task:

gulp.src('wdio.conf.js').pipe(webdriver({}))

It ignores my entire wdio.conf.js, which includes the paths to run, and says to run the tests in chrome. Here are the options selenium runs with from the gulp task:

{"desiredCapabilities":{"browserName":"firefox","version":"","javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"platform":"ANY","requestOrigins":{"url":"http://webdriver.io","version":"2.4.5","name":"webdriverio"}}}

Since it doesn't have the paths defined in wdio.conf.js, it thinks there are 0 tests, and exits immediately.

I can run the tests from the cli with plain wdio just fine:

$ wdio wdio.conf.js

SIGINT handler is not killing process

From @artur-michalak on January 4, 2017 12:5

The problem

When i setup webdriver.io with gulp watch and interrupt process with ctrl+c it's not closing.

Environment

  • WebdriverIO version: v4.5.2

  • Node.js version: v4.4.5 (v6 too)

  • Standalone mode or wdio testrunner: jasmine testrunner

  • if wdio testrunner, running synchronous or asynchronous tests: asynchronous

  • Additional wdio packages used (if applicable):

    "wdio-dot-reporter": "0.0.6",
    "wdio-jasmine-framework": "^0.2.19",
    "wdio-selenium-standalone-service": "0.0.7",
    "gulp-webdriver": "^2.0.3",

Link to Selenium/WebdriverIO logs

[12:56:45] Finished 'e2e:run' after 16 s
[12:56:45] Finished 'e2e:dev' after 17 s
then on cmd + c click:

End selenium sessions properly ...
(press crtl+c again to hard kill the runner)

Killing process, bye! (on cmd + c click)
Killing process, bye! (on cmd + c click)
Killing process, bye! (on cmd + c click)
Killing process, bye! (on cmd + c click)

Code To Reproduce Issue [ Good To Have ]

  1. Setup gulp
    gulp.task('e2e:run', function () {
    return gulp.src(config.e2e.config).pipe(webdriver({
    baseUrl: 'http://localhost:' + config.e2e.port,
    specs: config.e2e.specs
    })).on('error', handleErrors);
    });

// production release of player
gulp.task('e2e:dev', function() {
gulp.watch(config.e2e.specs, ['e2e:run']);
});

  1. Run e2e:run task. Everything works like a charm
  2. Run e2e:dev which is watching files
  3. Interrupt (ctrl + c/cmd+c) twice
  4. Gulp process is not killed

Details

I would guess something is wrong with logic here
https://github.com/webdriverio/webdriverio/blob/68974ac33aa13fa099b1870d5a81ce5c6d8341db/lib/launcher.js#L418
Perhaps process.exit is not being called.

Copied from original issue: webdriverio/webdriverio#1798

Can not run gulp-webdriver twise

I am not sure that it is a problem of gulp-webdriver.

I have the following task in my gulpfile.babel.js:

gulp.task('watch', () => gulp.watch('specs/**/*.test.js', (event) => {
  if (event.type === 'added' || event.type === 'changed') {
    gulp.src('wdio.conf.js')
      .pipe(webdriver({ specs: [event.path] }));
  }
}));

When I run gulp watch and touch specs/a.test.js it works OK and very simply test passed.

But when I run touch specs/a.test.js again webdriver always hangs on the following:

[15:06:07]  COMMAND POST     "/wd/hub/session"
[15:06:07]  DATA        {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"browserName":"chrome","loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.0.5","name":"webdriverio"}}}

Error when starting session in chrome browser

I've got this error, when i tried to start a test session in the local chrome browser.

[10:04:37] Starting 'test-e2e:local'...

ERROR: session not created exception from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"6208.1","isDefault":true},"id":1,"name":"","origin":"://"}
chrome
Error: session not created exception from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"6208.1","isDefault":true},"id":1,"name":"","origin":"://"}

[10:04:47] 'test-e2e:local' errored after 9.56 s
[10:04:47] Error in plugin 'gulp-webdriver'
Message: wdio exited with code 1

The gulp task:
gulp.task('test-e2e:local', function() { return gulp.src('./wdio.local.conf.js').pipe(webdriver()); });

Capabilities in the wdio.local.conf.js are only:
capabilities: [{ browserName: 'chrome' }]

I used the latest gulp-webdriver version 2.0.2. Testing on Windows 10.
The same when i tried to start a session in Firefox.

Has anyone a solution?

Jasmine support

Is there anything that would cause this not to be able to support Jasmine at some point down the road?

Cannot call before/after hook in additional arguments

I run something like this:

gulp.task('test', function (cb) {
    return gulp.src('wdio.conf.js').pipe(webdriver({
        onComplete: function () {
            console.log('`onComplete` call')
        },
        before: function () {
            console.log('`before` hook');
        },
        after: function (){
            console.log('`after` hook')
        }
    }));
})

but "before" and "after" hooks not calling. If it was defined in wdio.conf.js, then hooks call successfully.

I am using [email protected] and [email protected]

Issue with installing gulp-webdriver

I have issue installing gulp-webdriver.
After some debugging, it seems that this occurs during the installation of dargs dependencies.

Could the developers please take a look? Thanks.

Command:
npm install gulp-webdriver --save-dev
Error:

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:213:12)
npm WARN addRemoteGit     at emitTwo (events.js:87:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:172:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:818:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:319:11)
npm WARN addRemoteGit     at emitOne (events.js:77:13)
npm WARN addRemoteGit     at Socket.emit (events.js:169:7)
npm WARN addRemoteGit     at Pipe._onclose (net.js:469:12)
npm WARN addRemoteGit  christian-bromann/dargs resetting remote C:\...\AppData\Roaming\npm-cache\_git-remotes\
git-github-com-christian-bromann-dargs-git-d1658d6c because of error: { [Error: Command failed: git -c core.longpaths=true co
nfig --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }

Missing wdio.cmd on Windows

The line:

wdioBin = require.resolve(path.join('webdriverio', 'bin', isWin ? 'wdio.cmd' : 'wdio'))

Fails because I'm missing node_modules\webdriverio\bin\wdio.cmd after doing a fresh install. The only file in bin is wdio but this won't run on Windows.

I suspect the issue is due to the change in d7aca92 because node_modules/.bin/wdio.cmd does actually exist.

The weird thing is version 1.0.1 doesn't seem to work either now, I get the error message Haven't found the WebdriverIO test runner even though node_modules/.bin/wdio.cmd does actually exist.

Windows 10, npm 3.3.12, node v5.3.0, webdriverio 3.4.0, gulp-webdriver 1.0.2

Update: I got it working by changing the line to:

wdioBin = path.join(__dirname, '..', '.bin', isWin ? 'wdio.cmd' : 'wdio')

I'm guessing this is a problem due to the new npm flat dependency system?

Error: task completion callback called too many times

Not sure if this is related to #41 but if I do the following, the gulp task hangs as if waiting on something async:

gulp.task('default', ['selenium'], function(done) {
  return gulp.src('wdio.conf.js').pipe(webdriver());
});

If I try doing the following, it errors with Error: task completion callback called too many times

gulp.task('default', ['selenium'], function(done) {
  return gulp.src('wdio.conf.js').pipe(webdriver())
  .on('end', function() {
    done();
  });
});

gulp end event not firing in 2.0.0

In v1.0.3 I use the gulp 'end' event to shutdown my selenium server:

return gulp.src('./wdio.conf.js'))
    .pipe(webdriver({
      wdioBin:  path.join(__dirname, 'node_modules', '.bin', wdioCommand)
    })).once('end', () => {
      selenium.child.kill();
    });`

however in 2.0.0 the 'end' event never fires. Is this intentional?

Replace gulp-util

When installing with npm, we get the warning:

npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5

According to this article and the gulp-util repo we can see that gulp-util is deprecated.
There are instructions in those links on how to replace gulp-util with specific, smaller modules.

I think the only thing that's used from gulp-util is PluginError , so this module could be used instead: https://www.npmjs.com/package/plugin-error

Haven't found the WebdriverIO test runner

Using v1.0.1, when the top level project is dependent on both gulp-webdriver and webdriverio, the webdriverio module is installed in the top-level node_modules dir. Running gulp with piping to gulp-webdriver, gulp fails with the aforementioned message.

The problem is reproduced here:
https://github.com/electricmonk/goos-nodejs/tree/e6c3a0453a211fb072f7777e04c7e9491e556ba5

The code that causes this failure is this (index.js):

if (!fs.existsSync(opts.wdioBin)) {
   return this.emit('error', new gutil.PluginError('gulp-webdriver', 'Haven\'t found the WebdriverIO test runner', {
    showStack: false
  }));
}

which is caused by this line:

wdioBin = path.join(__dirname, 'node_modules', '.bin', isWin ? 'wdio.cmd' : 'wdio');

I managed to work around it by overriding the wdioBin option in my Gulpfile thus:

gulp.task('e2e', ['test', 'selenium'], function () {
    return gulp.src('wdio.conf.js', {read: false})
        .pipe(webdriver({
            wdioBin:  path.join(__dirname, 'node_modules', '.bin', 'wdio'),
            desiredCapabilities: {
                browserName: 'phantomjs'
            }
        }))
        .once('end', function () {
            selenium.child.kill();
        });

});

But I think that gulp-webdriver should be able to handle this case on its own.

Multiples issues after updating from 1.0.3 to 2.0.1

When I update gulp-webdriver to the latest version, I have problems with my differents tests.
The ones starting by creating a newbrowser like this :

var newbrowser = webdriverio.remote(browser.options).init();
return newbrowser
.url(browser.options.baseUrl + variables.url.home)
...
Error 1 : the test is passed instantly (but it isn't in reality)

I have an other test beggining like this who fails after a few clicks :
it('Search Manhattan with some criteria', function() {
return browser
.url(browser.options.baseUrl + variables.url.home)
...
Error 2 : browser.url(...).click(...).click(...).click(...).waitForVisible(...).click is not a function

For an other test I have this issue :
Error 3 : done is not a function

I can give you more details on my different test or my configuration files and nodesmodules versions if you need.

I can't make it work with multiple browsers and capabilities

I'm trying to start gulp-webdriver with following options:

{
    "desiredCapabilities": [{
        "browserName": "chrome",
        "chromeOptions": {
            "args": ["start-maximized", "show-fps-counter=true"],
            "prefs": {}
        },
        "javascriptEnabled": true,
        "databaseEnabled": true,
        "locationContextEnabled": true,
        "applicationCacheEnabled": true,
        "webStorageEnabled": true,
        "acceptSslCerts": true,
        "nativeEvents": true
    }],
    "host": "localhost",
    "port": "4444",
    "path": "/wd/hub",
    "logLevel": "verbose",
    "coloredLogs": true,
    "screenshotPath": "./reports/shots",
    "waitforTimeout": 2000,
    "slow": 75,
    "framework": "mocha",
    "ui": "bdd",
    "nospawn": false,
    "seleniumOptions": {},
    "seleniumInstallOptions": {
        "chrome": {
            "version": "2.18",
            "arch": "x64",
            "baseURL": "http://chromedriver.storage.googleapis.com"
        }
    },
    "reporter": "dot"
}

Which of course is failing

TypeError: Cannot read property 'chromeOptions' of undefined
    at /project/node_modules/gulp-webdriver/node_modules/deepmerge/index.js:40:28
    at Array.forEach (native)
    at deepmerge (/project/node_modules/gulp-webdriver/node_modules/deepmerge/index.js:35:26)
    at /project/node_modules/gulp-webdriver/node_modules/deepmerge/index.js:22:26
    at Array.forEach (native)
    at deepmerge (/project/node_modules/gulp-webdriver/node_modules/deepmerge/index.js:18:13)
    at new WebdriverIO (/project/node_modules/gulp-webdriver/node_modules/webdriverio/lib/webdriverio.js:42:32)
    at WebdriverIO.Chain (/project/node_modules/gulp-webdriver/node_modules/webdriverio/node_modules/chainit/index.js:6:17)
    at Object.remote (/project/node_modules/gulp-webdriver/node_modules/webdriverio/index.js:63:16)
    at Object.GulpWebdriverIO (/project/node_modules/gulp-webdriver/index.js:46:34)

If I'm trying to run it with desiredCapabilities as an object, not as an array - it works fine.
If I'm trying to pass capabilities as capabilities property array - it launches, but does not recognizes 'em at all, and fallbacks to firefox instead.

I don't want to start a bunch of webdriver gulp tasks simultaneously, 'cause I'll get really messy output.
I hope there is a way to make this work as intended.

I think there should be some array check for deepcopy in case someone passes an array instead of an object to capabilities / desiredCapabilities.

Test hangs on failure...

I have this task:

gulp.task('e2e',['start-rest','start-server','selenium'], function (done) {
     gulp.src('wdio.conf.js')
        .pipe(webdriver())
        .on('end', function(err){
            console.log(">>2>>"+err);
            done(err);
        })
        .on('error', function(err){
            console.log(">>>>"+err);
            done(err);
        });
});

It works fine when the tests pass, but hangs on failure:

0 passing (17.70s)
1 failing

1) Basic Test Should be able to login ..:
Failed: element (nsa-content) still not existing after 10000ms
running chrome
Error: element (nsa-content) still not existing after 10000ms
    at Page.value (test/e2e/spec/common/MainAssurancePage.js:27:18)
    at Object.<anonymous> (test/e2e/spec/testSpec.js:27:27)
    at elements("nsa-content") - isExisting.js:46:17
    at isExisting("nsa-content") - waitForExist.js:37:22

Wrote xunit report to [./target/test-res].
>>>>Error in plugin 'gulp-webdriver'
Message:
    wdio exited with code 1
[11:42:50] 'e2e' errored after 18 s
[11:42:50] Error in plugin 'gulp-webdriver'
Message:
    wdio exited with code 1

The versions of the plugins etc are:

[email protected]
[email protected]

Any suggestions?

Selenium never stops

I was trying to setup my integration tests and I keep getting this error :

  • gulp always comes back saying that `Error: Selenium server did not start.Another Selenium process may already be running or your java version may be out of date.`` even after updating java.

wdio.conf.js

exports.config = {
    specs: [
        'src/**/*.int.js'
    ],
    // Patterns to exclude.
    exclude: [
        // 'path/to/excluded/files'
    ],

    maxInstances: 10,

    capabilities: [{
        maxInstances: 5,
        browserName: 'firefox'
    }],
    sync: true,
    logLevel: 'error',
    coloredLogs: true,
    bail: 0,
    screenshotPath: './errorShots/',
    baseUrl: 'http://localhost:8099/Authentication.php',
    waitforTimeout: 120000,
    connectionRetryTimeout: 120000,
    connectionRetryCount: 10,
    services: ['selenium-standalone','phantomjs'],
    framework: 'mocha',
    mochaOpts: {
        ui: 'bdd'
    },
}

gulpfile.js

import yargs from 'yargs';
import gulp from 'gulp';
import del from 'del';
import {Server} from 'karma';
import webdriver from 'gulp-webdriver';
import selenium from 'selenium-standalone'
import restructureTree from './plugins/gulp-restructure-tree';
import { paths, pathMoveRules } from './config';

/* =Command-line arguments and config
 *------------------------------------------------------------*/

// some unrelated commands

/* =Tasks
 *------------------------------------------------------------*/

// other tasks goes here
export function wd_test() {
    return gulp.src('wdio.conf.js').pipe(webdriver({
        logLevel: 'verbose',
        waitforTimeout: 120000,
        reporter: 'spec'
    }));
}

export const build_app = gulp.series(clean, gulp.parallel(styles_app, scripts_app, others_app));
export const build = build_app;

export default build;

test.int.js

var chai              = require('chai');
var expect            = chai.expect;
var assert            = chai.assert;
var should            = chai.should();

describe('my awesome website', function() {
    it('should do some chai assertions', function() {
        browser.url('/');
        browser.getTitle().should.be.equal('Authentification');
    });
    after(function(){
        browser.end();
    })
});

Also not sure how but when I use before(), beforeEach(), after() and afterEach() in the test I either get the test failing or I get "after all", "after each" hook failing.

I also get an error in the test from time to time about the timeout (exceeded 10000ms) whereas the timeout limit was set to 120000ms.

Any help appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.