Skip to content
This repository was archived by the owner on Apr 7, 2022. It is now read-only.

Commit 1d92f44

Browse files
authored
Merge pull request #10337 from jaryn/fix_CodeMirror_filling
[RFR] Fix CodeMirror filling.
2 parents 01588ca + c3e25ce commit 1d92f44

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

cfme/tests/services/test_provision_stack.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ def svc_cleanup(service):
206206

207207

208208
@test_requirements.provision
209-
@pytest.mark.meta(blockers=[BZ(1754543)])
210209
def test_provision_stack(order_stack, stack_created):
211210
"""Tests stack provisioning
212211
@@ -251,7 +250,6 @@ def test_reconfigure_service(appliance, service_catalogs, request):
251250
filters=[cloud_filter, not_ec2],
252251
selector=ONE_PER_TYPE,
253252
scope='module')
254-
@pytest.mark.meta(blockers=[BZ(1754543)])
255253
def test_remove_non_read_only_orch_template(appliance, provider, template, service_catalogs,
256254
request):
257255
"""
@@ -316,7 +314,6 @@ def test_remove_read_only_orch_template_neg(appliance, provider, template, order
316314
assert order_stack.is_succeeded()
317315

318316

319-
@pytest.mark.meta(blockers=[BZ(1754543)])
320317
def test_retire_stack(stack_created):
321318
"""Tests stack retirement.
322319
@@ -468,7 +465,6 @@ def _clear_retire_request():
468465

469466

470467
@pytest.mark.meta(automates=[1698439])
471-
@pytest.mark.meta(blockers=[BZ(1754543)])
472468
@pytest.mark.tier(2)
473469
@pytest.mark.provider([EC2Provider], selector=ONE, scope='module')
474470
def test_read_dialog_timeout_ec2_stack(order_stack):

widgetastic_manageiq/__init__.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,9 @@ class ReactCodeMirror(Widget):
10321032
https://github.com/JedWatson/react-codemirror"""
10331033

10341034
ROOT = "//div[contains(@class,'miq-codemirror')]//textarea"
1035-
PARENT_DIV = "./.." # we need to change visibility of this one
1036-
CLICK_DIV = "./../.." # the widget has very nested divs,we need to click on that one ¯\_(ツ)_/¯
1035+
1036+
# The CodeMirror has very nested divs, we need to setValue on this one ¯\_(ツ)_/¯.
1037+
SET_VALUE_ELEMENT = "../.."
10371038

10381039
def __init__(self, parent, logger=None):
10391040
Widget.__init__(self, parent, logger=logger)
@@ -1042,20 +1043,16 @@ def __init__(self, parent, logger=None):
10421043
def element(self):
10431044
return self.browser.element(self)
10441045

1045-
@property
1046-
def is_editable(self):
1047-
return self.element.get_attribute("contentEditable") == "true"
1048-
1049-
def make_editable(self):
1050-
if not self.is_editable:
1051-
self.browser.set_attribute("contentEditable", "true", self)
1052-
10531046
def fill(self, value):
1054-
# TODO(anikifor): remove the 2 workarounds below as soon as BZ 1740753 is verified
1055-
self.make_editable()
1056-
self.browser.set_attribute("style", "overflow: visible", self.PARENT_DIV)
1057-
self.browser.element(self.CLICK_DIV).click()
1058-
self.element.send_keys(value)
1047+
# CodeMirror is too smart for filling with send_keys.
1048+
# Fixing BZ#1740753 and BZ#1754543 didn't really help.
1049+
# Now the problem is that the CodeMirror auto-indents which means
1050+
# additional indents are created when using send_keys.
1051+
self.browser.execute_script(
1052+
"""arguments[0].CodeMirror.setValue(arguments[1])""",
1053+
self.browser.element(self.SET_VALUE_ELEMENT),
1054+
value,
1055+
)
10591056
return True
10601057

10611058
def read(self):

0 commit comments

Comments
 (0)