diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index 6fe63e68a5..712983bfe8 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -242,9 +242,7 @@ def save_button_disabled(step): @step('I confirm the prompt') def confirm_the_prompt(step): prompt_css = 'a.button.action-primary' - world.wait_for(lambda _driver: world.css_visible(prompt_css)) - world.css_click(prompt_css) - world.wait_for(lambda _driver: not world.css_visible(prompt_css)) + world.css_click(prompt_css, success_condition=lambda: not world.css_visible(prompt_css)) @step(u'I am shown a (.*)$') diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 225f654fea..5691081977 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -13,6 +13,10 @@ def create_component_instance(step, component_button_css, category, click_new_component_button(step, component_button_css) + def animation_done(_driver): + return world.browser.evaluate_script("$('div.new-component').css('display')") == 'none' + world.wait_for(animation_done) + if has_multiple_templates: click_component_from_menu(category, boilerplate, expected_css) @@ -39,11 +43,13 @@ def click_component_from_menu(category, boilerplate, expected_css): elem_css = "a[data-category='{}']:not([data-boilerplate])".format(category) elements = world.css_find(elem_css) assert_equal(len(elements), 1) + world.wait_for(lambda _driver: world.css_visible(elem_css)) world.css_click(elem_css, success_condition=lambda: 1 == len(world.css_find(expected_css))) @world.absorb def edit_component_and_select_settings(): + world.wait_for(lambda _driver: world.css_visible('a.edit-button')) world.css_click('a.edit-button') world.css_click('#settings-mode') diff --git a/cms/djangoapps/contentstore/features/problem-editor.py b/cms/djangoapps/contentstore/features/problem-editor.py index 565a35f802..8ffa866236 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.py +++ b/cms/djangoapps/contentstore/features/problem-editor.py @@ -156,7 +156,7 @@ def cancel_does_not_save_changes(step): def create_latex_problem(step): world.click_new_component_button(step, '.large-problem-icon') # Go to advanced tab. - world.css_click('#ui-id-2') + world.css_click('#ui-id-2', success_condition=lambda: world.css_has_class('div.ui-tabs li', 'ui-state-active', index=1)) world.click_component_from_menu("problem", "latex_problem.yaml", '.xmodule_CapaModule')