Fixes after rebase to Django 1.8
This commit is contained in:
committed by
muzaffaryousaf
parent
3792943960
commit
8bdc097293
@@ -12,11 +12,12 @@ class CoursewareSearchPage(CoursePage):
|
||||
|
||||
url_path = "courseware/"
|
||||
search_bar_selector = '#courseware-search-bar'
|
||||
search_results_selector = '.courseware-results'
|
||||
|
||||
@property
|
||||
def search_results(self):
|
||||
""" search results list showing """
|
||||
return self.q(css='.courseware-results')
|
||||
return self.q(css=self.search_results_selector)
|
||||
|
||||
def is_browser_on_page(self):
|
||||
""" did we find the search bar in the UI """
|
||||
@@ -30,6 +31,7 @@ class CoursewareSearchPage(CoursePage):
|
||||
""" execute the search """
|
||||
self.q(css=self.search_bar_selector + ' [type="submit"]').click()
|
||||
self.wait_for_ajax()
|
||||
self.wait_for_element_visibility(self.search_results_selector, 'Search results are visible')
|
||||
|
||||
def search_for_term(self, text):
|
||||
"""
|
||||
|
||||
@@ -207,14 +207,13 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
self.assertEqual(self.bookmarks_page.get_current_page_number(), current_page_number)
|
||||
self.assertEqual(self.bookmarks_page.get_total_pages, total_pages)
|
||||
|
||||
def _navigate_and_verify_bookmarks_list(self, bookmarks_count):
|
||||
def _navigate_to_bookmarks_list(self):
|
||||
"""
|
||||
Navigates and verifies the bookmarks list page.
|
||||
"""
|
||||
self.bookmarks_page.click_bookmarks_button()
|
||||
self.assertTrue(self.bookmarks_page.results_present())
|
||||
self.assertEqual(self.bookmarks_page.results_header_text(), 'MY BOOKMARKS')
|
||||
self.assertEqual(self.bookmarks_page.count(), bookmarks_count)
|
||||
|
||||
def _verify_breadcrumbs(self, num_units, modified_name=None):
|
||||
"""
|
||||
@@ -310,6 +309,9 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
self._test_setup()
|
||||
self._bookmark_units(2)
|
||||
|
||||
self._navigate_to_bookmarks_list()
|
||||
self._verify_breadcrumbs(num_units=2)
|
||||
|
||||
self._verify_pagination_info(
|
||||
bookmark_count_on_current_page=2,
|
||||
header_text='Showing 1-2 out of 2 total',
|
||||
@@ -319,9 +321,6 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
total_pages=1
|
||||
)
|
||||
|
||||
self._navigate_and_verify_bookmarks_list(bookmarks_count=2)
|
||||
self._verify_breadcrumbs(num_units=2)
|
||||
|
||||
# get usage ids for units
|
||||
xblocks = self.course_fixture.get_nested_xblocks(category="vertical")
|
||||
xblock_usage_ids = [xblock.locator for xblock in xblocks]
|
||||
@@ -329,7 +328,7 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
for index in range(2):
|
||||
self.bookmarks_page.click_bookmarked_block(index)
|
||||
self.courseware_page.wait_for_page()
|
||||
self.assertTrue(self.courseware_page.active_usage_id() in xblock_usage_ids)
|
||||
self.assertIn(self.courseware_page.active_usage_id(), xblock_usage_ids)
|
||||
self.courseware_page.visit().wait_for_page()
|
||||
self.bookmarks_page.click_bookmarks_button()
|
||||
|
||||
@@ -352,11 +351,11 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
self._test_setup(num_chapters=1)
|
||||
self._bookmark_units(num_units=1)
|
||||
|
||||
self._navigate_and_verify_bookmarks_list(bookmarks_count=1)
|
||||
self._navigate_to_bookmarks_list()
|
||||
self._verify_breadcrumbs(num_units=1)
|
||||
|
||||
LogoutPage(self.browser).visit()
|
||||
AutoAuthPage(
|
||||
LmsAutoAuthPage(
|
||||
self.browser,
|
||||
username=self.USERNAME,
|
||||
email=self.EMAIL,
|
||||
@@ -368,10 +367,10 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
self.update_and_publish_block_display_name(modified_name)
|
||||
|
||||
LogoutPage(self.browser).visit()
|
||||
AutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id).visit()
|
||||
LmsAutoAuthPage(self.browser, username=self.USERNAME, email=self.EMAIL, course_id=self.course_id).visit()
|
||||
self.courseware_page.visit()
|
||||
|
||||
self._navigate_and_verify_bookmarks_list(bookmarks_count=1)
|
||||
self._navigate_to_bookmarks_list()
|
||||
self._verify_breadcrumbs(num_units=1, modified_name=modified_name)
|
||||
|
||||
def test_unreachable_bookmark(self):
|
||||
@@ -387,15 +386,15 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
When I click on deleted bookmark
|
||||
Then I should navigated to 404 page
|
||||
"""
|
||||
self._test_setup()
|
||||
self._bookmark_units(2)
|
||||
self._test_setup(num_chapters=1)
|
||||
self._bookmark_units(1)
|
||||
self._delete_section(0)
|
||||
|
||||
self._navigate_and_verify_bookmarks_list(bookmarks_count=2)
|
||||
self._navigate_to_bookmarks_list()
|
||||
|
||||
self._verify_pagination_info(
|
||||
bookmark_count_on_current_page=2,
|
||||
header_text='Showing 1-2 out of 2 total',
|
||||
bookmark_count_on_current_page=1,
|
||||
header_text='Showing 1 out of 1 total',
|
||||
previous_button_enabled=False,
|
||||
next_button_enabled=False,
|
||||
current_page_number=1,
|
||||
@@ -418,7 +417,7 @@ class BookmarksTest(BookmarksTestMixin):
|
||||
"""
|
||||
self._test_setup(11)
|
||||
self._bookmark_units(11)
|
||||
self._navigate_and_verify_bookmarks_list(bookmarks_count=11)
|
||||
self._navigate_to_bookmarks_list()
|
||||
|
||||
self._verify_pagination_info(
|
||||
bookmark_count_on_current_page=10,
|
||||
|
||||
@@ -68,14 +68,6 @@ class CoursewareTest(UniqueCourseTest):
|
||||
self.problem_page = ProblemPage(self.browser)
|
||||
self.assertEqual(self.problem_page.problem_name, 'TEST PROBLEM 1')
|
||||
|
||||
def _change_problem_release_date_in_studio(self):
|
||||
"""
|
||||
|
||||
"""
|
||||
self.course_outline.q(css=".subsection-header-actions .configure-button").first.click()
|
||||
self.course_outline.q(css="#start_date").fill("01/01/2030")
|
||||
self.course_outline.q(css=".action-save").first.click()
|
||||
|
||||
def _create_breadcrumb(self, index):
|
||||
""" Create breadcrumb """
|
||||
return ['Test Section {}'.format(index), 'Test Subsection {}'.format(index), 'Test Problem {}'.format(index)]
|
||||
@@ -105,9 +97,6 @@ class CoursewareTest(UniqueCourseTest):
|
||||
# Set release date for subsection in future.
|
||||
self.course_outline.change_problem_release_date_in_studio()
|
||||
|
||||
# Wait for 2 seconds to save new date.
|
||||
time.sleep(2)
|
||||
|
||||
# Logout and login as a student.
|
||||
LogoutPage(self.browser).visit()
|
||||
self._auto_auth(self.USERNAME, self.EMAIL, False)
|
||||
@@ -117,6 +106,23 @@ class CoursewareTest(UniqueCourseTest):
|
||||
# Problem name should be "TEST PROBLEM 2".
|
||||
self.assertEqual(self.problem_page.problem_name, 'TEST PROBLEM 2')
|
||||
|
||||
def test_course_tree_breadcrumb(self):
|
||||
"""
|
||||
Scenario: Correct course tree breadcrumb is shown.
|
||||
|
||||
Given that I am a registered user
|
||||
And I visit my courseware page
|
||||
Then I should see correct course tree breadcrumb
|
||||
"""
|
||||
self.courseware_page.visit()
|
||||
|
||||
xblocks = self.course_fix.get_nested_xblocks(category="problem")
|
||||
for index in range(1, len(xblocks) + 1):
|
||||
self.course_nav.go_to_section('Test Section {}'.format(index), 'Test Subsection {}'.format(index))
|
||||
courseware_page_breadcrumb = self.courseware_page.breadcrumb
|
||||
expected_breadcrumb = self._create_breadcrumb(index) # pylint: disable=no-member
|
||||
self.assertEqual(courseware_page_breadcrumb, expected_breadcrumb)
|
||||
|
||||
|
||||
class ProctoredExamTest(UniqueCourseTest):
|
||||
"""
|
||||
@@ -262,23 +268,6 @@ class ProctoredExamTest(UniqueCourseTest):
|
||||
self.courseware_page.start_timed_exam()
|
||||
self.assertTrue(self.courseware_page.is_timer_bar_present)
|
||||
|
||||
def test_course_tree_breadcrumb(self):
|
||||
"""
|
||||
Scenario: Correct course tree breadcrumb is shown.
|
||||
|
||||
Given that I am a registered user
|
||||
And I visit my courseware page
|
||||
Then I should see correct course tree breadcrumb
|
||||
"""
|
||||
self.courseware_page.visit()
|
||||
|
||||
xblocks = self.course_fix.get_nested_xblocks(category="problem")
|
||||
for index in range(1, len(xblocks) + 1):
|
||||
self.course_nav.go_to_section('Test Section {}'.format(index), 'Test Subsection {}'.format(index))
|
||||
courseware_page_breadcrumb = self.courseware_page.breadcrumb
|
||||
expected_breadcrumb = self._create_breadcrumb(index)
|
||||
self.assertEqual(courseware_page_breadcrumb, expected_breadcrumb)
|
||||
|
||||
def test_time_allotted_field_is_not_visible_with_none_exam(self):
|
||||
"""
|
||||
Given that I am a staff member
|
||||
|
||||
Reference in New Issue
Block a user