Commit 7dac728e by Adnan Ghaffar Committed by adnanghaffar07

adding fixed tests for chrome

parent 4cba4007
...@@ -10,6 +10,7 @@ class ProblemPage(PageObject): ...@@ -10,6 +10,7 @@ class ProblemPage(PageObject):
""" """
url = None url = None
CSS_PROBLEM_HEADER = '.problem-header'
def is_browser_on_page(self): def is_browser_on_page(self):
return self.q(css='.xblock-student_view').present return self.q(css='.xblock-student_view').present
...@@ -81,6 +82,7 @@ class ProblemPage(PageObject): ...@@ -81,6 +82,7 @@ class ProblemPage(PageObject):
Fill in the answer to a numerical problem. Fill in the answer to a numerical problem.
""" """
self.q(css='div.problem section.inputtype input').fill(text) self.q(css='div.problem section.inputtype input').fill(text)
self.wait_for_ajax()
def click_check(self): def click_check(self):
""" """
...@@ -89,6 +91,12 @@ class ProblemPage(PageObject): ...@@ -89,6 +91,12 @@ class ProblemPage(PageObject):
self.q(css='div.problem button.check').click() self.q(css='div.problem button.check').click()
self.wait_for_ajax() 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): def click_hint(self):
""" """
Click the Hint button. Click the Hint button.
......
...@@ -9,6 +9,7 @@ from .component_editor import ComponentEditorView ...@@ -9,6 +9,7 @@ from .component_editor import ComponentEditorView
from .container import XBlockWrapper from .container import XBlockWrapper
from ...pages.studio.users import UsersPageMixin from ...pages.studio.users import UsersPageMixin
from ...pages.studio.pagination import PaginatedMixin from ...pages.studio.pagination import PaginatedMixin
from selenium.webdriver.common.keys import Keys
from ..common.utils import confirm_prompt, wait_for_notification from ..common.utils import confirm_prompt, wait_for_notification
...@@ -168,7 +169,8 @@ class StudioLibraryContentEditor(ComponentEditorView): ...@@ -168,7 +169,8 @@ class StudioLibraryContentEditor(ComponentEditorView):
Sets value of children count input Sets value of children count input
""" """
count_text = self.get_setting_element(self.COUNT_LABEL) 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) count_text.send_keys(count)
EmptyPromise(lambda: self.count == count, "count is updated in modal.").fulfill() EmptyPromise(lambda: self.count == count, "count is updated in modal.").fulfill()
......
...@@ -118,6 +118,7 @@ class LibraryContentTestBase(UniqueCourseTest): ...@@ -118,6 +118,7 @@ class LibraryContentTestBase(UniqueCourseTest):
LogoutPage(self.browser).visit() LogoutPage(self.browser).visit()
self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True) self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True)
self.course_outline.visit() self.course_outline.visit()
subsection = self.course_outline.section(SECTION_NAME).subsection(SUBSECTION_NAME) subsection = self.course_outline.section(SECTION_NAME).subsection(SUBSECTION_NAME)
return subsection.expand_subsection().unit(UNIT_NAME).go_to() return subsection.expand_subsection().unit(UNIT_NAME).go_to()
...@@ -156,9 +157,10 @@ class LibraryContentTest(LibraryContentTestBase): ...@@ -156,9 +157,10 @@ class LibraryContentTest(LibraryContentTestBase):
XBlockFixtureDesc("html", "Html1", data='html1'), XBlockFixtureDesc("html", "Html1", data='html1'),
XBlockFixtureDesc("html", "Html2", data='html2'), XBlockFixtureDesc("html", "Html2", data='html2'),
XBlockFixtureDesc("html", "Html3", data='html3'), 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): def test_shows_random_xblocks_from_configured(self, count):
""" """
Scenario: Ensures that library content shows {count} random xblocks from library in LMS Scenario: Ensures that library content shows {count} random xblocks from library in LMS
...@@ -190,7 +192,7 @@ class LibraryContentTest(LibraryContentTestBase): ...@@ -190,7 +192,7 @@ class LibraryContentTest(LibraryContentTestBase):
self._auto_auth(self.USERNAME, self.EMAIL, False) self._auto_auth(self.USERNAME, self.EMAIL, False)
self._goto_library_block_page() self._goto_library_block_page()
children_contents = self.library_content_page.children_contents 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) self.assertEqual(children_contents, self.library_xblocks_texts)
......
...@@ -315,7 +315,9 @@ class ProblemPartialCredit(ProblemsTest): ...@@ -315,7 +315,9 @@ class ProblemPartialCredit(ProblemsTest):
""" """
self.courseware_page.visit() self.courseware_page.visit()
problem_page = ProblemPage(self.browser) 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') self.assertEqual(problem_page.problem_name, 'PARTIAL CREDIT TEST PROBLEM')
problem_page.fill_answer_numerical('-1') problem_page.fill_answer_numerical('-1')
problem_page.click_check() problem_page.click_check()
problem_page.wait_for_status_icon()
self.assertTrue(problem_page.simpleprob_is_partially_correct()) self.assertTrue(problem_page.simpleprob_is_partially_correct())
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