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
2b45e10f
Commit
2b45e10f
authored
Dec 22, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bok choy acceptance tests
parent
e06b6fea
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
20 deletions
+188
-20
common/lib/xmodule/xmodule/library_content_module.py
+10
-6
common/test/acceptance/pages/lms/library.py
+11
-0
common/test/acceptance/pages/studio/library.py
+19
-0
common/test/acceptance/tests/lms/test_library.py
+148
-14
No files found.
common/lib/xmodule/xmodule/library_content_module.py
View file @
2b45e10f
...
...
@@ -35,8 +35,10 @@ def enum(**enums):
def
_get_capa_types
():
"""
Gets capa types tags and labels
"""
capa_types
=
{
ANY_CAPA_TYPE_VALUE
:
_
(
'Any Type'
),
'annotationinput'
:
_
(
'Annotation'
),
'checkboxgroup'
:
_
(
'Checkbox Group'
),
'checkboxtextgroup'
:
_
(
'Checkbox Text Group'
),
...
...
@@ -54,7 +56,7 @@ def _get_capa_types():
'javascriptinput'
:
_
(
'Javascript Input'
),
'jsinput'
:
_
(
'JS Input'
),
'matlabinput'
:
_
(
'Matlab'
),
'optioninput'
:
_
(
'Select
o
ption'
),
'optioninput'
:
_
(
'Select
O
ption'
),
'radiogroup'
:
_
(
'Radio Group'
),
'radiotextgroup'
:
_
(
'Radio Text Group'
),
'schematic'
:
_
(
'Schematic'
),
...
...
@@ -63,7 +65,7 @@ def _get_capa_types():
'vsepr_input'
:
_
(
'VSEPR'
),
}
return
sorted
([
return
[{
'value'
:
ANY_CAPA_TYPE_VALUE
,
'display_name'
:
_
(
'Any Type'
)}]
+
sorted
([
{
'value'
:
capa_type
,
'display_name'
:
caption
}
for
capa_type
,
caption
in
capa_types
.
items
()
],
key
=
lambda
item
:
item
.
get
(
'display_name'
))
...
...
@@ -221,6 +223,9 @@ class LibraryContentModule(LibraryContentFields, XModule, StudioEditableModule):
any particular student.
"""
def
_filter_children
(
self
,
child_locator
):
"""
Filters children by CAPA problem type, if configured
"""
if
self
.
capa_type
==
ANY_CAPA_TYPE_VALUE
:
return
True
...
...
@@ -234,7 +239,6 @@ class LibraryContentModule(LibraryContentFields, XModule, StudioEditableModule):
return
any
(
self
.
capa_type
in
capa_input
.
tags
for
capa_input
in
block
.
lcp
.
inputs
.
values
())
def
selected_children
(
self
):
"""
Returns a set() of block_ids indicating which of the possible children
...
...
@@ -427,8 +431,8 @@ class LibraryContentDescriptor(LibraryContentFields, MakoModuleDescriptor, XmlDe
If source_libraries has been edited, refresh_children automatically.
"""
old_source_libraries
=
LibraryList
()
.
from_json
(
old_metadata
.
get
(
'source_libraries'
,
[]))
if
(
set
(
old_source_libraries
)
!=
set
(
self
.
source_libraries
)
or
old_metadata
.
get
(
'capa_type'
,
ANY_CAPA_TYPE_VALUE
)
!=
self
.
capa_type
)
:
if
set
(
old_source_libraries
)
!=
set
(
self
.
source_libraries
)
or
\
old_metadata
.
get
(
'capa_type'
,
ANY_CAPA_TYPE_VALUE
)
!=
self
.
capa_type
:
try
:
self
.
refresh_children
(
None
,
None
,
update_db
=
False
)
# update_db=False since update_item() is about to be called anyways
except
ValueError
:
...
...
common/test/acceptance/pages/lms/library.py
View file @
2b45e10f
...
...
@@ -16,6 +16,9 @@ class LibraryContentXBlockWrapper(PageObject):
self
.
locator
=
locator
def
is_browser_on_page
(
self
):
"""
Checks if page is opened
"""
return
self
.
q
(
css
=
'{}[data-id="{}"]'
.
format
(
self
.
BODY_SELECTOR
,
self
.
locator
))
.
present
def
_bounded_selector
(
self
,
selector
):
...
...
@@ -35,3 +38,11 @@ class LibraryContentXBlockWrapper(PageObject):
"""
child_blocks
=
self
.
q
(
css
=
self
.
_bounded_selector
(
"div[data-id]"
))
return
frozenset
(
child
.
text
for
child
in
child_blocks
)
@property
def
children_headers
(
self
):
"""
Gets headers if all child XBlocks as list of strings
"""
child_blocks_headers
=
self
.
q
(
css
=
self
.
_bounded_selector
(
"div[data-id] h2.problem-header"
))
return
frozenset
(
child
.
text
for
child
in
child_blocks_headers
)
common/test/acceptance/pages/studio/library.py
View file @
2b45e10f
...
...
@@ -122,6 +122,7 @@ class StudioLibraryContentXBlockEditModal(CourseOutlineModal, PageObject):
LIBRARY_LABEL
=
"Libraries"
COUNT_LABEL
=
"Count"
SCORED_LABEL
=
"Scored"
PROBLEM_TYPE_LABEL
=
"Problem Type"
def
is_browser_on_page
(
self
):
"""
...
...
@@ -196,6 +197,24 @@ class StudioLibraryContentXBlockEditModal(CourseOutlineModal, PageObject):
scored_select
.
select_by_value
(
str
(
scored
))
EmptyPromise
(
lambda
:
self
.
scored
==
scored
,
"scored is updated in modal."
)
.
fulfill
()
@property
def
capa_type
(
self
):
"""
Gets value of CAPA type select
"""
return
self
.
get_metadata_input
(
self
.
PROBLEM_TYPE_LABEL
)
.
get_attribute
(
'value'
)
@capa_type.setter
def
capa_type
(
self
,
value
):
"""
Sets value of CAPA type select
"""
select_element
=
self
.
get_metadata_input
(
self
.
PROBLEM_TYPE_LABEL
)
select_element
.
click
()
problem_type_select
=
Select
(
select_element
)
problem_type_select
.
select_by_value
(
value
)
EmptyPromise
(
lambda
:
self
.
capa_type
==
value
,
"problem type is updated in modal."
)
.
fulfill
()
def
_add_library_key
(
self
):
"""
Adds library key input
...
...
common/test/acceptance/tests/lms/test_library.py
View file @
2b45e10f
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