Commit 1c10b4ef authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] ReportBox fields and report_view page template support.

ReportSections are rendered as 'embedded' forms.

As selections are not used in erp5js, any python code (TALES expresssion for example) accessing them will not return the expected value. Such code should probably be rewritten (no idea how yet).
parent 48bd58c6
...@@ -83,16 +83,19 @@ def getFormRelativeUrl(form): ...@@ -83,16 +83,19 @@ def getFormRelativeUrl(form):
def getFieldDefault(traversed_document, field, key, value=None): def getFieldDefault(traversed_document, field, key, value=None):
# REQUEST.get(field.id, field.get_value("default")) # REQUEST.get(field.id, field.get_value("default"))
return traversed_document.Field_getDefaultValue(field, key, value, REQUEST) result = traversed_document.Field_getDefaultValue(field, key, value, REQUEST)
if getattr(result, 'translate', None) is not None:
result = "%s" % result
return result
def renderField(traversed_document, field, form_relative_url, value=None, meta_type=None, key=None): def renderField(traversed_document, field, form_relative_url, value=None, meta_type=None, key=None, key_prefix=None, selection_params=None):
if meta_type is None: if meta_type is None:
meta_type = field.meta_type meta_type = field.meta_type
if key is None: if key is None:
key = field.generate_field_key() key = field.generate_field_key(key_prefix=key_prefix)
if meta_type == "ProxyField": if meta_type == "ProxyField":
result = renderField(traversed_document, field, form_relative_url, value, meta_type=field.getRecursiveTemplateField().meta_type, key=key) result = renderField(traversed_document, field, form_relative_url, value, meta_type=field.getRecursiveTemplateField().meta_type, key=key, key_prefix=key_prefix, selection_params=selection_params)
elif meta_type == "ListField": elif meta_type == "ListField":
result = { result = {
"type": meta_type, "type": meta_type,
...@@ -323,6 +326,8 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t ...@@ -323,6 +326,8 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
portal_types = field.get_value('portal_types') portal_types = field.get_value('portal_types')
default_params = dict(field.get_value('default_params')) default_params = dict(field.get_value('default_params'))
default_params['ignore_unknown_columns'] = True default_params['ignore_unknown_columns'] = True
if selection_params is not None:
default_params.update(selection_params)
# How to implement pagination? # How to implement pagination?
# default_params.update(REQUEST.form) # default_params.update(REQUEST.form)
lines = field.get_value('lines') lines = field.get_value('lines')
...@@ -412,7 +417,7 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t ...@@ -412,7 +417,7 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
return result return result
def renderForm(traversed_document, form, response_dict): def renderForm(traversed_document, form, response_dict, key_prefix=None, selection_params=None):
REQUEST.set('here', traversed_document) REQUEST.set('here', traversed_document)
field_errors = REQUEST.get('field_errors', {}) field_errors = REQUEST.get('field_errors', {})
...@@ -465,7 +470,7 @@ def renderForm(traversed_document, form, response_dict): ...@@ -465,7 +470,7 @@ def renderForm(traversed_document, form, response_dict):
# field_list.append((field.id, renderRawField(field))) # field_list.append((field.id, renderRawField(field)))
if field.get_value("enabled"): if field.get_value("enabled"):
try: try:
response_dict[field.id] = renderField(traversed_document, field, form_relative_url) response_dict[field.id] = renderField(traversed_document, field, form_relative_url, key_prefix=key_prefix, selection_params=selection_params)
if field_errors.has_key(field.id): if field_errors.has_key(field.id):
response_dict[field.id]["error_text"] = field_errors[field.id].error_text response_dict[field.id]["error_text"] = field_errors[field.id].error_text
except AttributeError: except AttributeError:
...@@ -499,6 +504,27 @@ def renderForm(traversed_document, form, response_dict): ...@@ -499,6 +504,27 @@ def renderForm(traversed_document, form, response_dict):
# "form": raw_response_dict # "form": raw_response_dict
# } # }
if (form.pt == 'report_view'):
  • Saw by chance and was wondering, is there a reason that it is not just

       if form.pt == 'report_view':

    here (and in several other cases on this script)

Please register or sign in to reply
report_item_list = []
report_result_list = []
for field in form.get_fields():
if field.getRecursiveTemplateField().meta_type == 'ReportBox':
report_item_list.extend(field.render())
j = 0
for report_item in report_item_list:
report_context = report_item.getObject(portal)
report_prefix = 'x%s' % j
j += 1
report_title = report_item.getTitle()
# report_class = "report_title_level_%s" % report_item.getLevel()
report_form = report_item.getFormId()
report_result = {'_links': {}}
renderForm(traversed_document, getattr(report_context, report_item.getFormId()),
report_result, key_prefix=report_prefix,
selection_params=report_item.selection_params)
report_result_list.append(report_result)
response_dict['report_section_list'] = report_result_list
# XXX form action update, etc # XXX form action update, etc
def renderRawField(field): def renderRawField(field):
...@@ -1024,6 +1050,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None, ...@@ -1024,6 +1050,8 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
if same_type(property_value, DateTime()): if same_type(property_value, DateTime()):
# Serialize DateTime # Serialize DateTime
property_value = property_value.rfc822() property_value = property_value.rfc822()
elif getattr(property_value, 'translate', None) is not None:
property_value = "%s" % property_value
document_result[select] = property_value document_result[select] = property_value
result_list.append(document_result) result_list.append(document_result)
result_dict['_embedded'] = {"contents": result_list} result_dict['_embedded'] = {"contents": result_list}
......
...@@ -586,6 +586,71 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin): ...@@ -586,6 +586,71 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['method'], 'POST') self.assertEqual(result_dict['_embedded']['_view']['_actions']['put']['method'], 'POST')
@simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"')
@simulate('Base_getRequestHeader', '*args, **kwargs',
'return "application/hal+json"')
@changeSkin('Hal')
def test_getHateoasDocument_report_view(self):
document = self._makeDocument()
fake_request = do_fake_request("GET")
result = self.portal.web_site_module.hateoas.ERP5Document_getHateoas(REQUEST=fake_request, mode="traverse", relative_url=document.getRelativeUrl(), view="history")
self.assertEquals(fake_request.RESPONSE.status, 200)
self.assertEquals(fake_request.RESPONSE.getHeader('Content-Type'),
"application/hal+json"
)
result_dict = json.loads(result)
# Check embedded form rendering
self.assertEqual(result_dict['_embedded']['_view']['form_id']['default'], 'Base_viewHistory')
self.assertEqual(result_dict['_embedded']['_view']['form_id']['editable'], 0)
self.assertEqual(result_dict['_embedded']['_view']['form_id']['hidden'], 1)
self.assertEqual(result_dict['_embedded']['_view']['form_id']['key'], 'form_id')
self.assertEqual(result_dict['_embedded']['_view']['form_id']['required'], 1)
self.assertEqual(result_dict['_embedded']['_view']['form_id']['type'], 'StringField')
self.assertEqual(result_dict['_embedded']['_view']['your_zodb_history']['title'], 'View ZODB History')
self.assertEqual(result_dict['_embedded']['_view']['your_zodb_history']['key'], 'field_your_zodb_history')
self.assertEqual(result_dict['_embedded']['_view']['your_zodb_history']['type'], 'LinkField')
# Check embedded report section rendering
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['default'], 'Base_viewWorkflowHistory')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['editable'], 0)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['hidden'], 1)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['key'], 'form_id')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['required'], 1)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['form_id']['type'], 'StringField')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['_links']['traversed_document']['href'], 'urn:jio:get:%s' % document.getRelativeUrl())
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['_links']['traversed_document']['name'], document.getRelativeUrl())
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['_links']['traversed_document']['title'], document.getTitle().decode("UTF-8"))
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['_links']['form_definition']['href'], 'urn:jio:get:portal_skins/erp5_core/Base_viewWorkflowHistory')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['_links']['form_definition']['name'], 'Base_viewWorkflowHistory')
self.assertSameSet(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['default_params'].keys(), ['checked_permission', 'ignore_unknown_columns', 'workflow_id', 'workflow_title'])
self.assertTrue(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['default_params']['ignore_unknown_columns'])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['default_params']['checked_permission'], 'View')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['default_params']['workflow_id'], 'foo_workflow')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['default_params']['workflow_title'], 'Foo Workflow')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['type'], 'ListBox')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['key'], 'x1_listbox')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['title'], 'Workflow History')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['lines'], 15)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['editable'], 1)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['show_anchor'], 0)
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['list_method'], 'Base_getWorkflowHistoryItemList')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['query'], 'urn:jio:allDocs?query=')
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['portal_type'], [])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['column_list'], [['action', 'Action'], ['state', 'State'], ['actor', 'Actor'], ['time', 'Time'], ['comment', 'Comment'], ['error_message', 'Error Message']])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['search_column_list'], [])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['editable_column_list'], [['time', 'Time'], ['comment', 'Comment'], ['error_message', 'Error Message']])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['sort_column_list'], [])
self.assertEqual(result_dict['_embedded']['_view']['report_section_list'][1]['listbox']['list_method_template'],
'%s/web_site_module/hateoas/ERP5Document_getHateoas?mode=search&relative_url=foo_module%%2F%s&form_relative_url=portal_skins/erp5_core/Base_viewWorkflowHistory/listbox&list_method=Base_getWorkflowHistoryItemList&default_param_json=eyJ3b3JrZmxvd19pZCI6ICJmb29fd29ya2Zsb3ciLCAicG9ydGFsX3R5cGUiOiBbXSwgImNoZWNrZWRfcGVybWlzc2lvbiI6ICJWaWV3IiwgIndvcmtmbG93X3RpdGxlIjogIkZvbyBXb3JrZmxvdyIsICJpZ25vcmVfdW5rbm93bl9jb2x1bW5zIjogdHJ1ZX0={&query,select_list*,limit*,sort_on*,local_roles*}' % (self.portal.absolute_url(), document.getId()))
@simulate('Base_getRequestUrl', '*args, **kwargs', @simulate('Base_getRequestUrl', '*args, **kwargs',
'return "http://example.org/bar"') 'return "http://example.org/bar"')
@simulate('Base_getRequestHeader', '*args, **kwargs', @simulate('Base_getRequestHeader', '*args, **kwargs',
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n CACHE MANIFEST\n
# generated on Mon, 14 Mar 2016 17:00:00 GMT\n # generated on Mon, 17 Mar 2016 10:30:00 GMT\n
# XXX + fonts\n # XXX + fonts\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
...@@ -200,6 +200,8 @@ gadget_erp5_pt_form_view.html\n ...@@ -200,6 +200,8 @@ gadget_erp5_pt_form_view.html\n
gadget_erp5_pt_form_view.js\n gadget_erp5_pt_form_view.js\n
gadget_erp5_pt_form_view_editable.html\n gadget_erp5_pt_form_view_editable.html\n
gadget_erp5_pt_form_view_editable.js\n gadget_erp5_pt_form_view_editable.js\n
gadget_erp5_pt_report_view.html\n
gadget_erp5_pt_report_view.js\n
gadget_erp5_router.html\n gadget_erp5_router.html\n
gadget_erp5_router.js\n gadget_erp5_router.js\n
gadget_erp5_search_editor.html\n gadget_erp5_search_editor.html\n
...@@ -354,7 +356,7 @@ NETWORK:\n ...@@ -354,7 +356,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>949.54244.51148.7697</string> </value> <value> <string>949.57009.13281.34457</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -372,7 +374,7 @@ NETWORK:\n ...@@ -372,7 +374,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1457975347.2</float> <float>1458210932.53</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<title>ERP5 PT Report View</title>
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<script src="URI.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_global.js" type="text/javascript"></script>
<script src="gadget_erp5_pt_report_view.js" type="text/javascript"></script>
</head>
<body>
<div class='form_view'></div>
<div class='report_section_list'></div>
</body>
</html>
\ No newline at end of file
/*global window, document, rJS, RSVP, URI */
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 79 */
(function (window, document, rJS, RSVP, URI) {
"use strict";
function createSectionGadget(gadget, queue, report_section) {
var uri = new URI(report_section._links.form_definition.href),
form_definition;
queue
.push(function () {
return gadget.jio_getAttachment(uri.segment(2), "view");
})
.push(function (result) {
form_definition = result;
var section_list_element = gadget.props
.element.querySelector('.report_section_list'),
section_element = document.createElement('div');
section_list_element.appendChild(section_element);
return gadget.declareGadget('gadget_erp5_pt_form_view.html', {
element: section_element
});
})
.push(function (form_gadget) {
var erp5_document = {
'_embedded': {
'_view': report_section
}
};
return form_gadget.render({erp5_document: erp5_document,
form_definition: form_definition});
});
}
// Precompile the templates while loading the first gadget instance
var gadget_klass = rJS(window);
gadget_klass
/////////////////////////////////////////////////////////////////
// ready
/////////////////////////////////////////////////////////////////
// Init local properties
.ready(function (g) {
g.props = {};
})
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.allowPublicAcquisition('updateHeader', function (argument_list, scope) {
// Fetch menu configuration from main form
if (scope === 'form_view') {
return this.updateHeader.apply(this, argument_list);
}
return;
})
.declareMethod('render', function (options) {
var erp5_document = options.erp5_document,
form_definition = options.form_definition,
rendered_form = erp5_document._embedded._view,
gadget = this,
report_section_list = rendered_form.report_section_list,
form_gadget_url;
delete options.erp5_document;
delete options.form_definition;
if (options.editable) {
form_gadget_url = 'gadget_erp5_pt_form_view_editable.html';
} else {
form_gadget_url = 'gadget_erp5_pt_form_view.html';
}
return gadget.declareGadget(form_gadget_url, {
element: gadget.props.element.querySelector('.form_view'),
scope: 'form_view'
})
.push(function (view_gadget) {
return view_gadget.render({erp5_document: erp5_document,
form_definition: form_definition});
})
// Render the report sections
.push(function () {
var i,
queue = new RSVP.Queue();
for (i = 0; i < report_section_list.length; i += 1) {
createSectionGadget(gadget, queue, report_section_list[i]);
}
return queue;
});
});
}(window, document, rJS, RSVP, URI));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testReportViewDisplayReportSectionForms</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form Report Get Header From Editable Value</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form Report Get Header From Editable Value</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='History' and contains(@href, '#!change') and contains(@href, 'history') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_report_view.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Current</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Draft</td>
<td></td>
</tr>
<!-- There is a form_view gadget containing the main fields -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='x0_listbox']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='x0_listbox']//a[text()='Current']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='x1_listbox']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='x1_listbox']//a[text()='Draft']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testReportViewDisplayUsualFields</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form Report Get Header From Editable Value</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form Report Get Header From Editable Value</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='History' and contains(@href, '#!change') and contains(@href, 'history') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_report_view.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>View ZODB History</td>
<td></td>
</tr>
<!-- There is a form_view gadget containing the main fields -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html' and @class='form_view']</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_view_editable.html' and @class='form_view']//label[@for='field_your_zodb_history']</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testReportViewGetHeaderFromEditableValue</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form Report Get Header From Editable Value</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Form Report Get Header From Editable Value</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module/1?page=tab</td>
<td></td>
</tr>
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_tab.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Title 1</td>
<td></td>
</tr>
<!-- Follow one link -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='History' and contains(@href, '#!change') and contains(@href, 'history') and contains(@href, 'u.page=') and contains(@href, 'n.editable=true')]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_report_view.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>View ZODB History</td>
<td></td>
</tr>
<!-- Header has a link to the action page -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='header']//a[text()='Add' and contains(@href, '#!change') and contains(@href, 'view%3Dcreate_a_document')]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
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