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
55fb45fb
Commit
55fb45fb
authored
Dec 30, 2014
by
Braden MacDonald
Committed by
E. Kolpakov
Jan 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Acceptance test
parent
ea579bf5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
common/test/acceptance/pages/studio/container.py
+23
-0
common/test/acceptance/tests/studio/test_studio_library_container.py
+51
-0
No files found.
common/test/acceptance/pages/studio/container.py
View file @
55fb45fb
...
...
@@ -285,6 +285,7 @@ class XBlockWrapper(PageObject):
COMPONENT_BUTTONS
=
{
'basic_tab'
:
'.editor-tabs li.inner_tab_wrap:nth-child(1) > a'
,
'advanced_tab'
:
'.editor-tabs li.inner_tab_wrap:nth-child(2) > a'
,
'settings_tab'
:
'.editor-modes .settings-button'
,
'save_settings'
:
'.action-save'
,
}
...
...
@@ -412,6 +413,28 @@ class XBlockWrapper(PageObject):
"""
self
.
_click_button
(
'basic_tab'
)
def
open_settings_tab
(
self
):
"""
If editing, click on the "Settings" tab
"""
self
.
_click_button
(
'settings_tab'
)
def
set_field_val
(
self
,
field_display_name
,
field_value
):
"""
If editing, set the value of a field.
"""
selector
=
'{} li.field label:contains("{}") + input'
.
format
(
self
.
editor_selector
,
field_display_name
)
script
=
"$(arguments[0]).val(arguments[1]).change();"
self
.
browser
.
execute_script
(
script
,
selector
,
field_value
)
def
reset_field_val
(
self
,
field_display_name
):
"""
If editing, reset the value of a field to its default.
"""
scope
=
'{} li.field label:contains("{}")'
.
format
(
self
.
editor_selector
,
field_display_name
)
script
=
"$(arguments[0]).siblings('.setting-clear').click();"
self
.
browser
.
execute_script
(
script
,
scope
)
def
set_codemirror_text
(
self
,
text
,
index
=
0
):
"""
Set the text of a CodeMirror editor that is part of this xblock's settings.
...
...
common/test/acceptance/tests/studio/test_studio_library_container.py
View file @
55fb45fb
...
...
@@ -244,3 +244,54 @@ class StudioLibraryContainerTest(StudioLibraryTest, UniqueCourseTest):
expected_tpl
.
format
(
count
=
50
,
actual
=
len
(
self
.
library_fixture
.
children
)),
library_container
.
validation_warning_text
)
def
test_settings_overrides
(
self
):
"""
Scenario: Given I have a library, a course and library content xblock in a course
When I go to studio unit page for library content block
And when I click the "View" link
Then I can see a preview of the blocks drawn from the library.
When I edit one of the blocks to change a setting such as "display_name",
Then I can see the new setting is overriding the library version.
When I subsequently click to refresh the content with the latest from the library,
Then I can see that the overrided version of the setting is preserved.
When I click to edit the block and reset the setting,
then I can see that the setting's field defaults back to the library version.
"""
block_wrapper_unit_page
=
self
.
_get_library_xblock_wrapper
(
self
.
unit_page
.
xblocks
[
0
]
.
children
[
0
])
container_page
=
block_wrapper_unit_page
.
go_to_container
()
library_block
=
self
.
_get_library_xblock_wrapper
(
container_page
.
xblocks
[
0
])
self
.
assertFalse
(
library_block
.
has_validation_message
)
self
.
assertEqual
(
len
(
library_block
.
children
),
3
)
block
=
library_block
.
children
[
0
]
self
.
assertIn
(
block
.
name
,
(
"Html1"
,
"Html2"
,
"Html3"
))
name_default
=
block
.
name
block
.
edit
()
new_display_name
=
"A new name for this HTML block"
block
.
set_field_val
(
"Display Name"
,
new_display_name
)
block
.
save_settings
()
self
.
assertEqual
(
block
.
name
,
new_display_name
)
# Create a new block, causing a new library version:
self
.
library_fixture
.
create_xblock
(
self
.
library_fixture
.
library_location
,
XBlockFixtureDesc
(
"html"
,
"Html4"
))
container_page
.
visit
()
# Reload
self
.
assertTrue
(
library_block
.
has_validation_warning
)
library_block
.
refresh_children
()
container_page
.
wait_for_page
()
# Wait for the page to reload
self
.
assertEqual
(
len
(
library_block
.
children
),
4
)
self
.
assertEqual
(
block
.
name
,
new_display_name
)
# Reset:
block
.
edit
()
block
.
reset_field_val
(
"Display Name"
)
block
.
save_settings
()
self
.
assertEqual
(
block
.
name
,
name_default
)
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