Added tests for static pages

Also added in drag and drop helper.  Please be careful using this method as it is truly a hack to obtain the visual effects.  As of this commit, selenium does not support drag and drop for jQuery sortable items
This commit is contained in:
JonahStanley
2013-06-11 14:34:18 -04:00
parent c74d76a36b
commit 81b06d5c70
3 changed files with 122 additions and 0 deletions

View File

@@ -158,3 +158,15 @@ def click_tools():
tools_css = 'li.nav-course-tools'
if world.browser.is_element_present_by_css(tools_css):
world.css_click(tools_css)
@world.absorb
def drag_sortable_after(item_css, index1, index2, sortable_css):
"""
This is a hack in order to simulate jQuery's sortable list dragging as Selenium cannot currently do it with action_chains
Please note that this is very finnicky with keeping the changes after refreshing the page so be careful when testing persistant changes
Also note that this is mainly for visualization of the sortable list and the true sortable drag and drop fires many events
"""
world.browser.execute_script('$("%(item_css)s:eq(%(index_one)s)").insertAfter($("%(item_css)s:eq(%(index_two)s)"));\
$("%(sortable_css)s").trigger("sortupdate")' %
{'item_css': item_css, 'index_one': index1, 'index_two': index2, 'sortable_css': sortable_css})