PixnBits / karma-selenium-webdriver-launcher

A Karma plugin. Run tests in an instance of a Selenium Webdriver.
MIT License
5 stars 8 forks source link

Karma doesn't terminate using webdriver-launcher. #4

Closed grahame closed 9 years ago

grahame commented 9 years ago

Hey

With this config snippet:

var webdriver = require('selenium-webdriver'),
    firefox = require('selenium-webdriver/firefox');

module.exports = function(config){
    config.set({
    customLaunchers: {
      swd_firefox: {
        base: 'SeleniumWebdriver',
        browserName: 'Firefox',
        getDriver: function(){
          // example from https://www.npmjs.com/package/selenium-webdriver#usage 
          var driver = new webdriver.Builder()
            .forBrowser('firefox')
            .usingServer('http://hub:4444/wd/hub')
            .build();
          return driver;
        }
      },
    },

... I'm running karma against a selenium hub (I have to construct driver this way to pass the URL for the hub.)

Everything works fine and then this happens (logs from running under fig/docker)

  karma_1         | Wed Mar 11 07:42:56 UTC 2015 - connected to web 8000
  karma_1         | [Run] Starting karma
  karma_1         | INFO [karma]: Karma v0.12.31 server started at http://karma:9876/
  karma_1         | changed name to Firefox via Selenium Webdriver
  karma_1         | INFO [launcher.selenium-webdriver]: SeleniumWebdriverBrowser       (kid:27122598) created
  karma_1         | INFO [launcher]: Starting browser Firefox via Selenium Webdriver
  karma_1         | INFO [launcher.selenium-webdriver]: starting Firefox via Selenium Webdriver
  karma_1         | INFO [launcher.selenium-webdriver]: sending driver to url http://karma:9876/
  seleniumhub_1   | 07:42:57.673 INFO - Got a request to create a new session: Capabilities [{browserName=firefox}]
  seleniumhub_1   | 07:42:57.674 INFO - Available nodes: [host :http://172.17.6.78:5555, host :http://172.17.6.82:5555]
  seleniumhub_1   | 07:42:57.674 INFO - Trying to create a new session on node host :http://172.17.6.78:5555
  seleniumhub_1   | 07:42:57.674 INFO - Node host :http://172.17.6.78:5555 has no matching capability
  seleniumhub_1   | 07:42:57.674 INFO - Trying to create a new session on node host :http://172.17.6.82:5555
  seleniumhub_1   | 07:42:57.674 INFO - Trying to create a new session on test slot {seleniumProtocol=WebDriver, platform=LINUX, browserName=firefox, maxInstances=1}
  firefox_1       | 07:42:57.689 INFO - Executing: [new session: Capabilities [{browserName=firefox}]])
  firefox_1       | 07:42:57.699 INFO - Creating a new session for Capabilities [{browserName=firefox}]
  firefox_1       | 07:43:00.036 INFO - Done: [new session: Capabilities [{browserName=firefox}]]
  karma_1         | changed name to firefox 36.0 (LINUX) via Selenium Webdriver
  firefox_1       | 07:43:00.126 INFO - Executing: [get: http://karma:9876/])
  firefox_1       | 07:43:00.919 INFO - Done: [get: http://karma:9876/]
  karma_1         | INFO [Firefox 36.0.0 (Ubuntu)]: Connected on socket usbFXj3rmFcL72wPyVZR with id manual-1969
                    Firefox 36.0.0 (Ubuntu): Executed 26 of 26 SUCCESS (0.042 secs / 0.074 secs)
  firefox_1       | 07:43:31.082 INFO - Session 0d99f024-9dcb-4d9e-9dec-2ec0bdd4eeb8 deleted       due to client timeout
  karma_1         | WARN [Firefox 36.0.0 (Ubuntu)]: Disconnected (1 times)
  seleniumhub_1   | 07:43:34.929 WARN - session ext. key 0d99f024-9dcb-4d9e-9dec-2ec0bdd4eeb8 has TIMED OUT due to client inactivity and will be released.
  seleniumhub_1   | 07:43:34.959 WARN - Error releasing the resources on timeout for session ext. key 0d99f024-9dcb-4d9e-9dec-2ec0bdd4eeb8

it looks like karma never shuts down - and when I kill it I get: karma_1 | INFO [launcher.selenium-webdriver]: requested to kill, session id is 0d99f024-9dcb-4d9e-9dec-2ec0bdd4eeb8

... but it doesn't go. so I think it's stuck in the code from this project? Not sure where to go next to fix this problem in webdriver-launcher, any suggestions would be wonderful.

PixnBits commented 9 years ago

looks like a duplicate of #2 I should probably fix this (sorry to be slow, the use case I created this for doesn't use karma anymore)

PixnBits commented 9 years ago

As commented in #2, please test the changes in your setup. Fixed on my machine, but I want to have more data points before a version bump. Thanks!

PixnBits commented 9 years ago

per #2 I bumped the version, I'm fairly confident npm update will fix the issue

grahame commented 9 years ago

Sorry, not working - I've tested against the next version, and roughly the same output:

                  Firefox 36.0.0 (Ubuntu): Executed 26 of 26 SUCCESS (0.026 secs / 0.084 secs)
firefox_1       | 04:12:32.249 INFO - Session d2bb33a2-2434-4b6a-b6a8-5a1c2164bd5e deleted due to client timeout
karma_1         | WARN [Firefox 36.0.0 (Ubuntu)]: Disconnected (1 times)
seleniumhub_1   | 04:12:33.056 WARN - session ext. key d2bb33a2-2434-4b6a-b6a8-5a1c2164bd5e has TIMED OUT due to client inactivity and will be released.
seleniumhub_1   | 04:12:33.081 WARN - Error releasing the resources on timeout for session ext. key d2bb33a2-2434-4b6a-b6a8-5a1c2164bd5e

I did put a logger.info into both isCaptured and self.kill and neither is called that I can see. Could it be the way I'm constructing the instance to point it at the hub?

Thanks for the help! If there's any way you can point me to better debug this let me know.

grahame commented 9 years ago

I've moved away from using selenium, and have shifted to running karma in its own docker container against firefox/Xvfb (https://github.com/muccg/docker-karma), so no worries about this ticket - the problem is likely the way I'm creating firefox. Thanks very much for the help.