Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
9810b5fd
Commit
9810b5fd
authored
Mar 20, 2017
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update bok choy tests for new bookmarks page.
parent
91d227f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
29 deletions
+25
-29
common/test/acceptance/pages/lms/bookmarks.py
+4
-10
common/test/acceptance/pages/lms/courseware.py
+6
-0
common/test/acceptance/tests/lms/test_bookmarks.py
+15
-19
No files found.
common/test/acceptance/pages/lms/bookmarks.py
View file @
9810b5fd
...
...
@@ -10,29 +10,23 @@ class BookmarksPage(CoursePage, PaginatedUIMixin):
"""
Courseware Bookmarks Page.
"""
url
=
None
url_path
=
"courseware/"
url_path
=
"bookmarks"
BOOKMARKS_BUTTON_SELECTOR
=
'.bookmarks-list-button'
BOOKMARKS_ELEMENT_SELECTOR
=
'#my-bookmarks'
BOOKMARKED_ITEMS_SELECTOR
=
'.bookmarks-results-list .bookmarks-results-list-item'
BOOKMARKED_BREADCRUMBS
=
BOOKMARKED_ITEMS_SELECTOR
+
' .list-item-breadcrumbtrail'
def
is_browser_on_page
(
self
):
""" Verify if we are on correct page """
return
self
.
q
(
css
=
self
.
BOOKMARKS_
BUTTON_SELECTOR
)
.
visible
return
self
.
q
(
css
=
self
.
BOOKMARKS_
ELEMENT_SELECTOR
)
.
present
def
bookmarks_button_visible
(
self
):
""" Check if bookmarks button is visible """
return
self
.
q
(
css
=
self
.
BOOKMARKS_BUTTON_SELECTOR
)
.
visible
def
click_bookmarks_button
(
self
,
wait_for_results
=
True
):
""" Click on Bookmarks button """
self
.
q
(
css
=
self
.
BOOKMARKS_BUTTON_SELECTOR
)
.
first
.
click
()
if
wait_for_results
:
EmptyPromise
(
self
.
results_present
,
"Bookmarks results present"
)
.
fulfill
()
def
results_present
(
self
):
""" Check if bookmarks results are present """
return
self
.
q
(
css
=
'#my-bookmarks'
)
.
present
return
self
.
q
(
css
=
self
.
BOOKMARKS_ELEMENT_SELECTOR
)
.
present
def
results_header_text
(
self
):
""" Returns the bookmarks results header text """
...
...
common/test/acceptance/pages/lms/courseware.py
View file @
9810b5fd
...
...
@@ -310,6 +310,12 @@ class CoursewarePage(CoursePage):
self
.
q
(
css
=
'.bookmark-button'
)
.
first
.
click
()
EmptyPromise
(
lambda
:
self
.
bookmark_button_state
!=
previous_state
,
"Bookmark button toggled"
)
.
fulfill
()
def
click_bookmarks_button
(
self
,
wait_for_results
=
True
):
""" Click on Bookmarks button """
self
.
q
(
css
=
'.bookmarks-list-button'
)
.
first
.
click
()
if
wait_for_results
:
EmptyPromise
(
lambda
:
self
.
q
(
css
=
'#my-bookmarks'
)
.
present
,
"Bookmarks results present"
)
.
fulfill
()
class
CoursewareSequentialTabPage
(
CoursePage
):
"""
...
...
common/test/acceptance/tests/lms/test_bookmarks.py
View file @
9810b5fd
...
...
@@ -187,7 +187,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
courseware_page
.
click_bookmark_unit_button
()
self
.
assertEqual
(
self
.
courseware_page
.
bookmark_icon_visible
,
bookmark_icon_state
)
self
.
assertEqual
(
self
.
courseware_page
.
bookmark_button_state
,
bookmark_button_state
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertEqual
(
self
.
bookmarks_page
.
count
(),
bookmarked_count
)
def
_verify_pagination_info
(
...
...
@@ -213,9 +213,8 @@ class BookmarksTest(BookmarksTestMixin):
"""
Navigates and verifies the bookmarks list page.
"""
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
assertEqual
(
self
.
bookmarks_page
.
results_header_text
(),
'My Bookmarks'
)
def
_verify_breadcrumbs
(
self
,
num_units
,
modified_name
=
None
):
"""
...
...
@@ -271,7 +270,8 @@ class BookmarksTest(BookmarksTestMixin):
self
.
course_home_page
.
outline
.
go_to_section
(
'TestSection{}'
.
format
(
index
),
'TestSubsection{}'
.
format
(
index
))
self
.
_toggle_bookmark_and_verify
(
True
,
'bookmarked'
,
1
)
self
.
bookmarks_page
.
click_bookmarks_button
(
False
)
self
.
course_home_page
.
visit
()
self
.
course_home_page
.
outline
.
go_to_section
(
'TestSection{}'
.
format
(
index
),
'TestSubsection{}'
.
format
(
index
))
self
.
_toggle_bookmark_and_verify
(
False
,
''
,
0
)
def
test_empty_bookmarks_list
(
self
):
...
...
@@ -286,14 +286,10 @@ class BookmarksTest(BookmarksTestMixin):
And empty bookmarks list content is correct
"""
self
.
_test_setup
()
self
.
assertTrue
(
self
.
bookmarks_page
.
bookmarks_button_visible
())
self
.
bookmarks_page
.
click_bookmarks_button
()
self
.
assertEqual
(
self
.
bookmarks_page
.
results_header_text
(),
'My Bookmarks'
)
self
.
assertEqual
(
self
.
bookmarks_page
.
empty_header_text
(),
'You have not bookmarked any courseware pages yet.'
)
empty_list_text
=
(
"Use bookmarks to help you easily return to courseware pages. To bookmark a page, "
"select Bookmark in the upper right corner of that page. To see a list of all your "
"bookmarks, select Bookmarks in the upper left corner of any courseware page."
)
self
.
courseware_page
.
click_bookmarks_button
()
empty_list_text
=
(
"Use bookmarks to help you easily return to courseware pages. "
"To bookmark a page, click on
\"
Bookmark this page
\"
beneath the unit title."
)
self
.
assertEqual
(
self
.
bookmarks_page
.
empty_list_text
(),
empty_list_text
)
def
test_bookmarks_list
(
self
):
...
...
@@ -333,7 +329,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
courseware_page
.
wait_for_page
()
self
.
assertIn
(
self
.
courseware_page
.
active_usage_id
(),
xblock_usage_ids
)
self
.
courseware_page
.
visit
()
.
wait_for_page
()
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
def
test_bookmark_shows_updated_breadcrumb_after_publish
(
self
):
"""
...
...
@@ -445,7 +441,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
_test_setup
(
num_chapters
=
2
)
self
.
_bookmark_units
(
num_units
=
2
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
_verify_pagination_info
(
bookmark_count_on_current_page
=
2
,
...
...
@@ -476,7 +472,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
_test_setup
(
num_chapters
=
12
)
self
.
_bookmark_units
(
num_units
=
12
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
_verify_pagination_info
(
...
...
@@ -519,7 +515,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
_test_setup
(
num_chapters
=
12
)
self
.
_bookmark_units
(
num_units
=
12
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
bookmarks_page
.
press_next_page_button
()
...
...
@@ -559,7 +555,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
_test_setup
(
num_chapters
=
11
)
self
.
_bookmark_units
(
num_units
=
11
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
assertEqual
(
self
.
bookmarks_page
.
get_total_pages
,
2
)
...
...
@@ -589,7 +585,7 @@ class BookmarksTest(BookmarksTestMixin):
self
.
_test_setup
(
num_chapters
=
11
)
self
.
_bookmark_units
(
num_units
=
11
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
assertTrue
(
self
.
bookmarks_page
.
results_present
())
self
.
assertEqual
(
self
.
bookmarks_page
.
get_total_pages
,
2
)
...
...
@@ -628,7 +624,7 @@ class BookmarksTest(BookmarksTestMixin):
}
]
self
.
_bookmark_units
(
num_units
=
1
)
self
.
bookmarks
_page
.
click_bookmarks_button
()
self
.
courseware
_page
.
click_bookmarks_button
()
self
.
_verify_pagination_info
(
bookmark_count_on_current_page
=
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment