Commit 22cf0dfa by Diana Huang

Fix bug in lettuce tests where the unregister dialog wasn't

getting closed fast enough.
parent 1c217530
......@@ -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()
#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
......@@ -105,10 +105,21 @@ def css_visible(css_selector):
@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
html = world.browser.html.encode('ascii', 'ignore')
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment