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
0d2dc431
Commit
0d2dc431
authored
Oct 07, 2015
by
Eric Fischer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10066 from edx/efischer/edit_studio_test
TNL-3305 HTML Editing Bok Choy Test
parents
624bc9a7
2bbea43d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
13 deletions
+68
-13
common/test/acceptance/pages/studio/html_component_editor.py
+50
-13
common/test/acceptance/tests/studio/test_studio_container.py
+18
-0
No files found.
common/test/acceptance/pages/studio/html_component_editor.py
View file @
0d2dc431
...
...
@@ -7,25 +7,62 @@ class HtmlComponentEditorView(ComponentEditorView):
"""
Represents the rendered view of an HTML component editor.
"""
def
set_content_and_save
(
self
,
content
):
"""
Types content into the html component and presses Save.
editor_mode_css
=
'.edit-xblock-modal .editor-modes .editor-button'
def
set_content_and_save
(
self
,
content
,
raw
=
False
):
"""Types content into the html component and presses Save.
Arguments:
content (str): The content to be used.
raw (bool): If true, edits in 'raw HTML' mode.
"""
self
.
set_content
(
content
)
if
raw
:
self
.
set_raw_content
(
content
)
else
:
self
.
set_content
(
content
)
self
.
save
()
def
set_content_and_cancel
(
self
,
content
):
"""
Types content into the html component and presses Cancel to abort the change.
def
set_content_and_cancel
(
self
,
content
,
raw
=
False
):
"""Types content into the html component and presses Cancel to abort.
Arguments:
content (str): The content to be used.
raw (bool): If true, edits in 'raw HTML' mode.
"""
self
.
set_content
(
content
)
if
raw
:
self
.
set_raw_content
(
content
)
else
:
self
.
set_content
(
content
)
self
.
cancel
()
def
set_content
(
self
,
content
):
"""Types content into the html component, leaving the component open.
Arguments:
content (str): The content to be used.
"""
Types content into the html component, leaving the component open.
"""
sel
f
.
q
(
css
=
'.edit-xblock-modal .editor-modes .editor-button'
)
.
click
()
editor
=
self
.
q
(
css
=
self
.
_bounded_selector
(
'.html-editor .mce-edit-area'
))[
0
]
self
.
q
(
css
=
self
.
editor_mode_css
)
.
click
()
sel
ector
=
'.html-editor .mce-edit-area'
editor
=
self
.
q
(
css
=
self
.
_bounded_selector
(
selector
))[
0
]
ActionChains
(
self
.
browser
)
.
click
(
editor
)
.
\
send_keys
([
Keys
.
CONTROL
,
'a'
])
.
key_up
(
Keys
.
CONTROL
)
.
send_keys
(
content
)
.
perform
()
send_keys
([
Keys
.
CONTROL
,
'a'
])
.
key_up
(
Keys
.
CONTROL
)
.
\
send_keys
(
content
)
.
perform
()
def
set_raw_content
(
self
,
content
):
"""Types content in raw html mode, leaving the component open.
Arguments:
content (str): The content to be used.
"""
self
.
q
(
css
=
self
.
editor_mode_css
)
.
click
()
self
.
q
(
css
=
'[aria-label="Edit HTML"]'
)
.
click
()
#Focus goes to the editor by default
ActionChains
(
self
.
browser
)
.
send_keys
([
Keys
.
CONTROL
,
'a'
])
.
\
key_up
(
Keys
.
CONTROL
)
.
send_keys
(
content
)
.
perform
()
self
.
q
(
css
=
'.mce-foot .mce-primary'
)
.
click
()
common/test/acceptance/tests/studio/test_studio_container.py
View file @
0d2dc431
...
...
@@ -293,6 +293,24 @@ class EditContainerTest(NestedVerticalTest):
container
=
self
.
go_to_nested_container_page
()
self
.
modify_display_name_and_verify
(
container
)
def
test_edit_raw_html
(
self
):
"""
Test the raw html editing functionality.
"""
modified_content
=
"<p>modified content</p>"
#navigate to and open the component for editing
unit
=
self
.
go_to_unit_page
()
container
=
unit
.
xblocks
[
1
]
.
go_to_container
()
component
=
container
.
xblocks
[
1
]
.
children
[
0
]
component
.
edit
()
html_editor
=
HtmlComponentEditorView
(
self
.
browser
,
component
.
locator
)
html_editor
.
set_content_and_save
(
modified_content
,
raw
=
True
)
#note we're expecting the <p> tags to have been removed
self
.
assertEqual
(
component
.
student_content
,
"modified content"
)
class
EditVisibilityModalTest
(
ContainerBase
):
"""
...
...
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