Commit 30b82e54 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_gadget_interface_validator*] Delay loading of all renderjs iframe gadget

This is really a hack, which may be integrated into renderJS directly

Reduce potential Zelenium test timeout by waiting for iframe to be loaded one by one
parent 076ddfb2
......@@ -228,19 +228,32 @@
}
}
var interface_loader_defer = RSVP.defer(),
counter = 0;
interface_loader_defer.resolve('Bootstrap');
function getOrDeclareGadget(context, gadget_to_check_url) {
return context.getDeclaredGadget(gadget_to_check_url)
.push(undefined, function (error) {
var element,
loader_gadget;
loader_gadget,
current_defer;
if (error instanceof rJS.ScopeError) {
element = document.createElement('div');
context.element.querySelector('div').appendChild(element);
return new RSVP.Queue()
.push(function () {
return RSVP.delay(context.state.delay || 0);
context.element.firstElementChild.textContent =
'Waiting ' + counter;
// Wait for previous defer, and create a new one.
var previous_deferred = interface_loader_defer;
current_defer = RSVP.defer();
interface_loader_defer = current_defer;
counter += 1;
return previous_deferred.promise;
})
.push(function () {
context.element.firstElementChild.textContent = 'Loading';
// XXX Load in an iframe
return context.declareGadget('gadget_interface_loader.html', {
scope: gadget_to_check_url,
......@@ -253,7 +266,12 @@
return loader_gadget.declareGadgetToCheck(gadget_to_check_url);
})
.push(function () {
// Iframe loaded, unblock the next iteration
current_defer.resolve();
return loader_gadget;
}, function (error) {
current_defer.resolve();
throw error;
});
}
throw error;
......@@ -434,6 +452,9 @@
}
if (context.state.summary) {
if (error_message !== '') {
console.warn(error_message, error_list);
}
error_message = summary_message;
} else {
error_message = summary_message + '\n\n' + error_message;
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.16725.23340.23244</string> </value>
<value> <string>972.15264.49528.31470</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1536917151.09</float>
<float>1544521627.98</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -37,8 +37,7 @@
sandbox: "",
renderjs_extra: JSON.stringify({
gadget_to_check_url: result.data.rows[i].value.url,
summary: true,
delay: 200 * i
summary: true
}),
key: "field_my_validation_state",
hidden: 0,
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.16729.9437.60518</string> </value>
<value> <string>972.15241.36748.63146</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1536917386.61</float>
<float>1544537143.01</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -10,44 +10,10 @@
<tr><td rowspan="1" colspan="3">Test Gadget Interface Validation UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>store</td>
<td>gadget_interface_validator</td>
<td>application_title</td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/${application_title}/</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block tal:define="filter_section_configuration python: {'key': 'COLUMN_appcache_url', 'value': 'gadget_interface_validator_test.appcache', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
<tal:block tal:define="check_configuration python: {'app_cache_reference': 'gadget_interface_validator_test.appcache',
'gadget_count': 8}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/run_app_interface_check" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_filter" />
<tr>
<td>waitForTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check correct use case</b></td>
......
......@@ -9,65 +9,15 @@
<thead>
<tr><td rowspan="1" colspan="3">Test ERP5JS Application Interface</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr>
<td>store</td>
<td>gadget_interface_validator</td>
<td>application_title</td>
</tr>
<tr>
<td>open</td>
<td>${base_url}/web_site_module/${application_title}/</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block tal:define="filter_section_configuration python: {'key': 'COLUMN_appcache_url', 'value': 'gadget_erp5.appcache', 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
<tal:block tal:define="check_configuration python: {'app_cache_reference': 'gadget_erp5.appcache',
'gadget_count': 63}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/run_app_interface_check" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_filter" />
<tr>
<td>waitForTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td colspan="3"><b>Check no error is reported</b></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>N/A</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Failure</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Error</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/check_app_interface_ok" />
</tbody></table>
</body>
......
<?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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>description</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>text</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Common Template for PTZuite, it will reuse parts of the Listbox Zuite</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Zuite_CommonTemplateForRenderjsUiInterface</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>Common Template for All Renderjs ui Zuite</unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="run_app_interface_check">
<tr>
<td>open</td>
<td>${base_url}/web_site_module/gadget_interface_validator/</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/triggle_filter_and" />
<tal:block tal:define="filter_section_configuration python: {'key': 'COLUMN_appcache_url', 'value': check_configuration['app_cache_reference'], 'index': 0}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/set_filter_section" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_filter" />
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url, 'gadget_erp5_field_listbox.html')]//h1//span[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>waitForTextPresent</td>
<td>Waiting</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Waiting</td>
<td></td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>In Progress</td>
<td></td>
</tr>
<!-- Step of 10, to prevent wait conflict between 'Waiting 2' and 'Waiting 20' -->
<tal:block tal:repeat="step python: range(0, check_configuration['gadget_count'] - 1, 10)">
<tr>
<td>waitForTextNotPresent</td>
<td tal:content="python: 'Waiting %i' % step"></td>
<td></td>
</tr>
</tal:block>
<tr>
<td>waitForTextNotPresent</td>
<td>Waiting</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Waiting</td>
<td></td>
</tr>
<tr>
<td>waitForTextNotPresent</td>
<td>Loading</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Loading</td>
<td></td>
</tr>
<tal:block tal:define="pagination_configuration python: {'header': '(%i)' % check_configuration['gadget_count'], 'footer': '%i Records' % check_configuration['gadget_count']}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
</tal:block>
</tal:block>
<tal:block metal:define-macro="check_app_interface_ok">
<tr>
<td colspan="3"><b>Check no error is reported</b></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>N/A</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Failure</td>
<td></td>
</tr>
<tr>
<td>assertTextNotPresent</td>
<td>Error</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
</tal:block>
</tal:block>
\ 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