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
3683ee7f
Commit
3683ee7f
authored
Sep 08, 2016
by
Muddasser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Help Links second pass
parent
c64d9aaa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
13 deletions
+52
-13
common/test/acceptance/pages/studio/container.py
+2
-1
common/test/acceptance/pages/studio/course_page.py
+12
-2
common/test/acceptance/pages/studio/index.py
+9
-1
common/test/acceptance/pages/studio/users.py
+18
-2
common/test/acceptance/pages/studio/utils.py
+7
-5
common/test/acceptance/tests/helpers.py
+4
-2
common/test/acceptance/tests/studio/test_studio_help.py
+0
-0
No files found.
common/test/acceptance/pages/studio/container.py
View file @
3683ee7f
...
...
@@ -5,13 +5,14 @@ Container page in Studio
from
bok_choy.page_object
import
PageObject
from
bok_choy.promise
import
Promise
,
EmptyPromise
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio.utils
import
HelpMixin
from
common.test.acceptance.pages.common.utils
import
click_css
,
confirm_prompt
from
common.test.acceptance.pages.studio.utils
import
type_in_codemirror
class
ContainerPage
(
PageObject
):
class
ContainerPage
(
PageObject
,
HelpMixin
):
"""
Container page in Studio
"""
...
...
common/test/acceptance/pages/studio/course_page.py
View file @
3683ee7f
"""
Base class for pages specific to a course in Studio.
"""
from
abc
import
abstractmethod
import
os
from
opaque_keys.edx.locator
import
CourseLocator
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.pages.studio
import
BASE_URL
from
common.test.acceptance.pages.studio.utils
import
HelpMixin
class
CoursePage
(
PageObject
):
class
CoursePage
(
PageObject
,
HelpMixin
):
"""
Abstract base class for page objects specific to a course in Studio.
"""
...
...
@@ -17,6 +18,15 @@ class CoursePage(PageObject):
# Does not need to include the leading forward or trailing slash
url_path
=
""
@abstractmethod
def
is_browser_on_page
(
self
):
"""
Verifies browser is on the correct page.
Should be implemented in child classes.
"""
pass
def
__init__
(
self
,
browser
,
course_org
,
course_num
,
course_run
):
"""
Initialize the page object for the course located at
...
...
common/test/acceptance/pages/studio/index.py
View file @
3683ee7f
...
...
@@ -31,7 +31,7 @@ class HeaderMixin(object):
return
next_page
.
wait_for_page
()
class
IndexPage
(
PageObject
,
HeaderMixin
):
class
IndexPage
(
PageObject
,
HeaderMixin
,
HelpMixin
):
"""
Home page for Studio when not logged in.
"""
...
...
@@ -322,3 +322,11 @@ class DashboardPageWithPrograms(DashboardPage):
element
.
find_element_by_css_selector
(
'.course-org .value'
)
.
text
,
# org key
)
return
self
.
q
(
css
=
'div.programs-tab li.course-item'
)
.
map
(
div2info
)
.
results
def
click_new_program_button
(
self
):
"""
Click on the new program button.
"""
self
.
q
(
css
=
'.button.new-button.new-program-button'
)
.
click
()
self
.
wait_for_ajax
()
self
.
wait_for_element_visibility
(
".account-username"
,
"New program page is open"
)
common/test/acceptance/pages/studio/users.py
View file @
3683ee7f
"""
Page classes to test either the Course Team page or the Library Team page.
"""
import
os
from
opaque_keys.edx.locator
import
CourseLocator
from
bok_choy.promise
import
EmptyPromise
from
bok_choy.page_object
import
PageObject
from
common.test.acceptance.tests.helpers
import
disable_animations
...
...
@@ -164,13 +166,27 @@ class LibraryUsersPage(UsersPageMixin, HelpMixin):
return
"{}/library/{}/team/"
.
format
(
BASE_URL
,
unicode
(
self
.
locator
))
class
CourseTeamPage
(
CoursePage
,
UsersPageMixin
):
class
CourseTeamPage
(
UsersPageMixin
,
CoursePage
):
"""
Course Team page in Studio.
"""
url_path
=
"course_team"
@property
def
url
(
self
):
"""
Construct a URL to the page within the course.
"""
# TODO - is there a better way to make this agnostic to the underlying default module store?
default_store
=
os
.
environ
.
get
(
'DEFAULT_STORE'
,
'draft'
)
course_key
=
CourseLocator
(
self
.
course_info
[
'course_org'
],
self
.
course_info
[
'course_num'
],
self
.
course_info
[
'course_run'
],
deprecated
=
(
default_store
==
'draft'
)
)
return
"/"
.
join
([
BASE_URL
,
self
.
url_path
,
unicode
(
course_key
)])
class
UserWrapper
(
PageObject
):
"""
...
...
common/test/acceptance/pages/studio/utils.py
View file @
3683ee7f
...
...
@@ -12,7 +12,7 @@ from common.test.acceptance.pages.common.utils import click_css, wait_for_notifi
NAV_HELP_NOT_SIGNED_IN_CSS
=
'.nav-item.nav-not-signedin-help a'
NAV_HELP_CSS
=
'.nav-item.nav-account-help a'
SIDE_BAR_HELP_AS_LIST_ITEM
=
'.bit li.action-item a'
SIDE_BAR_HELP_CSS
=
'.
bit.external-help a
'
SIDE_BAR_HELP_CSS
=
'.
external-help a, .external-help-button
'
@js_defined
(
'window.jQuery'
)
...
...
@@ -282,10 +282,10 @@ class HelpMixin(object):
else
:
element_css
=
NAV_HELP_NOT_SIGNED_IN_CSS
self
.
q
(
css
=
element_css
)
.
click
()
self
.
q
(
css
=
element_css
)
.
first
.
click
()
return
self
.
q
(
css
=
element_css
)
.
results
[
0
]
def
get_side_bar_help_element_and_click_help
(
self
,
as_list_item
=
False
):
def
get_side_bar_help_element_and_click_help
(
self
,
as_list_item
=
False
,
index
=-
1
):
"""
Click on the help, and also get the DOM help element.
...
...
@@ -294,6 +294,8 @@ class HelpMixin(object):
Arguments:
as_list_item (bool): Indicates whether help element is
enclosed in a 'li' DOM element.
index (int): The index of element in case there are more than
one matching elements.
Returns:
WebElement: Help DOM element in the side bar.
...
...
@@ -304,5 +306,5 @@ class HelpMixin(object):
else
:
element_css
=
SIDE_BAR_HELP_CSS
self
.
q
(
css
=
element_css
)
.
click
()
return
self
.
q
(
css
=
element_css
)
.
results
[
0
]
self
.
q
(
css
=
element_css
)
.
results
[
index
]
.
click
()
return
self
.
q
(
css
=
element_css
)
.
results
[
index
]
common/test/acceptance/tests/helpers.py
View file @
3683ee7f
...
...
@@ -839,7 +839,7 @@ def assert_nav_help_link(test, page, href, signed_in=True):
assert_opened_help_link_is_correct
(
test
,
href
)
def
assert_side_bar_help_link
(
test
,
page
,
href
,
help_text
,
as_list_item
=
False
):
def
assert_side_bar_help_link
(
test
,
page
,
href
,
help_text
,
as_list_item
=
False
,
index
=-
1
):
"""
Asserts that help link in side bar is correct.
...
...
@@ -852,13 +852,15 @@ def assert_side_bar_help_link(test, page, href, help_text, as_list_item=False):
href (str): The help link which we expect to see when it is opened.
as_list_item (bool): Specifies whether help element is in one of the
'li' inside a sidebar list DOM element.
index (int): The index of element in case there are more than
one matching elements.
"""
expected_link
=
{
'href'
:
href
,
'text'
:
help_text
}
# Get actual anchor help element from the page.
actual_link
=
page
.
get_side_bar_help_element_and_click_help
(
as_list_item
)
actual_link
=
page
.
get_side_bar_help_element_and_click_help
(
as_list_item
=
as_list_item
,
index
=
index
)
# Assert that 'href' and text are the same as expected.
assert_link
(
test
,
expected_link
,
actual_link
)
# Assert that opened link is correct
...
...
common/test/acceptance/tests/studio/test_studio_help.py
View file @
3683ee7f
This diff is collapsed.
Click to expand it.
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