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
6e2e40cc
Commit
6e2e40cc
authored
10 years ago
by
Ben Patterson
Browse files
Options
Downloads
Patches
Plain Diff
Add course wiki acceptance tests.
parent
9edda950
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/test/acceptance/pages/lms/course_wiki.py
+81
-0
81 additions, 0 deletions
common/test/acceptance/pages/lms/course_wiki.py
common/test/acceptance/tests/lms/test_lms.py
+74
-0
74 additions, 0 deletions
common/test/acceptance/tests/lms/test_lms.py
with
155 additions
and
0 deletions
common/test/acceptance/pages/lms/course_wiki.py
0 → 100644
+
81
−
0
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
'
)
This diff is collapsed.
Click to expand it.
common/test/acceptance/tests/lms/test_lms.py
+
74
−
0
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.
...
...
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