← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1404416] [NEW] Use selenium wait function the way selenium code suggests

 

Public bug reported:

BACKGROUND:
its known that horizon openstack dashboard integration tests uses selenium extensively to perform tests.
 Selenium official code is great in way each class and function has a docstring explaining the Usage and how params should be passed.
INFO:
Regarding this bug, In the helper file for integration tests i.e. 'horizon/openstack_dashboard/test/integration_tests/helpers.py`,
we call a selenium function named 'until()' passing a lambda function that returns title of webdriver. 
Source: https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/test/integration_tests/helpers.py#n52

We dont have to pass like 'until(lambda d: return self.driver.title)', 
instead we can do it (as suggested by selenium docstrings for this function)  like this  'until(lambda d: return d.title) and it would perfectly fine.
Why? because see the usage of this selenium function until():
https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/support/wait.py#39
this docstring suggests how a lambda function be passed.
also, looking at function definition of until() , it takes care of passing self.driver.. so when we say lambda d: ,  until will pass self.driver to this lambda function, and our return statement will eventually be self.driver.title if we define this lambda function as 
lambda d: return d.title
This is where until() is passing self.driver to method passed to it, ( here the method passed is labmda d )
https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/support/wait.py#66

FIX: simple fix to rework 'lambda d: return self.driver.title' to
'lambda d: return d.title'

** Affects: horizon
     Importance: Undecided
         Status: New


** Tags: integration-tests

** Tags added: integration-tests

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1404416

Title:
  Use selenium wait function the way selenium code suggests

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  BACKGROUND:
  its known that horizon openstack dashboard integration tests uses selenium extensively to perform tests.
   Selenium official code is great in way each class and function has a docstring explaining the Usage and how params should be passed.
  INFO:
  Regarding this bug, In the helper file for integration tests i.e. 'horizon/openstack_dashboard/test/integration_tests/helpers.py`,
  we call a selenium function named 'until()' passing a lambda function that returns title of webdriver. 
  Source: https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/test/integration_tests/helpers.py#n52

  We dont have to pass like 'until(lambda d: return self.driver.title)', 
  instead we can do it (as suggested by selenium docstrings for this function)  like this  'until(lambda d: return d.title) and it would perfectly fine.
  Why? because see the usage of this selenium function until():
  https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/support/wait.py#39
  this docstring suggests how a lambda function be passed.
  also, looking at function definition of until() , it takes care of passing self.driver.. so when we say lambda d: ,  until will pass self.driver to this lambda function, and our return statement will eventually be self.driver.title if we define this lambda function as 
  lambda d: return d.title
  This is where until() is passing self.driver to method passed to it, ( here the method passed is labmda d )
  https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/support/wait.py#66

  FIX: simple fix to rework 'lambda d: return self.driver.title' to
  'lambda d: return d.title'

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1404416/+subscriptions


Follow ups

References