From 4e478cef11bfabd256caa66b8cca8bbb5ba39749 Mon Sep 17 00:00:00 2001
From: Rafael Monnerat <rafael@nexedi.com>
Date: Wed, 29 Feb 2012 13:19:42 -0300
Subject: [PATCH] Do not parse the URL content, expect always a pure selenium
 test

The parse code were moved to run my docs business template, the responsability to parse it's own content are now from TestPage_getSeleniumTest.

This drop the dependency from this feature to Run My Docs.
---
 .../ExtensionTemplateItem/ERP5Zuite.py        | 40 -------------------
 .../Zuite_createAndLaunchSeleniumTest.xml     |  2 +-
 .../erp5_ui_test_core/Zuite_extractTest.xml   | 28 -------------
 .../Zuite_viewZeleniumTestLauncher.xml        |  1 +
 bt5/erp5_ui_test_core/bt/revision             |  2 +-
 5 files changed, 3 insertions(+), 70 deletions(-)
 delete mode 100644 bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_extractTest.xml

diff --git a/bt5/erp5_ui_test_core/ExtensionTemplateItem/ERP5Zuite.py b/bt5/erp5_ui_test_core/ExtensionTemplateItem/ERP5Zuite.py
index 0ef1c17393..d5c0f7f467 100644
--- a/bt5/erp5_ui_test_core/ExtensionTemplateItem/ERP5Zuite.py
+++ b/bt5/erp5_ui_test_core/ExtensionTemplateItem/ERP5Zuite.py
@@ -8,46 +8,6 @@ def urlread(url):
 def editZPT(zpt, text):
   zpt.pt_edit(text, 'text/html')
 
-"""
-  Remove everything but the test in a webpage
-"""
-def parseTutorial(text, title):
-  import lxml.html
-  from lxml import etree
-  root = lxml.html.fromstring(text)
-  table_list = root.xpath('//test')
-  html = """
-<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>"""+ title + """</title>
-  </head>
-  <body>
-    <table name="SELENIUM-TEST" cellpadding="1" cellspacing="1" border="1">
-      <thead>
-        <tr class="title">
-          <td colspan="3">"""+ title + """</td>
-        </tr>
-      </thead>
-      <tbody>
-"""
-
-  for table in table_list:
-    table = table[0]
-    if len(table) > 0:
-      for row in table[-1]:
-        if len(row) == 1:
-          html += row[0].text
-        else:
-          html += lxml.html.tostring(row)
-  html +="""
-      </tbody>
-    </table>
-  </body>
-</html>"""
-  return html
-
 """
   Add the test at the end of the webpage (overwrite the current test if there's already one) and hide it
 """
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 c37ae1edf8..a632dfb48d 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
@@ -61,7 +61,7 @@ zuite = context.getPortalObject().portal_tests.Zuite_addZuite(zuite_id)\n
 \n
 test = zuite.Zuite_addTest(test_id, \n
                            title, \n
-                           context.Zuite_extractTest(text, title))\n
+                           text)\n
 \n
 return zuite.Base_redirect("core/TestRunner.html?auto=true&test=..%2Ftest_suite_html&resultsUrl=..%2FpostResults")\n
 
diff --git a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_extractTest.xml b/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_extractTest.xml
deleted file mode 100644
index b37d339db4..0000000000
--- a/bt5/erp5_ui_test_core/SkinTemplateItem/portal_skins/erp5_ui_test_core/Zuite_extractTest.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>_function</string> </key>
-            <value> <string>parseTutorial</string> </value>
-        </item>
-        <item>
-            <key> <string>_module</string> </key>
-            <value> <string>ERP5Zuite</string> </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>Zuite_extractTest</string> </value>
-        </item>
-        <item>
-            <key> <string>title</string> </key>
-            <value> <string>Extract Zelenium Test from tutorial</string> </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
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 ecf6b3d7c7..147127a99a 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
@@ -81,6 +81,7 @@
                     <key> <string>center</string> </key>
                     <value>
                       <list>
+                        <string>your_description</string>
                         <string>your_url</string>
                         <string>your_zuite_id</string>
                         <string>your_test_id</string>
diff --git a/bt5/erp5_ui_test_core/bt/revision b/bt5/erp5_ui_test_core/bt/revision
index 7003e7fe1f..6139554210 100644
--- a/bt5/erp5_ui_test_core/bt/revision
+++ b/bt5/erp5_ui_test_core/bt/revision
@@ -1 +1 @@
-51
\ No newline at end of file
+52
\ No newline at end of file
-- 
2.30.9