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
ce665e3b
Commit
ce665e3b
authored
Jun 20, 2016
by
Muddasser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Conversion of cms/component.feature into bokchoy tests
parent
a240780b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
62 deletions
+130
-62
cms/djangoapps/contentstore/features/component.feature
+0
-61
common/test/acceptance/pages/studio/utils.py
+12
-0
common/test/acceptance/tests/studio/test_studio_components.py
+118
-1
No files found.
cms/djangoapps/contentstore/features/component.feature
deleted
100644 → 0
View file @
a240780b
@shard_1
Feature
:
CMS.Component Adding
As a course author, I want to be able to add a wide variety of components
Scenario
:
I
can add HTML components
Given
I am in Studio editing a new unit
When I add this type of HTML component
:
|
Component
|
|
Text
|
|
Announcement
|
|
Zooming
Image
Tool
|
|
Raw
HTML
|
Then I see HTML components in this order
:
|
Component
|
|
Text
|
|
Announcement
|
|
Zooming
Image
Tool
|
|
Raw
HTML
|
Scenario
:
I
can add Latex HTML components
Given
I am in Studio editing a new unit
Given
I have enabled latex compiler
When I add this type of HTML component
:
|
Component
|
|
E-text
Written
in
LaTeX
|
Then I see HTML components in this order
:
|
Component
|
|
E-text
Written
in
LaTeX
|
Scenario
:
I
can add Common Problem components
Given
I am in Studio editing a new unit
When I add this type of Problem component
:
|
Component
|
|
Blank
Common
Problem
|
|
Checkboxes
|
|
Dropdown
|
|
Multiple
Choice
|
|
Numerical
Input
|
|
Text
Input
|
Then I see Problem components in this order
:
|
Component
|
|
Blank
Common
Problem
|
|
Checkboxes
|
|
Dropdown
|
|
Multiple
Choice
|
|
Numerical
Input
|
|
Text
Input
|
# Disabled 1/21/14 due to flakiness seen in master
# Scenario: I can add Advanced Latex Problem components
# Given I am in Studio editing a new unit
# Given I have enabled latex compiler
# When I add a "<Component>" "Advanced Problem" component
# Then I see a "<Component>" Problem component
# # Flush out the database before the next example executes
# And I reset the database
# Examples:
# | Component |
# | Problem Written in LaTeX |
# | Problem with Adaptive Hint in Latex |
common/test/acceptance/pages/studio/utils.py
View file @
ce665e3b
...
@@ -101,6 +101,18 @@ def add_component(page, item_type, specific_type, is_advanced_problem=False):
...
@@ -101,6 +101,18 @@ def add_component(page, item_type, specific_type, is_advanced_problem=False):
page
.
wait_for_ajax
()
page
.
wait_for_ajax
()
def
add_components
(
page
,
item_type
,
items
,
is_advanced_problem
=
False
):
"""
Adds multiple components of a specific type.
item_type should be "advanced", "html", "problem", or "video"
items is a list of components of specific type to be added.
Please note that if you want to create an advanced problem
then all other items must be of advanced problem type.
"""
for
item
in
items
:
add_component
(
page
,
item_type
,
item
,
is_advanced_problem
)
def
add_html_component
(
page
,
menu_index
,
boilerplate
=
None
):
def
add_html_component
(
page
,
menu_index
,
boilerplate
=
None
):
"""
"""
Adds an instance of the HTML component with the specified name.
Adds an instance of the HTML component with the specified name.
...
...
common/test/acceptance/tests/studio/test_studio_components.py
View file @
ce665e3b
...
@@ -6,7 +6,8 @@ import ddt
...
@@ -6,7 +6,8 @@ import ddt
from
.base_studio_test
import
ContainerBase
from
.base_studio_test
import
ContainerBase
from
...fixtures.course
import
XBlockFixtureDesc
from
...fixtures.course
import
XBlockFixtureDesc
from
...pages.studio.container
import
ContainerPage
from
...pages.studio.container
import
ContainerPage
from
...pages.studio.utils
import
add_component
from
...pages.studio.utils
import
add_component
,
add_components
from
common.test.acceptance.pages.studio.settings_advanced
import
AdvancedSettingsPage
@ddt.ddt
@ddt.ddt
...
@@ -65,3 +66,119 @@ class AdvancedProblemComponentTest(ContainerBase):
...
@@ -65,3 +66,119 @@ class AdvancedProblemComponentTest(ContainerBase):
add_component
(
page
,
'problem'
,
component
,
is_advanced_problem
=
True
)
add_component
(
page
,
'problem'
,
component
,
is_advanced_problem
=
True
)
problem
=
page
.
xblocks
[
1
]
problem
=
page
.
xblocks
[
1
]
self
.
assertEqual
(
problem
.
name
,
component
)
self
.
assertEqual
(
problem
.
name
,
component
)
class
ComponentTest
(
ContainerBase
):
"""
Test class to add different components.
(Not the advanced components)
"""
def
setUp
(
self
,
is_staff
=
True
):
"""
Create a course with a section, subsection, and unit to which to add the component.
"""
super
(
ComponentTest
,
self
)
.
setUp
(
is_staff
=
is_staff
)
self
.
advanced_settings
=
AdvancedSettingsPage
(
self
.
browser
,
self
.
course_info
[
'org'
],
self
.
course_info
[
'number'
],
self
.
course_info
[
'run'
]
)
def
populate_course_fixture
(
self
,
course_fixture
):
course_fixture
.
add_advanced_settings
(
{
u"advanced_modules"
:
{
"value"
:
[
"split_test"
]}}
)
course_fixture
.
add_children
(
XBlockFixtureDesc
(
'chapter'
,
'Test Section'
)
.
add_children
(
XBlockFixtureDesc
(
'sequential'
,
'Test Subsection'
)
.
add_children
(
XBlockFixtureDesc
(
'vertical'
,
'Test Unit'
)
)
)
)
def
test_add_html_component
(
self
):
"""
Scenario: I can add HTML components
Given I am in Studio editing a new unit
When I add this type of HTML component:
| Component |
| Text |
| Announcement |
| Zooming Image Tool |
| Raw HTML |
Then I see HTML components in this order:
| Component |
| Text |
| Announcement |
| Zooming Image Tool |
| Raw HTML |
"""
# Components to be added
components
=
[
'Text'
,
'Announcement'
,
'Zooming Image Tool'
,
'Raw HTML'
]
self
.
go_to_unit_page
()
container_page
=
ContainerPage
(
self
.
browser
,
None
)
# Add components
add_components
(
container_page
,
'html'
,
components
)
problems
=
[
x_block
.
name
for
x_block
in
container_page
.
xblocks
[
1
:]]
# Assert that components appear in same order as added.
self
.
assertEqual
(
problems
,
components
)
def
test_add_latex_html_component
(
self
):
"""
Scenario: I can add Latex HTML components
Given I am in Studio editing a new unit
Given I have enabled latex compiler
When I add this type of HTML component:
| Component |
| E-text Written in LaTeX |
Then I see HTML components in this order:
| Component |
| E-text Written in LaTeX |
"""
# Latex component
component
=
'E-text Written in LaTeX'
# Visit advanced settings page and enable latex compiler.
self
.
advanced_settings
.
visit
()
self
.
advanced_settings
.
set
(
'Enable LaTeX Compiler'
,
'True'
)
self
.
go_to_unit_page
()
container_page
=
ContainerPage
(
self
.
browser
,
None
)
# Add latex component
add_component
(
container_page
,
'html'
,
component
,
is_advanced_problem
=
False
)
problem
=
container_page
.
xblocks
[
1
]
# Asset that component has been added.
self
.
assertEqual
(
problem
.
name
,
component
)
def
test_common_problem_component
(
self
):
"""
Scenario: I can add Common Problem components
Given I am in Studio editing a new unit
When I add this type of Problem component:
| Component |`
| Blank Common Problem |
| Checkboxes |
| Dropdown |
| Multiple Choice |
| Numerical Input |
| Text Input |
Then I see Problem components in this order:
| Component |
| Blank Common Problem |
| Checkboxes |
| Dropdown |
| Multiple Choice |
| Numerical Input |
| Text Input |
"""
# Components to be added.
components
=
[
'Blank Common Problem'
,
'Checkboxes'
,
'Dropdown'
,
'Multiple Choice'
,
'Numerical Input'
,
'Text Input'
]
self
.
go_to_unit_page
()
container_page
=
ContainerPage
(
self
.
browser
,
None
)
# Add components
add_components
(
container_page
,
'problem'
,
components
)
problems
=
[
x_block
.
name
for
x_block
in
container_page
.
xblocks
[
1
:]]
# Assert that components appear in the same order as added.
self
.
assertEqual
(
problems
,
components
)
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