From 20ce33dcdbb2658993e1be8c6f20c6d71f09331f Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 29 Jul 2013 13:38:27 -0400 Subject: [PATCH 1/5] Fixed broken tests from chrome versioning --- cms/djangoapps/contentstore/features/common.py | 3 +++ .../contentstore/features/component_settings_editor_helpers.py | 2 +- cms/djangoapps/contentstore/features/upload.py | 2 +- cms/djangoapps/contentstore/features/video-editor.py | 1 + lms/djangoapps/courseware/features/homepage.py | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index d357c8ae96..6fe63e68a5 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -242,7 +242,9 @@ 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)) @step(u'I am shown a (.*)$') @@ -252,6 +254,7 @@ def i_am_shown_a_notification(step, notification_type): def type_in_codemirror(index, text): world.css_click(".CodeMirror", index=index) + world.browser.execute_script("$('div.CodeMirror.CodeMirror-focused > div').css('overflow', '')") g = world.css_find("div.CodeMirror.CodeMirror-focused > div > textarea") if world.is_mac(): g._element.send_keys(Keys.COMMAND + 'a') diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 2b206e4466..225f654fea 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -39,7 +39,7 @@ 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.css_click(elem_css) + world.css_click(elem_css, success_condition=lambda: 1 == len(world.css_find(expected_css))) @world.absorb diff --git a/cms/djangoapps/contentstore/features/upload.py b/cms/djangoapps/contentstore/features/upload.py index 0c700956e3..df63b26b3b 100644 --- a/cms/djangoapps/contentstore/features/upload.py +++ b/cms/djangoapps/contentstore/features/upload.py @@ -58,7 +58,7 @@ def delete_file(_step, file_name): world.css_click(delete_css, index=index) prompt_confirm_css = 'li.nav-item > a.action-primary' - world.css_click(prompt_confirm_css) + world.css_click(prompt_confirm_css, success_condition=lambda: not world.css_visible(prompt_confirm_css)) @step(u'I should see only one "([^"]*)"$') diff --git a/cms/djangoapps/contentstore/features/video-editor.py b/cms/djangoapps/contentstore/features/video-editor.py index 93d638e621..6113f42c91 100644 --- a/cms/djangoapps/contentstore/features/video-editor.py +++ b/cms/djangoapps/contentstore/features/video-editor.py @@ -19,5 +19,6 @@ def i_see_the_correct_settings_and_values(step): @step('I have set "show captions" to (.*)') def set_show_captions(step, setting): world.css_click('a.edit-button') + world.wait_for(lambda _driver: world.css_visible('a.save-button')) world.browser.select('Show Captions', setting) world.css_click('a.save-button') diff --git a/lms/djangoapps/courseware/features/homepage.py b/lms/djangoapps/courseware/features/homepage.py index 585d1582d7..51c3277e69 100644 --- a/lms/djangoapps/courseware/features/homepage.py +++ b/lms/djangoapps/courseware/features/homepage.py @@ -8,7 +8,7 @@ from nose.tools import assert_in, assert_equals @step(u'I should see the following Partners in the Partners section') def i_should_see_partner(step): partners = world.browser.find_by_css(".partner .name span") - names = set(span.text for span in partners) + names = set(span.html for span in partners) for partner in step.hashes: assert_in(partner['Partner'], names) From 3bc34d71a9a99f3af2d9e98b7dc5b83749ca9a7b Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 29 Jul 2013 13:52:02 -0400 Subject: [PATCH 2/5] Changed version requirement in testing.md --- doc/testing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/testing.md b/doc/testing.md index cfca297f2b..b060336d1d 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -186,8 +186,8 @@ uses [Selenium](http://docs.seleniumhq.org/) to control the Chrome browser. **Prerequisite**: You must have [ChromeDriver](https://code.google.com/p/selenium/wiki/ChromeDriver) installed to run the tests in Chrome. The tests are confirmed to run -with Chrome (not Chromium) version 26.0.0.1410.63 with ChromeDriver -version r195636. +with Chrome (not Chromium) version 28.0.1500.71 with ChromeDriver +version 2.1.210398. To run all the acceptance tests: From 419207ac3ddfba0e5efb9ed2d269c75296ee74f9 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 29 Jul 2013 14:49:50 -0400 Subject: [PATCH 3/5] Fixed issues with problem-editor.feature --- cms/djangoapps/contentstore/features/common.py | 4 +--- .../features/component_settings_editor_helpers.py | 6 ++++++ cms/djangoapps/contentstore/features/problem-editor.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) 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') From ee46b3ef24d345f14b44e30d207725c4916e1196 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Mon, 29 Jul 2013 15:58:23 -0400 Subject: [PATCH 4/5] One click categories do not have animations --- .../features/component_settings_editor_helpers.py | 9 +++++---- cms/djangoapps/contentstore/features/problem-editor.py | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 5691081977..8c6a1023c9 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -12,16 +12,17 @@ def create_component_instance(step, component_button_css, category, has_multiple_templates=True): 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 category == 'problem' or category == 'html': + 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) assert_equal(1, len(world.css_find(expected_css))) + @world.absorb def click_new_component_button(step, component_button_css): step.given('I have clicked the new unit button') diff --git a/cms/djangoapps/contentstore/features/problem-editor.py b/cms/djangoapps/contentstore/features/problem-editor.py index 8ffa866236..e97e2857a5 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.py +++ b/cms/djangoapps/contentstore/features/problem-editor.py @@ -155,8 +155,12 @@ def cancel_does_not_save_changes(step): @step('I have created a LaTeX Problem') def create_latex_problem(step): world.click_new_component_button(step, '.large-problem-icon') + + def animation_done(_driver): + return world.browser.evaluate_script("$('div.new-component').css('display')") == 'none' + world.wait_for(animation_done) # Go to advanced tab. - world.css_click('#ui-id-2', success_condition=lambda: world.css_has_class('div.ui-tabs li', 'ui-state-active', index=1)) + world.css_click('#ui-id-2') world.click_component_from_menu("problem", "latex_problem.yaml", '.xmodule_CapaModule') From dd0f7bc3107723bfdb6efe240abd86908ef26975 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Tue, 30 Jul 2013 12:46:42 -0400 Subject: [PATCH 5/5] Fixed indenting and cleaned up if clause --- .../contentstore/features/component_settings_editor_helpers.py | 2 +- cms/djangoapps/contentstore/features/problem-editor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py index 8c6a1023c9..a130a33677 100644 --- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py +++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py @@ -12,7 +12,7 @@ def create_component_instance(step, component_button_css, category, has_multiple_templates=True): click_new_component_button(step, component_button_css) - if category == 'problem' or category == 'html': + if category in ('problem', 'html'): def animation_done(_driver): return world.browser.evaluate_script("$('div.new-component').css('display')") == 'none' world.wait_for(animation_done) diff --git a/cms/djangoapps/contentstore/features/problem-editor.py b/cms/djangoapps/contentstore/features/problem-editor.py index e97e2857a5..d7ccb557ba 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.py +++ b/cms/djangoapps/contentstore/features/problem-editor.py @@ -157,7 +157,7 @@ def create_latex_problem(step): world.click_new_component_button(step, '.large-problem-icon') def animation_done(_driver): - return world.browser.evaluate_script("$('div.new-component').css('display')") == 'none' + return world.browser.evaluate_script("$('div.new-component').css('display')") == 'none' world.wait_for(animation_done) # Go to advanced tab. world.css_click('#ui-id-2')