Permalink
Browse files

Merge branch 'remote-testing'

  • Loading branch information...
2 parents 07cb17c + bde903d commit 821f627711dbe65920efa19f0c81e5c5d984521b Daniel Boczek committed Nov 25, 2011
Showing with 11 additions and 9 deletions.
  1. +3 −4 django_selenium/selenium_runner.py
  2. +1 −1 django_selenium/selenium_server.py
  3. +7 −4 django_selenium/testcases.py
View
@@ -83,13 +83,12 @@ def build_suite(self, test_labels, extra_tests=None, **kwargs):
def _start_selenium(self):
if self.selenium:
- assert settings.SELENIUM_PATH, "selenium path is not set"
# Set display variable
os.environ['DISPLAY'] = settings.SELENIUM_DISPLAY
# Start test server
- self.test_server = start_test_server(port=settings.SELENIUM_TESTSERVER_PORT)
- if settings.SELENIUM_HOST is None:
+ self.test_server = start_test_server(address=settings.SELENIUM_TESTSERVER_HOST, port=settings.SELENIUM_TESTSERVER_PORT)
+ if settings.SELENIUM_PATH:
# Start selenium server
self.selenium_server = subprocess.Popen(('java -jar %s' % settings.SELENIUM_PATH).split())
@@ -102,7 +101,7 @@ def _start_selenium(self):
def _stop_selenium(self):
if self.selenium:
# Stop selenium server
- if settings.SELENIUM_HOST is None:
+ if settings.SELENIUM_PATH:
selenium_server = self.selenium_server
selenium_server.send_signal(signal.SIGINT)
if selenium_server.poll() is None:
@@ -61,7 +61,7 @@ def stop(self, timeout=None):
self._stop_event.set()
self.join(timeout)
-def start_test_server(address='0.0.0.0', port=8000):
+def start_test_server(address='localhost', port=8000):
server_thread = TestServerThread(address, port)
server_thread.start()
server_thread._start_event.wait()
View
11 django_selenium/testcases.py 100644 → 100755
@@ -28,10 +28,13 @@ class MyDriver(object):
def __init__(self):
driver = getattr(webdriver, settings.SELENIUM_DRIVER, None)
assert driver, "settings.SELENIUM_DRIVER contains non-existing driver"
- if settings.SELENIUM_DRIVER == 'Remote':
- capabilitiy = getattr(webdriver.DesiredCapabilities, settings.SELENIUM_CAPABILITY, None)
- assert capabilitiy, 'settings.SELENIUM_CAPABILITY contains non-existing capability'
- self.driver = driver('http://%s:%d/wd/hub' % (settings.SELENIUM_HOST, settings.SELENIUM_PORT), capabilitiy)
+ if driver is webdriver.Remote:
+ if isinstance(settings.SELENIUM_CAPABILITY, dict):
+ capability = settings.SELENIUM_CAPABILITY
+ else:
+ capability = getattr(webdriver.DesiredCapabilities, settings.SELENIUM_CAPABILITY, None)
+ assert capability, 'settings.SELENIUM_CAPABILITY contains non-existing capability'
+ self.driver = driver('http://%s:%d/wd/hub' % (settings.SELENIUM_HOST, settings.SELENIUM_PORT), capability)
else:
self.driver = driver()
self.testserver_host = settings.SELENIUM_TESTSERVER_HOST

0 comments on commit 821f627

Please sign in to comment.