From 7dac728ee9b2e4f9454d76be180b42c312ce31df Mon Sep 17 00:00:00 2001 From: Adnan Ghaffar Date: Tue, 3 Nov 2015 19:35:55 +0500 Subject: [PATCH] adding fixed tests for chrome --- common/test/acceptance/pages/lms/problem.py | 8 ++++++++ common/test/acceptance/pages/studio/library.py | 4 +++- common/test/acceptance/tests/lms/test_library.py | 6 ++++-- common/test/acceptance/tests/lms/test_lms_problems.py | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/test/acceptance/pages/lms/problem.py b/common/test/acceptance/pages/lms/problem.py index 2870953c63..068cf35a1c 100644 --- a/common/test/acceptance/pages/lms/problem.py +++ b/common/test/acceptance/pages/lms/problem.py @@ -10,6 +10,7 @@ class ProblemPage(PageObject): """ url = None + CSS_PROBLEM_HEADER = '.problem-header' def is_browser_on_page(self): return self.q(css='.xblock-student_view').present @@ -81,6 +82,7 @@ class ProblemPage(PageObject): Fill in the answer to a numerical problem. """ self.q(css='div.problem section.inputtype input').fill(text) + self.wait_for_ajax() def click_check(self): """ @@ -89,6 +91,12 @@ class ProblemPage(PageObject): self.q(css='div.problem button.check').click() self.wait_for_ajax() + def wait_for_status_icon(self): + """ + wait for status icon + """ + self.wait_for_element_visibility('div.problem section.inputtype div .status', 'wait for status icon') + def click_hint(self): """ Click the Hint button. diff --git a/common/test/acceptance/pages/studio/library.py b/common/test/acceptance/pages/studio/library.py index ad60c7dc2a..625eaebe8a 100644 --- a/common/test/acceptance/pages/studio/library.py +++ b/common/test/acceptance/pages/studio/library.py @@ -9,6 +9,7 @@ from .component_editor import ComponentEditorView from .container import XBlockWrapper from ...pages.studio.users import UsersPageMixin from ...pages.studio.pagination import PaginatedMixin +from selenium.webdriver.common.keys import Keys from ..common.utils import confirm_prompt, wait_for_notification @@ -168,7 +169,8 @@ class StudioLibraryContentEditor(ComponentEditorView): Sets value of children count input """ count_text = self.get_setting_element(self.COUNT_LABEL) - count_text.clear() + count_text.send_keys(Keys.CONTROL, "a") + count_text.send_keys(Keys.BACK_SPACE) count_text.send_keys(count) EmptyPromise(lambda: self.count == count, "count is updated in modal.").fulfill() diff --git a/common/test/acceptance/tests/lms/test_library.py b/common/test/acceptance/tests/lms/test_library.py index 143acc77f6..b9df22cc45 100644 --- a/common/test/acceptance/tests/lms/test_library.py +++ b/common/test/acceptance/tests/lms/test_library.py @@ -118,6 +118,7 @@ class LibraryContentTestBase(UniqueCourseTest): LogoutPage(self.browser).visit() self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True) self.course_outline.visit() + subsection = self.course_outline.section(SECTION_NAME).subsection(SUBSECTION_NAME) return subsection.expand_subsection().unit(UNIT_NAME).go_to() @@ -156,9 +157,10 @@ class LibraryContentTest(LibraryContentTestBase): XBlockFixtureDesc("html", "Html1", data='html1'), XBlockFixtureDesc("html", "Html2", data='html2'), XBlockFixtureDesc("html", "Html3", data='html3'), + XBlockFixtureDesc("html", "Html4", data='html4'), ) - @ddt.data(1, 2, 3) + @ddt.data(2, 3, 4) def test_shows_random_xblocks_from_configured(self, count): """ Scenario: Ensures that library content shows {count} random xblocks from library in LMS @@ -190,7 +192,7 @@ class LibraryContentTest(LibraryContentTestBase): self._auto_auth(self.USERNAME, self.EMAIL, False) self._goto_library_block_page() children_contents = self.library_content_page.children_contents - self.assertEqual(len(children_contents), 3) + self.assertEqual(len(children_contents), 4) self.assertEqual(children_contents, self.library_xblocks_texts) diff --git a/common/test/acceptance/tests/lms/test_lms_problems.py b/common/test/acceptance/tests/lms/test_lms_problems.py index 789d0e63df..aa6e08dec4 100644 --- a/common/test/acceptance/tests/lms/test_lms_problems.py +++ b/common/test/acceptance/tests/lms/test_lms_problems.py @@ -315,7 +315,9 @@ class ProblemPartialCredit(ProblemsTest): """ self.courseware_page.visit() problem_page = ProblemPage(self.browser) + problem_page.wait_for_element_visibility(problem_page.CSS_PROBLEM_HEADER, 'wait for problem header') self.assertEqual(problem_page.problem_name, 'PARTIAL CREDIT TEST PROBLEM') problem_page.fill_answer_numerical('-1') problem_page.click_check() + problem_page.wait_for_status_icon() self.assertTrue(problem_page.simpleprob_is_partially_correct())