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
6e2e40cc
Commit
6e2e40cc
authored
Mar 20, 2015
by
Ben Patterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add course wiki acceptance tests.
parent
9edda950
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
155 additions
and
0 deletions
+155
-0
common/test/acceptance/pages/lms/course_wiki.py
+81
-0
common/test/acceptance/tests/lms/test_lms.py
+74
-0
No files found.
common/test/acceptance/pages/lms/course_wiki.py
0 → 100644
View file @
6e2e40cc
"""
Wiki tab on courses
"""
from
.course_page
import
CoursePage
from
...pages.studio.utils
import
type_in_codemirror
class
CourseWikiPage
(
CoursePage
):
"""
Course wiki navigation and objects.
"""
url_path
=
"wiki"
def
is_browser_on_page
(
self
):
"""
Browser is on the wiki page if the wiki breadcrumb is present
"""
return
self
.
q
(
css
=
'.breadcrumb'
)
.
present
def
open_editor
(
self
):
"""
Replace content of a wiki article with new content
"""
edit_button
=
self
.
q
(
css
=
'.fa-pencil'
)
edit_button
.
click
()
@property
def
article_name
(
self
):
"""
Return the name of the article
"""
return
str
(
self
.
q
(
css
=
'.main-article h1'
)
.
text
[
0
])
class
CourseWikiEditPage
(
CoursePage
):
"""
Editor page
"""
def
__init__
(
self
,
browser
,
course_id
,
course_info
):
"""
Course ID is currently of the form "edx/999/2013_Spring"
but this format could change.
"""
super
(
CourseWikiEditPage
,
self
)
.
__init__
(
browser
,
course_id
)
self
.
course_id
=
course_id
self
.
course_info
=
course_info
self
.
article_name
=
"{org}.{course_number}.{course_run}"
.
format
(
org
=
self
.
course_info
[
'org'
],
course_number
=
self
.
course_info
[
'number'
],
course_run
=
self
.
course_info
[
'run'
]
)
@property
def
url_path
(
self
):
"""
Construct a URL to the page within the course.
"""
return
"/wiki/"
+
self
.
article_name
+
"/_edit"
def
is_browser_on_page
(
self
):
"""
The wiki page editor
"""
return
self
.
q
(
css
=
'.CodeMirror-scroll'
)
.
present
def
replace_wiki_content
(
self
,
content
):
"""
Editor must be open already. This will replace any content in the editor
with new content
"""
type_in_codemirror
(
self
,
0
,
content
)
def
save_wiki_content
(
self
):
"""
When the editor is open, click save
"""
self
.
q
(
css
=
'button[name="save"]'
)
.
click
()
self
.
wait_for_element_presence
(
'.alert-success'
,
'wait for the article to be saved'
)
common/test/acceptance/tests/lms/test_lms.py
View file @
6e2e40cc
...
...
@@ -33,6 +33,7 @@ from ...pages.studio.settings import SettingsPage
from
...pages.lms.login_and_register
import
CombinedLoginAndRegisterPage
from
...pages.lms.track_selection
import
TrackSelectionPage
from
...pages.lms.pay_and_verify
import
PaymentAndVerificationFlow
,
FakePaymentPage
from
...pages.lms.course_wiki
import
CourseWikiPage
,
CourseWikiEditPage
from
...fixtures.course
import
CourseFixture
,
XBlockFixtureDesc
,
CourseUpdateDesc
...
...
@@ -423,6 +424,56 @@ class LanguageTest(WebAppTest):
self
.
assertIn
(
self
.
current_courses_text
,
changed_text
)
class
CourseWikiTest
(
UniqueCourseTest
):
"""
Tests that verify the course wiki.
"""
def
setUp
(
self
):
"""
Initialize pages and install a course fixture.
"""
super
(
CourseWikiTest
,
self
)
.
setUp
()
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self
.
course_info
[
'number'
]
=
self
.
unique_id
[
0
:
6
]
self
.
course_info_page
=
CourseInfoPage
(
self
.
browser
,
self
.
course_id
)
self
.
course_wiki_page
=
CourseWikiPage
(
self
.
browser
,
self
.
course_id
)
self
.
course_info_page
=
CourseInfoPage
(
self
.
browser
,
self
.
course_id
)
self
.
course_wiki_edit_page
=
CourseWikiEditPage
(
self
.
browser
,
self
.
course_id
,
self
.
course_info
)
self
.
tab_nav
=
TabNavPage
(
self
.
browser
)
CourseFixture
(
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
],
self
.
course_info
[
'display_name'
]
)
.
install
()
# Auto-auth register for the course
AutoAuthPage
(
self
.
browser
,
course_id
=
self
.
course_id
)
.
visit
()
# Access course wiki page
self
.
course_info_page
.
visit
()
self
.
tab_nav
.
go_to_tab
(
'Wiki'
)
def
test_edit_course_wiki
(
self
):
"""
Wiki page by default is editable for students.
After accessing the course wiki,
Replace the content of the default page
Confirm new content has been saved
"""
content
=
"hello"
self
.
course_wiki_page
.
open_editor
()
self
.
course_wiki_edit_page
.
wait_for_page
()
self
.
course_wiki_edit_page
.
replace_wiki_content
(
content
)
self
.
course_wiki_edit_page
.
save_wiki_content
()
actual_content
=
unicode
(
self
.
course_wiki_page
.
q
(
css
=
'.wiki-article p'
)
.
text
[
0
])
self
.
assertEqual
(
content
,
actual_content
)
class
HighLevelTabTest
(
UniqueCourseTest
):
"""
Tests that verify each of the high-level tabs available within a course.
...
...
@@ -434,6 +485,9 @@ class HighLevelTabTest(UniqueCourseTest):
"""
super
(
HighLevelTabTest
,
self
)
.
setUp
()
# self.course_info['number'] must be shorter since we are accessing the wiki. See TNL-1751
self
.
course_info
[
'number'
]
=
self
.
unique_id
[
0
:
6
]
self
.
course_info_page
=
CourseInfoPage
(
self
.
browser
,
self
.
course_id
)
self
.
progress_page
=
ProgressPage
(
self
.
browser
,
self
.
course_id
)
self
.
course_nav
=
CourseNavPage
(
self
.
browser
)
...
...
@@ -513,6 +567,26 @@ class HighLevelTabTest(UniqueCourseTest):
self
.
tab_nav
.
go_to_tab
(
'Test Static Tab'
)
self
.
assertTrue
(
self
.
tab_nav
.
is_on_tab
(
'Test Static Tab'
))
def
test_wiki_tab_first_time
(
self
):
"""
Navigate to the course wiki tab. When the wiki is accessed for
the first time, it is created on the fly.
"""
course_wiki
=
CourseWikiPage
(
self
.
browser
,
self
.
course_id
)
# From the course info page, navigate to the wiki tab
self
.
course_info_page
.
visit
()
self
.
tab_nav
.
go_to_tab
(
'Wiki'
)
self
.
assertTrue
(
self
.
tab_nav
.
is_on_tab
(
'Wiki'
))
# Assert that a default wiki is created
expected_article_name
=
"{org}.{course_number}.{course_run}"
.
format
(
org
=
self
.
course_info
[
'org'
],
course_number
=
self
.
course_info
[
'number'
],
course_run
=
self
.
course_info
[
'run'
]
)
self
.
assertEqual
(
expected_article_name
,
course_wiki
.
article_name
)
def
test_courseware_nav
(
self
):
"""
Navigate to a particular unit in the courseware.
...
...
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