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
c7713064
Commit
c7713064
authored
Apr 22, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked UI for clarity, removed reload, and added Bok-Choy tests
parent
a660cd85
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
94 additions
and
19 deletions
+94
-19
common/test/acceptance/pages/lms/staff_view.py
+26
-2
common/test/acceptance/tests/test_staff_view.py
+53
-4
lms/templates/staff_problem_info.html
+15
-13
No files found.
common/test/acceptance/pages/lms/staff_view.py
View file @
c7713064
...
...
@@ -31,6 +31,13 @@ class StaffPage(PageObject):
staff_debug_page
.
wait_for_page
()
return
staff_debug_page
def
answer_problem
(
self
):
"""
Answers the problem to give state that we can clean
"""
self
.
q
(
css
=
'input.check'
)
.
first
.
click
()
self
.
wait_for_ajax
()
class
StaffDebugPage
(
PageObject
):
"""
...
...
@@ -43,6 +50,9 @@ class StaffDebugPage(PageObject):
return
self
.
q
(
css
=
'section.staff-modal'
)
.
present
def
_click_link
(
self
,
link_text
):
"""
Clicks on an action link based on text
"""
for
link
in
self
.
q
(
css
=
'section.staff-modal a'
)
.
execute
():
if
link
.
text
==
link_text
:
return
link
.
click
()
...
...
@@ -50,8 +60,22 @@ class StaffDebugPage(PageObject):
raise
Exception
(
'Could not find the {} link to click on.'
.
format
(
link_text
))
def
reset_attempts
(
self
):
self
.
_click_link
(
'Reset Attempts'
)
def
reset_attempts
(
self
,
user
=
None
):
"""
This clicks on the reset attempts link with an optionally
specified user.
"""
if
user
:
self
.
q
(
css
=
'input[id^=sd_fu_]'
)
.
first
.
fill
(
user
)
self
.
_click_link
(
'Reset Student Attempts'
)
def
delete_state
(
self
,
user
=
None
):
"""
This delete's a student's state for the problem
"""
if
user
:
self
.
q
(
css
=
'input[id^=sd_fu_]'
)
.
fill
(
user
)
self
.
_click_link
(
'Delete Student State'
)
@property
def
idash_msg
(
self
):
...
...
common/test/acceptance/tests/test_staff_view.py
View file @
c7713064
...
...
@@ -15,6 +15,7 @@ class StaffDebugTest(UniqueCourseTest):
"""
Tests that verify the staff debug info.
"""
USERNAME
=
"STAFF_TESTER"
def
setUp
(
self
):
super
(
StaffDebugTest
,
self
)
.
setUp
()
...
...
@@ -48,14 +49,62 @@ class StaffDebugTest(UniqueCourseTest):
# Auto-auth register for the course.
# Do this as global staff so that you will see the Staff View
AutoAuthPage
(
self
.
browser
,
course_id
=
self
.
course_id
,
staff
=
True
)
.
visit
()
AutoAuthPage
(
self
.
browser
,
username
=
self
.
USERNAME
,
course_id
=
self
.
course_id
,
staff
=
True
)
.
visit
()
def
test_staff_debug
(
self
):
def
_goto_staff_page
(
self
):
"""
Open staff page with assertion
"""
self
.
courseware_page
.
visit
()
staff_page
=
StaffPage
(
self
.
browser
)
self
.
assertEqual
(
staff_page
.
staff_status
,
'Staff view'
)
return
staff_page
def
test_reset_attempts_empty
(
self
):
"""
Test that we fail properly when there is no student state
"""
staff_debug_page
=
self
.
_goto_staff_page
()
.
open_staff_debug_info
()
staff_debug_page
.
reset_attempts
()
msg
=
staff_debug_page
.
idash_msg
[
0
]
self
.
assertIn
((
u"Found a single student. Found module. Couldn't "
"reset module state for {0}/"
)
.
format
(
self
.
USERNAME
),
msg
)
def
test_delete_state_empty
(
self
):
"""
Test that we delete properly even when there isn't state to delete.
"""
staff_debug_page
=
self
.
_goto_staff_page
()
.
open_staff_debug_info
()
staff_debug_page
.
delete_state
()
msg
=
staff_debug_page
.
idash_msg
[
0
]
self
.
assertIn
((
u"Found a single student. Found module. "
"Deleted student module state for"
),
msg
)
def
test_reset_attempts_state
(
self
):
"""
Successfully reset the student attempts
"""
staff_page
=
self
.
_goto_staff_page
()
staff_page
.
answer_problem
()
staff_debug_page
=
staff_page
.
open_staff_debug_info
()
staff_debug_page
.
reset_attempts
()
msg
=
staff_debug_page
.
idash_msg
[
0
]
self
.
assertIn
((
u"Found a single student. Found module. Module "
"state successfully reset!"
),
msg
)
msg
=
staff_debug_page
.
idash_msg
self
.
assertEqual
(
'foo'
,
msg
)
# Not sure what is supposed to happen
def
test_student_state_state
(
self
):
"""
Successfully delete the student state with an answer
"""
staff_page
=
self
.
_goto_staff_page
()
staff_page
.
answer_problem
()
staff_debug_page
=
staff_page
.
open_staff_debug_info
()
staff_debug_page
.
delete_state
()
msg
=
staff_debug_page
.
idash_msg
[
0
]
self
.
assertIn
((
u"Found a single student. Found module. "
"Deleted student module state for"
),
msg
)
lms/templates/staff_problem_info.html
View file @
c7713064
...
...
@@ -82,7 +82,10 @@ var StaffDebug = (function(){
data
:
pdata
,
success
:
function
(
data
){
var
msg
=
$
(
"#idash_msg"
,
data
);
$
(
"#result_"
+
locname
).
html
(
msg
);
$
(
"#result_"
+
locname
).
html
(
msg
);
},
error
:
function
(
request
,
status
,
error
)
{
$
(
"#result_"
+
locname
).
html
(
'<p id="idash_msg"><font color="red">${_('
Something
has
gone
wrong
with
this
request
.
The
server
replied
with
a
status
of
:
')}'
+
error
+
'</font></p>'
)
},
dataType
:
'html'
});
...
...
@@ -96,25 +99,24 @@ var StaffDebug = (function(){
do_idash_action
(
locname
,
"Delete student state for module"
);
}
reload
=
function
(
locname
){
var
url
=
geturl
(
'jump_to_id/'
+
locname
);
window
.
location
.
replace
(
url
);
}
return
{
reset
:
reset
,
reload
:
reload
,
sdelete
:
sdelete
,
do_idash_action
:
do_idash_action
}
})();
</script>
[
<a
href=
'javascript:StaffDebug.reset("${location.name}")'
>
${_('Reset Attempts')}
</a>
|
<a
href=
'javascript:StaffDebug.reload("${location.name}")'
>
${_('Reload Page')}
</a>
|
<a
href=
'javascript:StaffDebug.sdelete("${location.name}")'
>
${_('Delete State')}
</a>
<hr
/>
<h3>
Actions
</h3>
<div>
<label
for=
"sd_fu_${location.name}"
>
For User:
</label>
<input
type=
"text"
id=
"sd_fu_${location.name}"
placeholder=
"${user.username}"
/>
</div>
<div>
[
<a
href=
'javascript:StaffDebug.reset("${location.name}")'
>
${_('Reset Student Attempts')}
</a>
|
<a
href=
'javascript:StaffDebug.sdelete("${location.name}")'
>
${_('Delete Student State')}
</a>
]
<span
style=
"float:right"
>
For user:
<input
type=
"text"
id=
"sd_fu_${location.name}"
/></span
>
<div
id=
"result_${location.name}"
/>
</div
>
<div
id=
"result_${location.name}"
/>
<div
class=
"staff_info"
style=
"display:block"
>
is_released = ${is_released}
...
...
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