Selenium driver function 'current_url' is wrongly called in integration tests

Bug #1404379 reported by Imran Hayder
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Undecided
Imran Hayder

Bug Description

BASIC INFO:
The function defined in selenium, is getting called in integration tests as :
self.driver.current_url()
While the official selenium documentation says it should be called as:
self.driver.current_url

The function call is made actually in pageobject.py (base file for all integration tests) but since no tests actually uses it, we dont see the error, if you modify tests to use this call, it will definitely throw an error because actual function defined in selenium is a property function that get called differently than normal function in python are called .

DETAILS:
The integration tests which are basically selenium based UI tests, have a lot of useful helper functions wrapped around actual calls you would make to selenium module.
One of the function defined `horizon/openstack_dashboard/test/integration_tests/pages/pageobject.py` is:
    def get_url_current_page(self):
        return self.driver.current_url()
Source: https://git.openstack.org/cgit/openstack/horizon/tree/openstack_dashboard/test/integration_tests/pages/pageobject.py#n37

Its obviously not used in any of existing tests but if you try to use this function, it throws an error.

So looking at the official selenium code, I found the its actually being called wrongly. 'current_url` is a property function which act as getters/setters in python so they cant be called as normal function like `func()` but correct way is `func`
Source:
https://code.google.com/p/selenium/source/browse/py/selenium/webdriver/remote/webdriver.py#425

FIX: just changing the 'current_url()' to 'current_url' will fix it )

summary: - Selenium driver property function 'current_url' is wrongly called in
- integration tests
+ Selenium driver function 'current_url' is wrongly called in integration
+ tests
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/143191

Changed in horizon:
assignee: nobody → Imran Hayder (hayderimran7)
status: New → In Progress
Revision history for this message
Daniel Korn (dkorn) wrote :

Thanks for raising this issue.

Actually, there is a test that was suppose to be using this method: test_dashboard_help_redirection, but apparently I forgot to use it when I wrote the test (which is ironic cause I was the one who wrote the method at the first place if I'm not mistaken :))

Anyway, as part of this fix I will submit a modification to the test that uses the method (in a different patch).

Revision history for this message
Daniel Korn (dkorn) wrote :

This is the patch updating test_dashboard_help_redirection: https://review.openstack.org/#/c/143295/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/143191
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=b9f6fc1630625a023af739a07f83b39fb8e29ce3
Submitter: Jenkins
Branch: master

commit b9f6fc1630625a023af739a07f83b39fb8e29ce3
Author: imran <email address hidden>
Date: Fri Dec 19 13:03:27 2014 -0800

    Fix wrong calling of selenium driver function

    Selenium docstrings define the usage of this function to be called as
    driver.current_url but integration tests call it in wrong way as
    driver.current_url() which throws an error if you try to use it that way.
    Read the bug for detailed info on this and its source.

    Change-Id: I9b065ffb495b637dfe4582edf4aa216a833d5058
    Partially implements blueprint: selenium-integration-testing
    Closes-Bug: #1404379

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
milestone: none → kilo-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: kilo-2 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.