From 1d07b278b5ce45843afb6d31026c3bc2adb689f8 Mon Sep 17 00:00:00 2001 From: Chris Rodriguez Date: Fri, 21 Aug 2015 10:02:39 -0400 Subject: [PATCH] Test fixes --- common/test/acceptance/pages/lms/course_nav.py | 12 ++++++------ common/test/acceptance/pages/lms/courseware.py | 4 ++-- common/test/acceptance/tests/lms/test_lms.py | 2 +- lms/static/js/fixtures/accordion.html | 12 ++++++------ lms/static/js/utils/navigation.js | 6 +----- 5 files changed, 16 insertions(+), 20 deletions(-) diff --git a/common/test/acceptance/pages/lms/course_nav.py b/common/test/acceptance/pages/lms/course_nav.py index 36b5171240..5834ba307b 100644 --- a/common/test/acceptance/pages/lms/course_nav.py +++ b/common/test/acceptance/pages/lms/course_nav.py @@ -82,7 +82,7 @@ class CourseNavPage(PageObject): # Click the section to ensure it's open (no harm in clicking twice if it's already open) # Add one to convert from list index to CSS index - section_css = 'nav>div.chapter:nth-of-type({0})'.format(sec_index + 1) + section_css = 'nav>.chapter:nth-of-type({0})'.format(sec_index + 1) self.q(css=section_css).first.click() # Get the subsection by index @@ -94,7 +94,7 @@ class CourseNavPage(PageObject): return # Convert list indices (start at zero) to CSS indices (start at 1) - subsection_css = "nav>div.chapter-content-container:nth-of-type({0})>div>ol>li:nth-of-type({1})>a".format( + subsection_css = "nav>.chapter-content-container:nth-of-type({0})>.chapter-menu:nth-of-type({1})>a".format( sec_index + 1, subsec_index + 1 ) @@ -130,7 +130,7 @@ class CourseNavPage(PageObject): """ Return a list of all section titles on the page. """ - chapter_css = 'nav > button.chapter > h3' + chapter_css = 'nav > .chapter > .group-heading' return self.q(css=chapter_css).map(lambda el: el.text.strip()).results def _subsection_titles(self, section_index): @@ -140,7 +140,7 @@ class CourseNavPage(PageObject): """ # Retrieve the subsection title for the section # Add one to the list index to get the CSS index, which starts at one - subsection_css = 'nav>.chapter-content-container:nth-of-type({0})>div>ol>li>a>p:nth-of-type(1)'.format( + subsection_css = 'nav>.chapter-content-container:nth-of-type({0})>.chapter-menu>a>p:nth-of-type(1)'.format( section_index ) @@ -173,8 +173,8 @@ class CourseNavPage(PageObject): That's true right after we click the section/subsection, but not true in general (the user could go to a section, then expand another tab). """ - current_section_list = self.q(css='nav>button.chapter.is-open>h3').text - current_subsection_list = self.q(css='nav div.chapter-content-container ol li.active>a>p').text + current_section_list = self.q(css='nav>.chapter.is-open>.group-heading').text + current_subsection_list = self.q(css='nav .chapter-content-container a.active>p').text if len(current_section_list) == 0: self.warning("Could not find the current section") diff --git a/common/test/acceptance/pages/lms/courseware.py b/common/test/acceptance/pages/lms/courseware.py index 292917f3fb..220f65dc84 100644 --- a/common/test/acceptance/pages/lms/courseware.py +++ b/common/test/acceptance/pages/lms/courseware.py @@ -14,7 +14,7 @@ class CoursewarePage(CoursePage): url_path = "courseware/" xblock_component_selector = '.vert .xblock' section_selector = '.chapter' - subsection_selector = '.chapter-content-container ol li' + subsection_selector = '.chapter-content-container .chapter-menu a' def is_browser_on_page(self): return self.q(css='body.courseware').present @@ -102,7 +102,7 @@ class CoursewarePage(CoursePage): """ return the url of the active subsection in the left nav """ - return self.q(css='.chapter-content-container ol li.active a').attrs('href')[0] + return self.q(css='.chapter-content-container .chapter-menu a.active').attrs('href')[0] @property def can_start_proctored_exam(self): diff --git a/common/test/acceptance/tests/lms/test_lms.py b/common/test/acceptance/tests/lms/test_lms.py index 8eae4bbdc1..cf20ee8efe 100644 --- a/common/test/acceptance/tests/lms/test_lms.py +++ b/common/test/acceptance/tests/lms/test_lms.py @@ -1121,7 +1121,7 @@ class EntranceExamTest(UniqueCourseTest): When I view the courseware that has an entrance exam Then there should be an "Entrance Exam" chapter.' """ - entrance_exam_link_selector = 'div#accordion nav button h3' + entrance_exam_link_selector = '#accordion nav .chapter .group-heading' # visit courseware page and make sure there is not entrance exam chapter. self.courseware_page.visit() self.courseware_page.wait_for_page() diff --git a/lms/static/js/fixtures/accordion.html b/lms/static/js/fixtures/accordion.html index 40cb03a7c0..e236b40169 100644 --- a/lms/static/js/fixtures/accordion.html +++ b/lms/static/js/fixtures/accordion.html @@ -10,14 +10,14 @@
- +

edX Homepage

Ungraded

- +

The edX Blog

- +

Courses Dashboard

Graded

@@ -30,14 +30,14 @@