Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
7b5083e3
Commit
7b5083e3
authored
Dec 03, 2015
by
Georgios Dagkakis
Committed by
Sebastien Robin
Dec 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
live_test: use renderjs to refresh the view of live tests
parent
7834e1db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
506 additions
and
116 deletions
+506
-116
bt5/erp5_dhtml_style/SkinTemplateItem/portal_skins/erp5_dhtml_style/live_test.js.xml
...mplateItem/portal_skins/erp5_dhtml_style/live_test.js.xml
+0
-116
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
...rtal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
+1
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/test_watcher_gadget.xml
.../ComponentTool_viewLiveTestDialog/test_watcher_gadget.xml
+255
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_live_tests.html.xml
...ateItem/portal_skins/erp5_core/gadget_live_tests.html.xml
+76
-0
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_live_tests.js.xml
...plateItem/portal_skins/erp5_core/gadget_live_tests.js.xml
+174
-0
No files found.
bt5/erp5_dhtml_style/SkinTemplateItem/portal_skins/erp5_dhtml_style/live_test.js.xml
deleted
100644 → 0
View file @
7834e1db
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"File"
module=
"OFS.Image"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Cacheable__manager_id
</string>
</key>
<value>
<string>
http_cache
</string>
</value>
</item>
<item>
<key>
<string>
_EtagSupport__etag
</string>
</key>
<value>
<string>
ts32869305.67
</string>
</value>
</item>
<item>
<key>
<string>
__name__
</string>
</key>
<value>
<string>
live_test.js
</string>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
application/x-javascript
</string>
</value>
</item>
<item>
<key>
<string>
data
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
var live_test_js_already_loaded = false;\n
\n
$(document).ready(function(){\n
\n
if (live_test_js_already_loaded) {\n
console.error("Live test already loaded");\n
return;\n
}\n
live_test_js_already_loaded = true;\n
\n
\n
var my_url_run_test = $(document)[0].baseURI + \'runLiveTest\';\n
var my_url_read_test = $(document)[0].baseURI + \'readTestOutput\';\n
var paused = false;\n
\n
if (! $("*[name=\'field_your_test\']").val() ){\n
// not in proper page no need to continue\n
return ;\n
}\n
var data_textarea = $("*[name=\'field_your_text_output\']");\n
\n
data_textarea.val("");\n
\n
//launch unit test\n
var continue_loop = true;\n
$.get(my_url_run_test,\n
{test_list: $("*[name=\'field_your_test\']").val(),\n
run_only: $("*[name=\'field_your_run_only\']").val(),\n
debug: $("*[name=\'field_your_debug\']").is(":checked") ? 1 : 0,\n
verbose: $("*[name=\'field_your_verbose\']").is(":checked") ? 1: 0\n
},\n
function(data) {\n
continue_loop = false;\n
});\n
var last_call = false;\n
var data_size = 0;\n
get_data = function() {\n
return $.get(my_url_read_test,\n
{position : data_size},\n
function(data){\n
if ( !paused && data.length !== undefined ) {\n
data_size = data_size + data.length;\n
data_textarea.val( data_textarea.val() + data);\n
data_textarea[0].scrollTop = data_textarea[0].scrollHeight;\n
}\n
if (continue_loop) {\n
setTimeout(get_data, 1000);\n
}\n
if (!continue_loop) {\n
if (!last_call) {\n
last_call = true;\n
setTimeout(get_data, 1000);\n
}\n
}\n
});\n
};\n
\n
// Not perfect, but the timeout should clearly reduce risk of getting empty result\n
// while the runUnitTest command had no time yet to reset global variable\n
// on ERP5 side\n
setTimeout(get_data,2000);\n
\n
// pause refreshing if user scrolls in the textarea field\n
// reactivate refreshing when users scrolls back to bottom\n
data_textarea.scroll(function() {\n
paused = data_textarea.scrollTop() + data_textarea.height() != data_textarea[0].scrollHeight;\n
});\n
\n
});
]]>
</string>
</value>
</item>
<item>
<key>
<string>
precondition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
size
</string>
</key>
<value>
<int>
2082
</int>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog.xml
View file @
7b5083e3
...
...
@@ -76,6 +76,7 @@
<value>
<list>
<string>
your_text_output
</string>
<string>
test_watcher_gadget
</string>
</list>
</value>
</item>
...
...
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ComponentTool_viewLiveTestDialog/test_watcher_gadget.xml
0 → 100644
View file @
7b5083e3
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"GadgetField"
module=
"Products.ERP5Form.GadgetField"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test_watcher_gadget
</string>
</value>
</item>
<item>
<key>
<string>
message_values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
external_validator_failed
</string>
</key>
<value>
<string>
The input failed the external validator.
</string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
overrides
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
tales
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
values
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
alternate_name
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
css_class
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
data_url
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
default
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_maxwidth
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
display_width
</string>
</key>
<value>
<int>
20
</int>
</value>
</item>
<item>
<key>
<string>
editable
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
enabled
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
<item>
<key>
<string>
external_validator
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
extra
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
gadget_url
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
input_type
</string>
</key>
<value>
<string>
text
</string>
</value>
</item>
<item>
<key>
<string>
js_sandbox
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Test Watcher
</string>
</value>
</item>
</dictionary>
</value>
</item>
</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: field.restrictedTraverse(\'gadget_live_tests.html\').absolute_url()
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_live_tests.html.xml
0 → 100644
View file @
7b5083e3
<?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>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
<html>
\n
<head>
\n
<script
src=
"jio_sha256.amd.js"
type=
"text/javascript"
></script>
\n
<script
src=
"jio.js"
type=
"text/javascript"
></script>
\n
<script
src=
"gadget_live_tests.js"
type=
"text/javascript"
></script>
\n
</head>
\n
\n
<body>
\n
\n
</body>
\n
</html>
]]>
</unicode>
</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>
gadget_live_tests.html
</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>
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/gadget_live_tests.js.xml
0 → 100644
View file @
7b5083e3
<?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>
_text
</string>
</key>
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
/*global window, rJS, jIO, RSVP, location, document , FormData, console */\n
/*jslint indent: 2, maxlen: 80, nomen: true */\n
(function (rJS, jIO, RSVP, window, document, FormData, console) {\n
"use strict";\n
var live_test_js_already_loaded = false,\n
my_url_run_test = document.baseURI + \'runLiveTest\',\n
my_url_read_test = document.baseURI + \'readTestOutput\',\n
paused = false,\n
data_textarea =\n
document.querySelector("[name=\'field_your_text_output\']"),\n
continue_loop = true,\n
tests_still_running = true,\n
last_call = false,\n
data_size = 0,\n
form_data = new FormData();\n
\n
if (live_test_js_already_loaded) {\n
console.error("Live test already loaded");\n
return;\n
}\n
live_test_js_already_loaded = true;\n
\n
data_textarea.value = "";\n
\n
form_data.append("test_list",\n
document.querySelector("[name=\'field_your_test\']").value);\n
form_data.append("run_only",\n
document.querySelector("[name=\'field_your_run_only\']").value);\n
form_data.append("debug",\n
document.querySelector("[name=\'field_your_debug\']").checked ===\n
true ? 1 : 0);\n
form_data.append("verbose",\n
document.querySelector("[name=\'field_your_verbose\']").checked ===\n
true ? 1 : 0);\n
\n
// if the user scrolls in the window we do not want it to be updated.\n
// so set paused flag to false\n
function scrollFunction() {\n
paused = data_textarea.scrollHeight - data_textarea.scrollTop !==\n
data_textarea.clientHeight;\n
// if the service was paused when the tests are finished,\n
// set continue_loop to false\n
if (!paused && !tests_still_running) {\n
continue_loop = false;\n
}\n
}\n
\n
data_textarea.onscroll = scrollFunction;\n
\n
rJS(window).declareService(function () {\n
var queue = new RSVP.Queue();\n
\n
function readDataExamine() {\n
queue.push(function () {\n
return jIO.util.ajax({\n
type: "POST",\n
url: my_url_run_test,\n
data: form_data\n
});\n
}).push(function () {\n
tests_still_running = false;\n
// set continue_loop to false ONLY IF the test is not paused.\n
// Otherwise it will be set when user scrolls to the end\n
if (!paused) {\n
continue_loop = false;\n
}\n
});\n
}\n
return queue.push(function () {\n
return readDataExamine();\n
});\n
}).declareService(function () {\n
var queue = new RSVP.Queue();\n
\n
function getDataExamine() {\n
queue.push(function () {\n
return jIO.util.ajax({\n
type: "POST",\n
url: my_url_read_test\n
});\n
}).push(function (evt) {\n
var data = evt.target.response;\n
// cut the characters that are already presented\n
data = data.substring(data_size);\n
if ((!paused || last_call) && data.length !== undefined) {\n
// to put the data in the correct place\n
data_size = data_size + data.length;\n
// add the new data\n
data_textarea.value = data_textarea.value + data;\n
data_textarea.scrollTop = data_textarea.scrollHeight;\n
}\n
return RSVP.delay(1000);\n
}).push(function () {\n
if (continue_loop) {\n
return getDataExamine();\n
}\n
if (!continue_loop) {\n
if (!last_call) {\n
last_call = true;\n
return getDataExamine();\n
}\n
}\n
});\n
}\n
return queue.push(function () {\n
return getDataExamine();\n
});\n
});\n
}(rJS, jIO, RSVP, window, document, FormData, console));
]]>
</unicode>
</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>
gadget_live_tests.js
</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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment