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
Yusei Tahara
erp5
Commits
30df125b
Commit
30df125b
authored
Mar 01, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use page template instead a python script to render the selenium test
parent
e920ddfd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
32 deletions
+99
-32
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
+5
-27
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_runSeleniumTest.xml
...portal_skins/erp5_run_my_doc/TestPage_runSeleniumTest.xml
+9
-4
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_viewSeleniumTest.xml
...ortal_skins/erp5_run_my_doc/TestPage_viewSeleniumTest.xml
+84
-0
bt5/erp5_run_my_doc/bt/revision
bt5/erp5_run_my_doc/bt/revision
+1
-1
No files found.
bt5/erp5_run_my_doc/ExtensionTemplateItem/ERP5RunMyDocs.py
View file @
30df125b
...
@@ -110,44 +110,22 @@ def urlread(url):
...
@@ -110,44 +110,22 @@ def urlread(url):
import
urllib
import
urllib
return
urllib
.
urlopen
(
url
).
read
()
return
urllib
.
urlopen
(
url
).
read
()
"""
"""
Remove everything but the test in a webpage
Remove everything but the test in a webpage
"""
"""
def
extractTest
(
t
itle
,
t
ext
):
def
extractTest
(
text
):
import
lxml.html
import
lxml.html
from
lxml
import
etree
from
lxml
import
etree
root
=
lxml
.
html
.
fromstring
(
text
)
root
=
lxml
.
html
.
fromstring
(
text
)
table_list
=
root
.
xpath
(
'//test'
)
table_list
=
root
.
xpath
(
'//test'
)
html
=
"""
testcode
=
""
<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
:
for
table
in
table_list
:
table
=
table
[
0
]
table
=
table
[
0
]
if
len
(
table
)
>
0
:
if
len
(
table
)
>
0
:
for
row
in
table
[
-
1
]:
for
row
in
table
[
-
1
]:
if
len
(
row
)
==
1
:
if
len
(
row
)
==
1
:
# Include Macros as it is defined by the user.
# Include Macros as it is defined by the user.
html
+=
row
[
0
].
text
testcode
+=
row
[
0
].
text
else
:
else
:
html
+=
lxml
.
html
.
tostring
(
row
)
testcode
+=
lxml
.
html
.
tostring
(
row
)
html
+=
"""
return
testcode
</tbody>
</table>
</body>
</html>"""
return
html
\ No newline at end of file
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_runSeleniumTest.xml
View file @
30df125b
...
@@ -51,12 +51,17 @@
...
@@ -51,12 +51,17 @@
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
<value>
<string>
"""\n
Launch Test Embedded at the Test Page.\n
"""\n
"""\n
reference = context.getReference()\n
reference = context.getReference()\n
if reference not in [None, \'\']:\n
if reference not in [None, \'\']:\n
zuite_id = reference\n
zuite_id = reference\n
\n
\n
return context.Zuite_createAndLaunchSeleniumTest(text=context.TestPage_getSeleniumTest(),\n
test_script = getattr(context, \'Zuite_createAndLaunchSeleniumTest\', None)\n
if test_script is None:\n
raise ValueError("Unable to Launch the Test. Please install erp5_test_ui_core business template.")\n
\n
return test_script(text=context.TestPage_viewSeleniumTest(),\n
title=context.getTitle(), \n
title=context.getTitle(), \n
zuite_id=zuite_id,\n
zuite_id=zuite_id,\n
test_id=test_id)\n
test_id=test_id)\n
...
...
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_
get
SeleniumTest.xml
→
bt5/erp5_run_my_doc/SkinTemplateItem/portal_skins/erp5_run_my_doc/TestPage_
view
SeleniumTest.xml
View file @
30df125b
...
@@ -2,14 +2,10 @@
...
@@ -2,14 +2,10 @@
<ZopeData>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<pickle>
<global
name=
"
PythonScript"
module=
"Products.PythonScripts.PythonScript
"
/>
<global
name=
"
ZopePageTemplate"
module=
"Products.PageTemplates.ZopePageTemplate
"
/>
</pickle>
</pickle>
<pickle>
<pickle>
<dictionary>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<key>
<string>
_bind_names
</string>
</key>
<value>
<value>
...
@@ -24,18 +20,6 @@
...
@@ -24,18 +20,6 @@
<key>
<string>
_asgns
</string>
</key>
<key>
<string>
_asgns
</string>
</key>
<value>
<value>
<dictionary>
<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>
<item>
<key>
<string>
name_subpath
</string>
</key>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
<value>
<string>
traverse_subpath
</string>
</value>
...
@@ -49,17 +33,50 @@
...
@@ -49,17 +33,50 @@
</value>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_body
</string>
</key>
<key>
<string>
_text
</string>
</key>
<value>
<string>
return context.TestPage_extractTest(context.getTitle(), context.getTextContent())\n
<value>
<unicode
encoding=
"cdata"
>
<![CDATA[
</string>
</value>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">
\n
<head>
\n
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
\n
<title
tal:content=
"context/title"
>
The title
</title>
\n
</head>
\n
<body>
\n
<table
name=
"SELENIUM-TEST"
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
\n
<thead>
\n
<tr
class=
"title"
>
\n
<td
colspan=
"3"
tal:content=
"context/title"
>
title
</td>
\n
</tr>
\n
</thead>
\n
<tbody>
\n
<tal:block
tal:replace=
"structure python:context.TestPage_extractTest(context.getTextContent())"
/>
\n
</tbody>
\n
</table>
\n
</body>
\n
</html>
]]>
</unicode>
</value>
</item>
<item>
<key>
<string>
content_type
</string>
</key>
<value>
<string>
text/html
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
expand
</string>
</key>
<value>
<
string></string
>
</value>
<value>
<
int>
0
</int
>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
<value>
<string>
TestPage_getSeleniumTest
</string>
</value>
<value>
<string>
TestPage_viewSeleniumTest
</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>
</item>
</dictionary>
</dictionary>
</pickle>
</pickle>
...
...
bt5/erp5_run_my_doc/bt/revision
View file @
30df125b
53
54
\ No newline at end of file
\ No newline at end of file
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