Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
problem-builder
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
OpenEdx
problem-builder
Commits
b1db7697
Commit
b1db7697
authored
Apr 28, 2015
by
Braden MacDonald
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor test cleanups
parent
cff20069
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
70 deletions
+69
-70
problem_builder/tests/integration/base_test.py
+2
-1
problem_builder/tests/integration/test_assessment.py
+3
-3
problem_builder/tests/integration/test_dashboard.py
+6
-66
problem_builder/tests/integration/xml_templates/dashboard.xml
+58
-0
No files found.
problem_builder/tests/integration/base_test.py
View file @
b1db7697
...
@@ -82,7 +82,8 @@ class MentoringBaseTemplateTest(SeleniumXBlockTest, PopupCheckMixin):
...
@@ -82,7 +82,8 @@ class MentoringBaseTemplateTest(SeleniumXBlockTest, PopupCheckMixin):
def
click_submit
(
self
,
mentoring
):
def
click_submit
(
self
,
mentoring
):
""" Click the submit button and wait for the response """
""" Click the submit button and wait for the response """
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
submit
=
mentoring
.
find_element_by_css_selector
(
'.submit input.input-main'
)
self
.
assertTrue
(
submit
.
is_displayed
()
and
submit
.
is_enabled
())
self
.
assertTrue
(
submit
.
is_displayed
())
self
.
assertTrue
(
submit
.
is_enabled
())
submit
.
click
()
submit
.
click
()
self
.
wait_until_disabled
(
submit
)
self
.
wait_until_disabled
(
submit
)
...
...
problem_builder/tests/integration/test_assessment.py
View file @
b1db7697
...
@@ -394,7 +394,7 @@ class MentoringAssessmentTest(MentoringAssessmentBaseTest):
...
@@ -394,7 +394,7 @@ class MentoringAssessmentTest(MentoringAssessmentBaseTest):
self
.
peek_at_review
(
mentoring
,
controls
,
expected_results
)
self
.
peek_at_review
(
mentoring
,
controls
,
expected_results
)
self
.
assert_messages_empty
(
mentoring
)
self
.
assert_messages_empty
(
mentoring
)
self
.
wait_until_clickable
(
controls
.
try_again
)
controls
.
try_again
.
click
()
controls
.
try_again
.
click
()
# this is a wait and assertion all together - it waits until expected text is in mentoring block
self
.
wait_until_hidden
(
controls
.
try_again
)
# and it fails with PrmoiseFailed exception if it's not
self
.
assertIn
(
self
.
question_text
(
0
),
mentoring
.
text
)
self
.
wait_until_text_in
(
self
.
question_text
(
0
),
mentoring
)
problem_builder/tests/integration/test_dashboard.py
View file @
b1db7697
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
#
#
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
from
xblockutils.base_test
import
SeleniumXBlock
Test
from
.base_test
import
MentoringBaseTemplate
Test
class
MockSubmissionsAPI
(
object
):
class
MockSubmissionsAPI
(
object
):
...
@@ -50,77 +50,20 @@ class MockSubmissionsAPI(object):
...
@@ -50,77 +50,20 @@ class MockSubmissionsAPI(object):
return
[]
return
[]
class
TestDashboardBlock
(
SeleniumXBlock
Test
):
class
TestDashboardBlock
(
MentoringBaseTemplate
Test
):
"""
"""
Test the Student View of a dashboard XBlock linked to some problem builder blocks
Test the Student View of a dashboard XBlock linked to some problem builder blocks
"""
"""
def
setUp
(
self
):
def
setUp
(
self
):
super
(
TestDashboardBlock
,
self
)
.
setUp
()
super
(
TestDashboardBlock
,
self
)
.
setUp
()
# Set up our scenario:
# Set up our scenario:
self
.
set_scenario_xml
(
"""
self
.
load_scenario
(
'dashboard.xml'
)
<vertical_demo>
<problem-builder display_name="Step 1">
<pb-mcq display_name="1.1 First MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
<pb-mcq display_name="1.2 Second MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
<pb-mcq display_name="1.3 Third MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
<html_demo> This message here should be ignored. </html_demo>
</problem-builder>
<problem-builder display_name="Step 2">
<pb-mcq display_name="2.1 First MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="4">Option 4</pb-choice>
<pb-choice value="5">Option 5</pb-choice>
<pb-choice value="6">Option 6</pb-choice>
</pb-mcq>
<pb-mcq display_name="2.2 Second MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
<pb-mcq display_name="2.3 Third MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
</problem-builder>
<problem-builder display_name="Step 3">
<pb-mcq display_name="3.1 First MCQ" question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="1">Option 1</pb-choice>
<pb-choice value="2">Option 2</pb-choice>
<pb-choice value="3">Option 3</pb-choice>
<pb-choice value="4">Option 4</pb-choice>
</pb-mcq>
<pb-mcq display_name="3.2 MCQ with non-numeric values"
question="Which option?" correct_choices='["1","2","3","4"]'>
<pb-choice value="A">Option A</pb-choice>
<pb-choice value="B">Option B</pb-choice>
<pb-choice value="C">Option C</pb-choice>
</pb-mcq>
</problem-builder>
<pb-dashboard mentoring_ids='["dummy-value"]'>
</pb-dashboard>
</vertical_demo>
"""
)
# Apply a whole bunch of patches that are needed in lieu of the LMS/CMS runtime and edx-submissions:
# Apply a whole bunch of patches that are needed in lieu of the LMS/CMS runtime and edx-submissions:
def
get_mentoring_blocks
(
dashboard_block
,
mentoring_ids
,
ignore_errors
=
True
):
def
get_mentoring_blocks
(
dashboard_block
,
mentoring_ids
,
ignore_errors
=
True
):
return
[
dashboard_block
.
runtime
.
get_block
(
key
)
for
key
in
dashboard_block
.
get_parent
()
.
children
[:
-
1
]]
return
[
dashboard_block
.
runtime
.
get_block
(
key
)
for
key
in
dashboard_block
.
get_parent
()
.
children
[:
-
1
]]
mock_submisisons_api
=
MockSubmissionsAPI
()
mock_submisisons_api
=
MockSubmissionsAPI
()
patches
=
(
patches
=
(
(
(
...
@@ -174,10 +117,7 @@ class TestDashboardBlock(SeleniumXBlockTest):
...
@@ -174,10 +117,7 @@ class TestDashboardBlock(SeleniumXBlockTest):
for
idx
,
mcq
in
enumerate
(
mcqs
):
for
idx
,
mcq
in
enumerate
(
mcqs
):
choices
=
mcq
.
find_elements_by_css_selector
(
'.choices .choice label'
)
choices
=
mcq
.
find_elements_by_css_selector
(
'.choices .choice label'
)
choices
[
idx
]
.
click
()
choices
[
idx
]
.
click
()
submit
=
pb
.
find_element_by_css_selector
(
'.submit input.input-main'
)
self
.
click_submit
(
pb
)
self
.
assertTrue
(
submit
.
is_enabled
())
submit
.
click
()
self
.
wait_until_disabled
(
submit
)
# Reload the page:
# Reload the page:
self
.
go_to_view
(
"student_view"
)
self
.
go_to_view
(
"student_view"
)
...
...
problem_builder/tests/integration/xml_templates/dashboard.xml
0 → 100644
View file @
b1db7697
<vertical_demo>
<problem-builder
display_name=
"Step 1"
>
<pb-mcq
display_name=
"1.1 First MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
<pb-mcq
display_name=
"1.2 Second MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
<pb-mcq
display_name=
"1.3 Third MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
<html_demo>
This message here should be ignored.
</html_demo>
</problem-builder>
<problem-builder
display_name=
"Step 2"
>
<pb-mcq
display_name=
"2.1 First MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
<pb-choice
value=
"5"
>
Option 5
</pb-choice>
<pb-choice
value=
"6"
>
Option 6
</pb-choice>
</pb-mcq>
<pb-mcq
display_name=
"2.2 Second MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
<pb-mcq
display_name=
"2.3 Third MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
</problem-builder>
<problem-builder
display_name=
"Step 3"
>
<pb-mcq
display_name=
"3.1 First MCQ"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"1"
>
Option 1
</pb-choice>
<pb-choice
value=
"2"
>
Option 2
</pb-choice>
<pb-choice
value=
"3"
>
Option 3
</pb-choice>
<pb-choice
value=
"4"
>
Option 4
</pb-choice>
</pb-mcq>
<pb-mcq
display_name=
"3.2 MCQ with non-numeric values"
question=
"Which option?"
correct_choices=
'["1","2","3","4"]'
>
<pb-choice
value=
"A"
>
Option A
</pb-choice>
<pb-choice
value=
"B"
>
Option B
</pb-choice>
<pb-choice
value=
"C"
>
Option C
</pb-choice>
</pb-mcq>
</problem-builder>
<pb-dashboard
mentoring_ids=
'["dummy-value"]'
>
</pb-dashboard>
</vertical_demo>
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