Merge lp:~elopio/selenium-simple-test/is-displayed into lp:selenium-simple-test

Proposed by Leo Arias
Status: Merged
Merge reported by: Corey Goldberg
Merged at revision: not available
Proposed branch: lp:~elopio/selenium-simple-test/is-displayed
Merge into: lp:selenium-simple-test
Diff against target: 60 lines (+25/-3)
3 files modified
src/sst/actions.py (+14/-2)
src/sst/selftests/element_is_displayed.py (+10/-0)
src/testproject/templates/index.html (+1/-1)
To merge this branch: bzr merge lp:~elopio/selenium-simple-test/is-displayed
Reviewer Review Type Date Requested Status
Corey Goldberg (community) Approve
Review via email: mp+77094@code.launchpad.net

Commit message

Added the element_is_displayed action (Fixes bug #860264)

Description of the change

Added the element_is_displayed action, that will raise an exception if the element is not displayed (LP: #860264)

To post a comment you must log in.
Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

wondering if "element_is_displayed(id_or_elem)" should be named "is_displayed(id_or_elem)" ?
what do you think about the naming?

otherwise, looks good!

Revision history for this message
Corey Goldberg (coreygoldberg) wrote :

I made the name change to "is_displayed(id_or_elem)" in my branch:
https://code.launchpad.net/~coreygoldberg/selenium-simple-test/new-is_displayed

I'll merge that branch with this one as a prerequisite.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/sst/actions.py'
--- src/sst/actions.py 2011-09-26 04:27:25 +0000
+++ src/sst/actions.py 2011-09-27 05:39:23 +0000
@@ -69,8 +69,8 @@
69 'set_wait_timeout', 'get_argument', 'run_test', 'get_base_url',69 'set_wait_timeout', 'get_argument', 'run_test', 'get_base_url',
70 'end_test', 'skip', 'get_element_by_css', 'get_elements_by_css',70 'end_test', 'skip', 'get_element_by_css', 'get_elements_by_css',
71 'take_screenshot', 'debug', 'get_page_source', 'simulate_keys',71 'take_screenshot', 'debug', 'get_page_source', 'simulate_keys',
72 'element_click', 'get_element_by_xpath', 'get_elements_by_xpath',72 'element_is_displayed', 'element_click', 'get_element_by_xpath',
73 'switch_to_window', 'switch_to_frame'73 'get_elements_by_xpath', 'switch_to_window', 'switch_to_frame'
74]74]
7575
7676
@@ -433,6 +433,18 @@
433 url_is(link_url)433 url_is(link_url)
434434
435435
436def element_is_displayed(id_or_elem):
437 """
438 Assert that the element is displayed. Takes an id or an element object.
439 Raises a failure exception if the element specified doesn't exist or isn't
440 displayed. Returns the element if it is displayed."""
441 element = _get_elem(id_or_elem)
442 if not element.is_displayed():
443 message = 'Element is not displayed'
444 _raise(message)
445 return element
446
447
436def element_click(id_or_elem, wait=True):448def element_click(id_or_elem, wait=True):
437 """449 """
438 Click on an element of any kind not specific to links or buttons.450 Click on an element of any kind not specific to links or buttons.
439451
=== added file 'src/sst/selftests/element_is_displayed.py'
--- src/sst/selftests/element_is_displayed.py 1970-01-01 00:00:00 +0000
+++ src/sst/selftests/element_is_displayed.py 2011-09-27 05:39:23 +0000
@@ -0,0 +1,10 @@
1import os
2from sst.actions import *
3
4"""Test the element_is_displayed action."""
5
6
7goto('/')
8
9element_is_displayed('select_with_id_1')
10fails(element_is_displayed, 'hidden_input')
011
=== modified file 'src/testproject/templates/index.html'
--- src/testproject/templates/index.html 2011-09-26 03:12:05 +0000
+++ src/testproject/templates/index.html 2011-09-27 05:39:23 +0000
@@ -138,6 +138,6 @@
138 </form>138 </form>
139 139
140 <a id="popup_link" href="popup_with_frame.html" target="_NEW_WINDOW">Popup</a>140 <a id="popup_link" href="popup_with_frame.html" target="_NEW_WINDOW">Popup</a>
141 141 <input type="hidden" id="hidden_input" />
142</body>142</body>
143</html>143</html>

Subscribers

People subscribed via source and target branches