Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
c82e4ede
Commit
c82e4ede
authored
11 years ago
by
Will Daly
Browse files
Options
Downloads
Plain Diff
Merge pull request #2492 from edx/will/really-fix-tab-nav-test
Skip page check in promise for Tab Nav in bok-choy suite
parents
3336cc76
28c33a4f
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/test/acceptance/pages/lms/tab_nav.py
+21
-9
21 additions, 9 deletions
common/test/acceptance/pages/lms/tab_nav.py
with
21 additions
and
9 deletions
common/test/acceptance/pages/lms/tab_nav.py
+
21
−
9
View file @
c82e4ede
...
...
@@ -36,15 +36,10 @@ class TabNavPage(PageObject):
def
is_on_tab
(
self
,
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
'
)
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
)
return
self
.
_is_on_tab
(
tab_name
)
def
_tab_css
(
self
,
tab_name
):
"""
...
...
@@ -73,11 +68,28 @@ class TabNavPage(PageObject):
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
):
"""
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
(
lambda
:
self
.
is_on_tab
(
tab_name
),
lambda
:
self
.
_
is_on_tab
(
tab_name
),
"
{0} is the current tab
"
.
format
(
tab_name
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment