Commit 70819203 by Martyn James

Merge pull request #7443 from edx/mjevtic/SOL-336

Fixed flaky test(s) - SOL-336 - merging updates
parents 68ba1786 29bceffc
......@@ -222,7 +222,7 @@ class CourseOutlineContainer(CourseOutlineItem):
require_notification=require_notification,
)
def toggle_expand(self):
def expand_subsection(self):
"""
Toggle the expansion of this subsection.
"""
......@@ -236,12 +236,15 @@ class CourseOutlineContainer(CourseOutlineItem):
currently_expanded = subsection_expanded()
self.q(css=self._bounded_selector('.ui-toggle-expansion i')).first.click()
self.wait_for_element_presence(self._bounded_selector(self.ADD_BUTTON_SELECTOR), 'Subsection is expanded')
EmptyPromise(
lambda: subsection_expanded() != currently_expanded,
"Check that the container {} has been toggled".format(self.locator)
).fulfill()
self.browser.execute_script("jQuery.fx.off = false;")
return self
@property
......@@ -564,10 +567,10 @@ class CourseOutlinePage(CoursePage, CourseOutlineContainer):
"""
for section in self.sections():
if section.is_collapsed:
section.toggle_expand()
section.expand_subsection()
for subsection in section.subsections():
if subsection.is_collapsed:
subsection.toggle_expand()
subsection.expand_subsection()
@property
def xblocks(self):
......
......@@ -44,7 +44,7 @@ class StudioPagePerformanceTest(WebAppTest):
Produce a HAR for loading a unit page.
"""
course_outline_page = CourseOutlinePage(self.browser, self.course_org, self.course_num, self.course_run).visit()
course_outline_unit = course_outline_page.section(section_title).subsection(subsection_title).toggle_expand().unit(unit_title)
course_outline_unit = course_outline_page.section(section_title).subsection(subsection_title).expand_subsection().unit(unit_title)
har_name = 'UnitPage_{org}_{course}'.format(
org=self.course_org,
course=self.course_num
......
......@@ -119,7 +119,7 @@ class LibraryContentTestBase(UniqueCourseTest):
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.toggle_expand().unit(UNIT_NAME).go_to()
return subsection.expand_subsection().unit(UNIT_NAME).go_to()
def _goto_library_block_page(self, block_id=None):
"""
......
......@@ -4,8 +4,6 @@ Test courseware search
import os
import json
from flaky import flaky
from ..helpers import UniqueCourseTest
from ...pages.common.logout import LogoutPage
from ...pages.studio.utils import add_html_component, click_css, type_in_codemirror
......@@ -99,7 +97,7 @@ class CoursewareSearchTest(UniqueCourseTest):
"""
self.course_outline.visit()
subsection = self.course_outline.section_at(section_index).subsection_at(0)
subsection.toggle_expand()
subsection.expand_subsection()
unit = subsection.unit_at(0)
unit.publish()
......@@ -119,7 +117,7 @@ class CoursewareSearchTest(UniqueCourseTest):
# create a unit in course outline
self.course_outline.visit()
subsection = self.course_outline.section_at(section_index).subsection_at(0)
subsection.toggle_expand()
subsection.expand_subsection()
subsection.add_unit()
# got to unit and create an HTML component and save (not publish)
......@@ -167,7 +165,6 @@ class CoursewareSearchTest(UniqueCourseTest):
self.courseware_search_page.search_for_term(self.SEARCH_STRING)
assert self.SEARCH_STRING in self.courseware_search_page.search_results.html[0]
@flaky # TODO fix this, see SOL-336
def test_reindex(self):
"""
Make sure new content gets reindexed on button press.
......
......@@ -93,7 +93,7 @@ class ContainerBase(StudioCourseTest):
"""
self.outline.visit()
subsection = self.outline.section(section_name).subsection(subsection_name)
return subsection.toggle_expand().unit(unit_name).go_to()
return subsection.expand_subsection().unit(unit_name).go_to()
def do_action_and_verify(self, action, expected_ordering):
"""
......
......@@ -69,7 +69,7 @@ class XBlockAcidBase(WebAppTest):
self.outline.visit()
subsection = self.outline.section('Test Section').subsection('Test Subsection')
unit = subsection.toggle_expand().unit('Test Unit').go_to()
unit = subsection.expand_subsection().unit('Test Unit').go_to()
acid_block = AcidView(self.browser, unit.xblocks[0].preview_selector)
self.validate_acid_block_preview(acid_block)
......@@ -81,7 +81,7 @@ class XBlockAcidBase(WebAppTest):
self.outline.visit()
subsection = self.outline.section('Test Section').subsection('Test Subsection')
unit = subsection.toggle_expand().unit('Test Unit').go_to()
unit = subsection.expand_subsection().unit('Test Unit').go_to()
acid_block = AcidView(self.browser, unit.xblocks[0].edit().editor_selector)
self.assertTrue(acid_block.init_fn_passed)
......@@ -133,7 +133,7 @@ class XBlockAcidParentBase(XBlockAcidBase):
self.outline.visit()
subsection = self.outline.section('Test Section').subsection('Test Subsection')
unit = subsection.toggle_expand().unit('Test Unit').go_to()
unit = subsection.expand_subsection().unit('Test Unit').go_to()
container = unit.xblocks[0].go_to_container()
acid_block = AcidView(self.browser, container.xblocks[0].preview_selector)
......
......@@ -131,7 +131,7 @@ class DiscussionPreviewTest(StudioCourseTest):
self.course_info['run']
)
cop.visit()
self.unit = cop.section('Test Section').subsection('Test Subsection').toggle_expand().unit('Test Unit')
self.unit = cop.section('Test Section').subsection('Test Subsection').expand_subsection().unit('Test Unit')
self.unit.go_to()
def populate_course_fixture(self, course_fixture):
......
......@@ -40,7 +40,7 @@ class StudioLibraryContainerTest(StudioLibraryTest, UniqueCourseTest):
self.outline.visit()
subsection = self.outline.section(SECTION_NAME).subsection(SUBSECTION_NAME)
self.unit_page = subsection.toggle_expand().unit(UNIT_NAME).go_to()
self.unit_page = subsection.expand_subsection().unit(UNIT_NAME).go_to()
def populate_library_fixture(self, library_fixture):
"""
......
......@@ -292,7 +292,7 @@ class WarningMessagesTest(CourseOutlineTest):
self.course_outline_page.visit()
section = self.course_outline_page.section(unit_state.name)
subsection = section.subsection_at(0)
subsection.toggle_expand()
subsection.expand_subsection()
unit = subsection.unit_at(0)
if expected_status_message == self.STAFF_ONLY_WARNING:
self.assertEqual(section.status_message, self.STAFF_ONLY_WARNING)
......@@ -314,7 +314,7 @@ class WarningMessagesTest(CourseOutlineTest):
name = unit_state.name
self.course_outline_page.visit()
subsection = self.course_outline_page.section(name).subsection(name)
subsection.toggle_expand()
subsection.expand_subsection()
if unit_state.publish_state == self.PublishState.UNPUBLISHED_CHANGES:
unit = subsection.unit(name).go_to()
......@@ -962,7 +962,7 @@ class EditNamesTest(CourseOutlineTest):
Then the section is collapsed
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).toggle_expand()
self.course_outline_page.section_at(0).expand_subsection()
self.assertFalse(self.course_outline_page.section_at(0).in_editable_form())
self.assertTrue(self.course_outline_page.section_at(0).is_collapsed)
self.course_outline_page.section_at(0).edit_name()
......@@ -1138,7 +1138,7 @@ class DeleteContentTest(CourseOutlineTest):
And the unit should immediately be deleted from the course outline
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).subsection_at(0).toggle_expand()
self.course_outline_page.section_at(0).subsection_at(0).expand_subsection()
self.assertEqual(len(self.course_outline_page.section_at(0).subsection_at(0).units()), 1)
self.course_outline_page.section_at(0).subsection_at(0).unit_at(0).delete()
self.assertEqual(len(self.course_outline_page.section_at(0).subsection_at(0).units()), 0)
......@@ -1153,7 +1153,7 @@ class DeleteContentTest(CourseOutlineTest):
And the unit should remain in the course outline
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).subsection_at(0).toggle_expand()
self.course_outline_page.section_at(0).subsection_at(0).expand_subsection()
self.assertEqual(len(self.course_outline_page.section_at(0).subsection_at(0).units()), 1)
self.course_outline_page.section_at(0).subsection_at(0).unit_at(0).delete(cancel=True)
self.assertEqual(len(self.course_outline_page.section_at(0).subsection_at(0).units()), 1)
......@@ -1208,7 +1208,7 @@ class ExpandCollapseMultipleSectionsTest(CourseOutlineTest):
Toggles the expand collapse state of all sections.
"""
for section in self.course_outline_page.sections():
section.toggle_expand()
section.expand_subsection()
def test_expanded_by_default(self):
"""
......@@ -1265,7 +1265,7 @@ class ExpandCollapseMultipleSectionsTest(CourseOutlineTest):
"""
self.course_outline_page.visit()
self.verify_all_sections(collapsed=False)
self.course_outline_page.section_at(0).toggle_expand()
self.course_outline_page.section_at(0).expand_subsection()
self.course_outline_page.toggle_expand_collapse()
self.assertEquals(self.course_outline_page.expand_collapse_link_state, ExpandCollapseLinkState.EXPAND)
self.verify_all_sections(collapsed=True)
......@@ -1299,7 +1299,7 @@ class ExpandCollapseMultipleSectionsTest(CourseOutlineTest):
self.course_outline_page.visit()
self.course_outline_page.toggle_expand_collapse()
self.assertEquals(self.course_outline_page.expand_collapse_link_state, ExpandCollapseLinkState.EXPAND)
self.course_outline_page.section_at(0).toggle_expand()
self.course_outline_page.section_at(0).expand_subsection()
self.course_outline_page.toggle_expand_collapse()
self.assertEquals(self.course_outline_page.expand_collapse_link_state, ExpandCollapseLinkState.COLLAPSE)
self.verify_all_sections(collapsed=False)
......@@ -1449,7 +1449,7 @@ class UnitNavigationTest(CourseOutlineTest):
Then I will be taken to the appropriate unit page
"""
self.course_outline_page.visit()
self.course_outline_page.section_at(0).subsection_at(0).toggle_expand()
self.course_outline_page.section_at(0).subsection_at(0).expand_subsection()
unit = self.course_outline_page.section_at(0).subsection_at(0).unit_at(0).go_to()
self.assertTrue(unit.is_browser_on_page)
......@@ -1575,6 +1575,6 @@ class PublishSectionTest(CourseOutlineTest):
"""
section = self.course_outline_page.section(SECTION_NAME)
subsection = section.subsection(SUBSECTION_NAME)
unit = subsection.toggle_expand().unit(UNIT_NAME)
unit = subsection.expand_subsection().unit(UNIT_NAME)
return (section, subsection, unit)
......@@ -94,7 +94,7 @@ class CourseRerunTest(StudioCourseTest):
EmptyPromise(lambda: not outline_page.has_rerun_notification, "Rerun notification dismissed").fulfill()
subsection = outline_page.section(self.SECTION_NAME).subsection(self.SUBSECITON_NAME)
subsection.toggle_expand()
subsection.expand_subsection()
unit_page = subsection.unit(self.UNIT_NAME).go_to()
unit_page.view_published_version()
......
......@@ -53,7 +53,7 @@ class ORAComponentTest(StudioCourseTest):
def _go_to_unit_page(self, section_name='Test Section', subsection_name='Test Subsection', unit_name='Test Unit'):
self.course_outline_page.visit()
subsection = self.course_outline_page.section(section_name).subsection(subsection_name)
return subsection.toggle_expand().unit(unit_name).go_to()
return subsection.expand_subsection().unit(unit_name).go_to()
def test_edit_save_and_export(self):
"""
......
......@@ -83,7 +83,7 @@ class CMSVideoBaseTest(UniqueCourseTest):
self.outline.visit()
# Visit Unit page
self.unit_page = self.outline.section('Test Section').subsection('Test Subsection').toggle_expand().unit(
self.unit_page = self.outline.section('Test Section').subsection('Test Subsection').expand_subsection().unit(
'Test Unit').go_to()
self.video.wait_for_video_component_render()
......
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