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
28c33a4f
Commit
28c33a4f
authored
Feb 06, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip page check in promise for Tab Nav in bok-choy suite
parent
70f064e5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
common/test/acceptance/pages/lms/tab_nav.py
+21
-9
No files found.
common/test/acceptance/pages/lms/tab_nav.py
View file @
28c33a4f
...
@@ -36,15 +36,10 @@ class TabNavPage(PageObject):
...
@@ -36,15 +36,10 @@ class TabNavPage(PageObject):
def
is_on_tab
(
self
,
tab_name
):
def
is_on_tab
(
self
,
tab_name
):
"""
"""
Return a boolean indicating whether the current tab is `tab_name`.
Return a boolean indicating whether the current tab is `tab_name`.
Because this is a public method, it checks that we're on the right page
before accessing the DOM.
"""
"""
current_tab_list
=
self
.
css_text
(
'ol.course-tabs>li>a.active'
)
return
self
.
_is_on_tab
(
tab_name
)
if
len
(
current_tab_list
)
==
0
:
self
.
warning
(
"Could not find current tab"
)
return
False
else
:
return
(
current_tab_list
[
0
]
.
strip
()
.
split
(
'
\n
'
)[
0
]
==
tab_name
)
def
_tab_css
(
self
,
tab_name
):
def
_tab_css
(
self
,
tab_name
):
"""
"""
...
@@ -73,11 +68,28 @@ class TabNavPage(PageObject):
...
@@ -73,11 +68,28 @@ class TabNavPage(PageObject):
return
fulfill
(
Promise
(
_check_func
,
"Get all tab names"
))
return
fulfill
(
Promise
(
_check_func
,
"Get all tab names"
))
def
_is_on_tab
(
self
,
tab_name
):
"""
Return a boolean indicating whether the current tab is `tab_name`.
This is a private method, so it does NOT enforce the page check,
which is what we want when we're polling the DOM in a promise.
"""
current_tab_list
=
self
.
css_text
(
'ol.course-tabs>li>a.active'
)
if
len
(
current_tab_list
)
==
0
:
self
.
warning
(
"Could not find current tab"
)
return
False
else
:
return
(
current_tab_list
[
0
]
.
strip
()
.
split
(
'
\n
'
)[
0
]
==
tab_name
)
def
_is_on_tab_promise
(
self
,
tab_name
):
def
_is_on_tab_promise
(
self
,
tab_name
):
"""
"""
Return a `Promise` that the user is on the tab `tab_name`.
Return a `Promise` that the user is on the tab `tab_name`.
"""
"""
# Use the private version of _is_on_tab to skip the page check
return
EmptyPromise
(
return
EmptyPromise
(
lambda
:
self
.
is_on_tab
(
tab_name
),
lambda
:
self
.
_
is_on_tab
(
tab_name
),
"{0} is the current tab"
.
format
(
tab_name
)
"{0} is the current tab"
.
format
(
tab_name
)
)
)
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