Commit 76d3f5d8 by Ben Patterson

Merge pull request #12196 from edx/muddasser/updated_ff/sel_253/test_edit_raw_html

Use type_in_codemirror instead of ActionChain to set content.
parents 090cefcf 5aaa0459
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from component_editor import ComponentEditorView from component_editor import ComponentEditorView
from common.test.acceptance.pages.studio.utils import type_in_codemirror
class HtmlComponentEditorView(ComponentEditorView): class HtmlComponentEditorView(ComponentEditorView):
...@@ -49,16 +48,13 @@ class HtmlComponentEditorView(ComponentEditorView): ...@@ -49,16 +48,13 @@ class HtmlComponentEditorView(ComponentEditorView):
def set_raw_content(self, content): def set_raw_content(self, content):
"""Types content in raw html mode, leaving the component open. """Types content in raw html mode, leaving the component open.
Arguments: Arguments:
content (str): The content to be used. content (str): The content to be used.
""" """
self.q(css=self.editor_mode_css).click() self.q(css=self.editor_mode_css).click()
self.q(css='[aria-label="Edit HTML"]').click() self.q(css='[aria-label="Edit HTML"]').click()
self.wait_for_element_visibility('.mce-title', 'Wait for CodeMirror editor') self.wait_for_element_visibility('.mce-title', 'Wait for CodeMirror editor')
# Set content in the CodeMirror editor.
#Focus goes to the editor by default type_in_codemirror(self, 0, content)
ActionChains(self.browser).send_keys([Keys.CONTROL, 'a']).\
key_up(Keys.CONTROL).send_keys(content).perform()
self.q(css='.mce-foot .mce-primary').click() self.q(css='.mce-foot .mce-primary').click()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment