Sometimes the first click doesn't actually work, so call click up to 5 times.
This seems to fix the sporadic failure (at least on my machine).
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#pylint: disable=W0621
|
||||
|
||||
from lettuce import world, step
|
||||
from nose.tools import assert_false, assert_equal, assert_regexp_matches
|
||||
from nose.tools import assert_false, assert_equal, assert_regexp_matches, assert_true
|
||||
from common import type_in_codemirror
|
||||
|
||||
KEY_CSS = '.key input.policy-key'
|
||||
@@ -28,7 +28,20 @@ def i_am_on_advanced_course_settings(step):
|
||||
@step(u'I press the "([^"]*)" notification button$')
|
||||
def press_the_notification_button(step, name):
|
||||
css = 'a.%s-button' % name.lower()
|
||||
world.css_click(css)
|
||||
|
||||
# Save was clicked if either the save notification bar is gone, or we have a error notification
|
||||
# overlaying it (expected in the case of typing Object into display_name).
|
||||
save_clicked = lambda : world.is_css_not_present('.is-shown.wrapper-notification-warning') or \
|
||||
world.is_css_present('.is-shown.wrapper-notification-error')
|
||||
|
||||
attempts = 0
|
||||
while attempts < 5:
|
||||
world.css_click(css)
|
||||
if save_clicked():
|
||||
break
|
||||
attempts+=1
|
||||
|
||||
assert_true(save_clicked(), 'The save button was not clicked after 5 attempts.')
|
||||
|
||||
|
||||
@step(u'I edit the value of a policy key$')
|
||||
|
||||
Reference in New Issue
Block a user