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
66874aca
Commit
66874aca
authored
Dec 23, 2014
by
E. Kolpakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed typo + combined problem type tests into single test
parent
2b45e10f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
48 deletions
+43
-48
common/test/acceptance/pages/lms/library.py
+1
-1
common/test/acceptance/tests/lms/test_library.py
+42
-47
No files found.
common/test/acceptance/pages/lms/library.py
View file @
66874aca
...
...
@@ -42,7 +42,7 @@ class LibraryContentXBlockWrapper(PageObject):
@property
def
children_headers
(
self
):
"""
Gets headers
i
f all child XBlocks as list of strings
Gets headers
o
f 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/tests/lms/test_library.py
View file @
66874aca
...
...
@@ -119,6 +119,9 @@ class LibraryContentTestBase(UniqueCourseTest):
Open library page in LMS
"""
self
.
courseware_page
.
visit
()
paragraphs
=
self
.
courseware_page
.
q
(
css
=
'.course-content p'
)
if
paragraphs
and
"You were most recently in"
in
paragraphs
.
text
[
0
]:
paragraphs
[
0
]
.
find_element_by_tag_name
(
'a'
)
.
click
()
block_id
=
block_id
if
block_id
is
not
None
else
self
.
lib_block
.
locator
#pylint: disable=attribute-defined-outside-init
self
.
library_content_page
=
LibraryContentXBlockWrapper
(
self
.
browser
,
block_id
)
...
...
@@ -241,62 +244,54 @@ class StudioLibraryContainerCapaFilterTest(LibraryContentTestBase):
""" Expected XBLock headers according to populate_library_fixture """
return
frozenset
(
child
.
display_name
.
upper
()
for
child
in
self
.
library_fixture
.
children
)
@ddt.data
(
1
,
3
)
def
test_any_capa_type_shows_all
(
self
,
count
):
def
_set_library_content_settings
(
self
,
count
=
1
,
capa_type
=
"Any Type"
):
"""
Scenario: Ensure setting "Any Type" for Problem Type does not filter out Problems
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
LibraryContent XBlock configured to draw XBlocks from that library
When I go to studio unit page for library content xblock as staff
And I set library content xblock Problem Type to "Any Type" and Count to {count}
And I refresh library content xblock and pulbish unit
When I go to LMS courseware page for library content xblock as student
Then I can see {count} xblocks from the library of any type
Sets library content XBlock parameters, saves, publishes unit, goes to LMS unit page and
gets children XBlock headers to assert against them
"""
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
"Any Type"
)
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
capa_type
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
_goto_library_block_page
()
children_headers
=
self
.
library_content_page
.
children_headers
self
.
assertEqual
(
len
(
children_headers
),
count
)
self
.
assertLessEqual
(
children_headers
,
self
.
_problem_headers
)
return
self
.
library_content_page
.
children_headers
@ddt.data
(
(
'Choice Group'
,
1
,
[
"Problem Choice Group 1"
,
"Problem Choice Group 2"
]),
(
'Select Option'
,
2
,
[
"Problem Select 1"
,
"Problem Select 2"
]),
)
@ddt.unpack
def
test_capa_type_shows_only_chosen_type
(
self
,
capa_type
,
count
,
expected_headers
):
def
test_problem_type_selector
(
self
):
"""
Scenario: Ensure setting "
{capa_type}" for Problem Type draws aonly problem of {capa_type} from library
Scenario: Ensure setting "
Any Type" for Problem Type does not filter out Problems
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
LibraryContent XBlock configured to draw XBlocks from that library
When I go to studio unit page for library content xblock as staff
And I set library content xblock Problem Type to "{capa_type}" and Count to {count}
And I refresh library content xblock and pulbish unit
When I set library content xblock Problem Type to "Any Type" and Count to 3 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see 3 xblocks from the library of any type
When I set library content xblock Problem Type to "Choice Group" and Count to 1 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see {count} xblocks from the library of {capa_type}
Then I can see 1 xblock from the library of "Choice Group" type
When I set library content xblock Problem Type to "Select Option" and Count to 2 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see 2 xblock from the library of "Select Option" type
When I set library content xblock Problem Type to "Matlab" and Count to 2 and publish unit
When I go to LMS courseware page for library content xblock as student
Then I can see 0 xblocks from the library
"""
self
.
_change_library_content_settings
(
count
=
count
,
capa_type
=
capa_type
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
_goto_library_block_page
()
children_headers
=
self
.
library_content_page
.
children_headers
self
.
assertEqual
(
len
(
children_headers
),
count
)
children_headers
=
self
.
_set_library_content_settings
(
count
=
3
,
capa_type
=
"Any Type"
)
self
.
assertEqual
(
len
(
children_headers
),
3
)
self
.
assertLessEqual
(
children_headers
,
self
.
_problem_headers
)
self
.
assertLessEqual
(
children_headers
,
set
(
map
(
lambda
header
:
header
.
upper
(),
expected_headers
)))
def
test_missing_capa_type_shows_none
(
self
):
"""
Scenario: Ensure setting "{capa_type}" for Problem Type that is not present in library results in empty XBlock
Given I have a library with two "Select Option" and two "Choice Group" problems, and a course containing
LibraryContent XBlock configured to draw XBlocks from that library
When I go to studio unit page for library content xblock as staff
And I set library content xblock Problem Type to type not present in library
And I refresh library content xblock and pulbish unit
When I go to LMS courseware page for library content xblock as student
Then I can see no xblocks
"""
self
.
_change_library_content_settings
(
count
=
1
,
capa_type
=
"Matlab"
)
self
.
_auto_auth
(
self
.
USERNAME
,
self
.
EMAIL
,
False
)
self
.
_goto_library_block_page
()
children_headers
=
self
.
library_content_page
.
children_headers
self
.
assertEqual
(
len
(
children_headers
),
0
)
# Choice group test
children_headers
=
self
.
_set_library_content_settings
(
count
=
1
,
capa_type
=
"Choice Group"
)
self
.
assertEqual
(
len
(
children_headers
),
1
)
self
.
assertLessEqual
(
children_headers
,
set
(
map
(
lambda
header
:
header
.
upper
(),
[
"Problem Choice Group 1"
,
"Problem Choice Group 2"
]))
)
# Choice group test
children_headers
=
self
.
_set_library_content_settings
(
count
=
2
,
capa_type
=
"Select Option"
)
self
.
assertEqual
(
len
(
children_headers
),
2
)
self
.
assertLessEqual
(
children_headers
,
set
(
map
(
lambda
header
:
header
.
upper
(),
[
"Problem Select 1"
,
"Problem Select 2"
]))
)
# Missing problem type test
children_headers
=
self
.
_set_library_content_settings
(
count
=
2
,
capa_type
=
"Matlab"
)
self
.
assertEqual
(
children_headers
,
set
())
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