Fix bug in lettuce tests where the unregister dialog wasn't
getting closed fast enough.
This commit is contained in:
@@ -144,3 +144,8 @@ def i_am_an_edx_user(step):
|
||||
@step(u'User "([^"]*)" is an edX user$')
|
||||
def registered_edx_user(step, uname):
|
||||
world.create_user(uname)
|
||||
|
||||
|
||||
@step(u'All dialogs should be closed$')
|
||||
def dialogs_are_closed(step):
|
||||
assert world.dialogs_closed()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pylint: disable=C0111
|
||||
#pylint: disable=W0621
|
||||
|
||||
from lettuce import world, step
|
||||
from lettuce import world
|
||||
import time
|
||||
from urllib import quote_plus
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
@@ -104,6 +104,17 @@ def css_visible(css_selector):
|
||||
return world.browser.find_by_css(css_selector).visible
|
||||
|
||||
|
||||
@world.absorb
|
||||
def dialogs_closed():
|
||||
def are_dialogs_closed(driver):
|
||||
'''
|
||||
Return True when no modal dialogs are visible
|
||||
'''
|
||||
return not css_visible('.modal')
|
||||
wait_for(are_dialogs_closed)
|
||||
return not css_visible('.modal')
|
||||
|
||||
|
||||
@world.absorb
|
||||
def save_the_html(path='/tmp'):
|
||||
u = world.browser.url
|
||||
@@ -111,4 +122,4 @@ def save_the_html(path='/tmp'):
|
||||
filename = '%s.html' % quote_plus(u)
|
||||
f = open('%s/%s' % (path, filename), 'w')
|
||||
f.write(html)
|
||||
f.close
|
||||
f.close()
|
||||
|
||||
@@ -15,4 +15,6 @@ Feature: Register for a course
|
||||
And I visit the dashboard
|
||||
When I click the link with the text "Unregister"
|
||||
And I press the "Unregister" button in the Unenroll dialog
|
||||
Then I should see "Looks like you haven't registered for any courses yet." somewhere in the page
|
||||
Then All dialogs should be closed
|
||||
And I should be on the dashboard page
|
||||
And I should see "Looks like you haven't registered for any courses yet." somewhere in the page
|
||||
|
||||
Reference in New Issue
Block a user