Commit 7f0ce885 authored by Romain Courteaud's avatar Romain Courteaud

erp5_test_result: change TestResultLine_view to correctly render in ERP5JS

Use editor gadget to render the output as raw data.

Use the page class to improve xhtml style rendering
parent 879588b6
......@@ -10,9 +10,10 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>editable</string>
<string>renderjs_extra</string>
<string>title</string>
<string>height</string>
<string>width</string>
</list>
</value>
</item>
......@@ -50,6 +51,14 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -58,6 +67,16 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -65,9 +84,17 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>page</string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_raw_text_content</string> </value>
<value> <string>my_view_mode_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
......@@ -77,6 +104,12 @@
<key> <string>height</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Command Line</string> </value>
......@@ -91,4 +124,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', context.Base_getEditorFieldPreferredTextEditor(content_type=\'text/plain\')), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\'))]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,9 +10,10 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>extra</string>
<string>renderjs_extra</string>
<string>title</string>
<string>height</string>
<string>width</string>
</list>
</value>
</item>
......@@ -50,6 +51,10 @@
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -58,6 +63,16 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -65,9 +80,17 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>page</string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string>style="width: 100%"</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_raw_text_content</string> </value>
<value> <string>my_view_mode_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
......@@ -77,6 +100,12 @@
<key> <string>height</string> </key>
<value> <int>15</int> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Standard Error</string> </value>
......@@ -91,4 +120,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', context.Base_getEditorFieldPreferredTextEditor(content_type=\'text/plain\')), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\'))]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -10,8 +10,9 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>renderjs_extra</string>
<string>title</string>
<string>width</string>
</list>
</value>
</item>
......@@ -57,6 +58,16 @@
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
......@@ -64,14 +75,24 @@
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>page</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_raw_text_content</string> </value>
<value> <string>my_view_mode_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Standard Output</string> </value>
......@@ -86,4 +107,17 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'jio_key\', context.getRelativeUrl()), (\'editor\', context.Base_getEditorFieldPreferredTextEditor(content_type=\'text/plain\')), (\'portal_type\', context.getPortalType()), (\'maximize\', \'listbox\' not in field.id), (\'content_type\', context.getProperty(\'content_type\'))]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
  • @romain : in TestResultLine_view for functional tests, we lost the red coloring of the step that failed. ie:

    https://erp5js.nexedi.net/#/test_result_module/20210908-5AB3C3CE/207

    Could it come from this commit ?

    /cc @xiaowu.zhang

  • probably not, because i remember that red coloring for failed step is no longer available since long long time

    because inline styles is not allowed by our CSP

  • Was it also the case for xhtml_style :

    https://erp5.nexedi.net/test_result_module/20210908-5AB3C3CE/207 ?

    (sorry, I should have pasted this link first, I don't know why I shared the renderjs one...)

  • no, css for failed step is present in data-gadget-value

    Screenshot_2021-09-09_09.39.50

    but gadget_html_viewer.html gadget seems not apply this value. it's my guess, not sure

  • I wrote the html viewer to add another security layer to prevent XSS injection.

    We use CSP in erp5js to drop inline CSS style.

    The HTML viewer also explicitely drop the STYLE element before injecting the HTML into the DOM.

    image

    Allowing any external CSS style can lead to interesting behaviour like a keylogger in pure CSS for example.

    Please note that the html viewer has a compatibility with some inline CSS property, to allow displaying content created with CKEditor for example.

    If you want to get back the red color in the test result display, I'm in favor of changing the HTML test result.

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