Commit 05d11ccc authored by Rafael Monnerat's avatar Rafael Monnerat

Fix Selenium Test exportation

Zope Page Template cannot export an HTML with tales in appropriated way, so it is used a python script instead to generate initial part of the test.
parent 19ceedfd
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
request = context.REQUEST\n
\n
url = request.get(\'url\', None)\n
if url is not None:\n
html_init = """<tr>\n
<td>store</td>\n
<td>%s</td>\n
<td>base_url</td>\n
</tr>\n
""" % url\n
else:\n
html_init = """<span metal:use-macro="container/Zuite_CommonTemplate/macros/init" style="display: none;">init</span>"""\n
\n
html_init += """ <tr>\n
<td>store</td>\n
<!-- ERP5TypeTestCase is the default for any UnitTest -->\n
<td>%s</td>\n
<td>base_user</td>\n
</tr>\n
""" % request.get(\'user\', "ERP5TypeTestCase")\n
\n
html_init += """ <tr>\n
<td>store</td>\n
<td>%s</td>\n
<td>base_password</td>\n
</tr>""" % request.get(\'password\', "")\n
\n
return html_init\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TestPage_getSeleniumTestInit</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -59,7 +59,7 @@ if reference not in [None, \'\']:\n ...@@ -59,7 +59,7 @@ if reference not in [None, \'\']:\n
\n \n
test_script = getattr(context, \'Zuite_createAndLaunchSeleniumTest\', None)\n test_script = getattr(context, \'Zuite_createAndLaunchSeleniumTest\', None)\n
if test_script is None:\n if test_script is None:\n
raise ValueError("Unable to Launch the Test. Please install erp5_test_ui_core business template.")\n raise ValueError("Unable to Launch the Test. Please install erp5_ui_test_core business template.")\n
\n \n
return test_script(test_list=((context.TestPage_viewSeleniumTest(),context.getTitle()),), \n return test_script(test_list=((context.TestPage_viewSeleniumTest(),context.getTitle()),), \n
zuite_id=zuite_id)\n zuite_id=zuite_id)\n
......
...@@ -50,26 +50,8 @@ ...@@ -50,26 +50,8 @@
</tr>\n </tr>\n
</thead>\n </thead>\n
<tbody>\n <tbody>\n
<tr tal:condition="python: request.get(\'url\', None) is not None">\n <tal:block tal:replace="structure python:context.TestPage_getSeleniumTestInit()" />\n
<td>store</td>\n <tal:block tal:replace="structure python:context.TestPage_extractTest(context.asStrippedHTML())" />\n
<td tal:content="python:request.get(\'url\', None)">http://example.com/erp5</td>\n
<td>base_url</td>\n
</tr>\n
<tal:block tal:condition="python: request.get(\'url\', None) is None">\n
&lt;span metal:use-macro=&quot;container/Zuite_CommonTemplate/macros/init&quot; style=&quot;display: none;&quot;&gt;init&lt;/span&gt;\n
</tal:block>\n
<tr>\n
<td>store</td>\n
<!-- ERP5TypeTestCase is the default for any UnitTest -->\n
<td tal:content="python:request.get(\'user\', \'ERP5TypeTestCase\')">User</td>\n
<td>base_user</td>\n
</tr>\n
<tr>\n
<td>store</td>\n
<td tal:content="python:request.get(\'password\', \'\')">Password</td>\n
<td>base_password</td>\n
</tr>\n
<tal:block tal:replace="structure python:context.TestPage_extractTest(context.getTextContent())" />\n
</tbody>\n </tbody>\n
</table>\n </table>\n
</body>\n </body>\n
......
...@@ -188,11 +188,7 @@ class TestRunMyDoc(ERP5TypeTestCase): ...@@ -188,11 +188,7 @@ class TestRunMyDoc(ERP5TypeTestCase):
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<span metal:use-macro="container/Zuite_CommonTemplate/macros/init" style="display: none;">init</span> <tr>
&lt;span metal:use-macro=&quot;container/Zuite_CommonTemplate/macros/init&quot; style=&quot;display: none;&quot;&gt;init&lt;/span&gt;
<tr>
<td>store</td> <td>store</td>
<!-- ERP5TypeTestCase is the default for any UnitTest --> <!-- ERP5TypeTestCase is the default for any UnitTest -->
<td>%s</td> <td>%s</td>
...@@ -200,8 +196,8 @@ class TestRunMyDoc(ERP5TypeTestCase): ...@@ -200,8 +196,8 @@ class TestRunMyDoc(ERP5TypeTestCase):
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td>%s</td> <td>%s</td>
<td>base_password</td> <td>base_password</td>
</tr> </tr>
<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment" style="display: none;">init</span><tr><td>selectAndWait</td> <span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment" style="display: none;">init</span><tr><td>selectAndWait</td>
<td>name=select_module</td> <td>name=select_module</td>
...@@ -240,7 +236,7 @@ class TestRunMyDoc(ERP5TypeTestCase): ...@@ -240,7 +236,7 @@ class TestRunMyDoc(ERP5TypeTestCase):
self.assertEquals(zptest._text, expected_html.strip()) self.assertEquals(zptest._text, expected_html.strip())
expected_test_html = """<html> expected_test_html = u"""<html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TEST</title> <title>TEST</title>
...@@ -258,7 +254,6 @@ class TestRunMyDoc(ERP5TypeTestCase): ...@@ -258,7 +254,6 @@ class TestRunMyDoc(ERP5TypeTestCase):
<td>%s</td> <td>%s</td>
<td>base_url</td> <td>base_url</td>
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<!-- ERP5TypeTestCase is the default for any UnitTest --> <!-- ERP5TypeTestCase is the default for any UnitTest -->
...@@ -267,8 +262,8 @@ class TestRunMyDoc(ERP5TypeTestCase): ...@@ -267,8 +262,8 @@ class TestRunMyDoc(ERP5TypeTestCase):
</tr> </tr>
<tr> <tr>
<td>store</td> <td>store</td>
<td>%s</td> <td>%s</td>
<td>base_password</td> <td>base_password</td>
</tr> </tr>
<span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment" style="display: none;">init</span><tr><td>selectAndWait</td> <span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment" style="display: none;">init</span><tr><td>selectAndWait</td>
<td>name=select_module</td> <td>name=select_module</td>
......
63 64
\ No newline at end of file \ 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