From c0624cdb4890bade079880e1ff47cc26cc6695c7 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Fri, 2 Mar 2012 14:03:51 -0300
Subject: [PATCH] Use url list instead single url to run multiple tests at
 once.

---
 .../Zuite_createAndLaunchSeleniumTest.xml     |  11 +-
 .../Zuite_runSeleniumTest.xml                 |  20 +-
 .../Zuite_viewZeleniumTestLauncher.xml        |   3 +-
 .../your_description.xml                      | 260 ++++++++++++++++++
 .../your_test_id.xml                          | 101 -------
 .../{your_url.xml => your_url_list.xml}       |  17 +-
 bt5/erp5_ui_test_core/bt/revision             |   2 +-
 7 files changed, 288 insertions(+), 126 deletions(-)
 create mode 100644 bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_description.xml
 delete mode 100644 bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_test_id.xml
 rename bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/{your_url.xml => your_url_list.xml} (86%)

diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_createAndLaunchSeleniumTest.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_createAndLaunchSeleniumTest.xml
index a632dfb48d..4aeb057a4d 100644
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_createAndLaunchSeleniumTest.xml
+++ b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_createAndLaunchSeleniumTest.xml
@@ -53,15 +53,14 @@
             <value> <string encoding="cdata"><![CDATA[
 
 """\n
-  Generate a Zuite (if necessary), create/update the test and redirect to the selenium test created/updated\n
-  url, web_page or web_page_reference must be set for it to work (or the context should be the Web Page in question)\n
+  test_list is composed by [(full_test_html , title), ]\n
+\n
 """\n
 \n
 zuite = context.getPortalObject().portal_tests.Zuite_addZuite(zuite_id)\n
 \n
-test = zuite.Zuite_addTest(test_id, \n
-                           title, \n
-                           text)\n
+for text, title in test_list:\n
+  zuite.Zuite_addTest(test_id, title, text)\n
 \n
 return zuite.Base_redirect("core/TestRunner.html?auto=true&test=..%2Ftest_suite_html&resultsUrl=..%2FpostResults")\n
 
@@ -70,7 +69,7 @@ return zuite.Base_redirect("core/TestRunner.html?auto=true&test=..%2Ftest_suite_
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>text, title, zuite_id, test_id</string> </value>
+            <value> <string>test_list, zuite_id, test_id=None</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_runSeleniumTest.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_runSeleniumTest.xml
index ae249ac593..b51df92199 100644
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_runSeleniumTest.xml
+++ b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_runSeleniumTest.xml
@@ -54,23 +54,19 @@
   Generate a Zuite (if necessary), create/update the test and redirect to the selenium test created/updated\n
   url, web_page or web_page_reference must be set for it to work (or the context should be the Web Page in question)\n
 """\n
+test_list = []\n
+count = 0\n
+for url in url_list:\n
+ count += 1\n
+ test_list.append((context.Zuite_urlRead(url), \'url%s\' % count),)\n
 \n
-validation = context.Zuite_viewZeleniumTestLauncherValidator(editor=None, \n
-                                                             request=context.REQUEST, \n
-                                                             validator = False)\n
-if not validation[\'result\']:\n
-  return context.Base_redirect(validation[\'form_id\'], \n
-                               keep_items = dict(portal_status_message=validation[\'portal_status_message\']))\n
-\n
-return context.Zuite_createAndLaunchSeleniumTest(text=context.Zuite_urlRead(url),\n
-                                                 title="Download From Web", \n
-                                                 zuite_id=zuite_id,\n
-                                                 test_id=test_id)\n
+return context.Zuite_createAndLaunchSeleniumTest(test_list=test_list,\n
+                                                 zuite_id=zuite_id)\n
 </string> </value>
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>url, zuite_id = \'tutorial_zuite\', test_id = \'\'</string> </value>
+            <value> <string>url_list, zuite_id=\'tutorial_zuite\'</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher.xml
index 147127a99a..c5d765264b 100644
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher.xml
+++ b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher.xml
@@ -82,9 +82,8 @@
                     <value>
                       <list>
                         <string>your_description</string>
-                        <string>your_url</string>
+                        <string>your_url_list</string>
                         <string>your_zuite_id</string>
-                        <string>your_test_id</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_description.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_description.xml
new file mode 100644
index 0000000000..e9f34fde27
--- /dev/null
+++ b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_description.xml
@@ -0,0 +1,260 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <global name="StringField" module="Products.Formulator.StandardFields"/>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>id</string> </key>
+            <value> <string>your_description</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>
+                <item>
+                    <key> <string>required_not_found</string> </key>
+                    <value> <string>Input is required but no input given.</string> </value>
+                </item>
+                <item>
+                    <key> <string>too_long</string> </key>
+                    <value> <string>Too much input was given.</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>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>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>truncate</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</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>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>hidden</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>truncate</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</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>noLabel</string> </value>
+                </item>
+                <item>
+                    <key> <string>default</string> </key>
+                    <value> <string>Include a URL for a HTML that contains a Selenium Test Code, in case of Test Page use TestPage_getSeleniumTest at the end of URL.</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>0</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>hidden</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>max_length</string> </key>
+                    <value> <string></string> </value>
+                </item>
+                <item>
+                    <key> <string>required</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>title</string> </key>
+                    <value> <string>Information</string> </value>
+                </item>
+                <item>
+                    <key> <string>truncate</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>unicode</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+                <item>
+                    <key> <string>whitespace_preserve</string> </key>
+                    <value> <int>0</int> </value>
+                </item>
+              </dictionary>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_test_id.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_test_id.xml
deleted file mode 100644
index e50f5075b4..0000000000
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_test_id.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>delegated_list</string> </key>
-            <value>
-              <list>
-                <string>description</string>
-                <string>title</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>your_test_id</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>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string></string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>tales</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string></string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>values</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>description</string> </key>
-                    <value> <string>Enter the id of the generated test (this will overwrite any test with the same id)</string> </value>
-                </item>
-                <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string>my_string_field</string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string>Base_viewFieldLibrary</string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string>Click to edit the target</string> </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value> <string>Test ID</string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url_list.xml
similarity index 86%
rename from bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url.xml
rename to bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url_list.xml
index ee44fbe073..6dc8947dad 100644
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url.xml
+++ b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_viewZeleniumTestLauncher/your_url_list.xml
@@ -11,8 +11,9 @@
             <value>
               <list>
                 <string>description</string>
-                <string>display_width</string>
+                <string>height</string>
                 <string>title</string>
+                <string>width</string>
               </list>
             </value>
         </item>
@@ -26,7 +27,7 @@
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>your_url</string> </value>
+            <value> <string>your_url_list</string> </value>
         </item>
         <item>
             <key> <string>message_values</string> </key>
@@ -91,19 +92,27 @@
                 </item>
                 <item>
                     <key> <string>field_id</string> </key>
-                    <value> <string>my_string_field</string> </value>
+                    <value> <string>my_lines_field</string> </value>
                 </item>
                 <item>
                     <key> <string>form_id</string> </key>
                     <value> <string>Base_viewFieldLibrary</string> </value>
                 </item>
+                <item>
+                    <key> <string>height</string> </key>
+                    <value> <int>10</int> </value>
+                </item>
                 <item>
                     <key> <string>target</string> </key>
                     <value> <string>Click to edit the target</string> </value>
                 </item>
                 <item>
                     <key> <string>title</string> </key>
-                    <value> <string>External Url</string> </value>
+                    <value> <string>External Urls</string> </value>
+                </item>
+                <item>
+                    <key> <string>width</string> </key>
+                    <value> <int>90</int> </value>
                 </item>
               </dictionary>
             </value>
diff --git a/bt5/erp5_ui_test_core/bt/revision b/bt5/erp5_ui_test_core/bt/revision
index 6139554210..8783e30511 100644
--- a/bt5/erp5_ui_test_core/bt/revision
+++ b/bt5/erp5_ui_test_core/bt/revision
@@ -1 +1 @@
-52
\ No newline at end of file
+53
\ No newline at end of file
-- 
2.30.9