Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Hamza
erp5
Commits
e920ddfd
Commit
e920ddfd
authored
13 years ago
by
Rafael Monnerat
Browse files
Options
Download
Email Patches
Plain Diff
Added test for Selenium Test Generation
parent
4e478cef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
93 additions
and
1 deletion
+93
-1
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
bt5/erp5_run_my_doc/TestTemplateItem/testRunMyDoc.py
+92
-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/TestTemplateItem/testRunMyDoc.py
View file @
e920ddfd
...
...
@@ -135,3 +135,95 @@ class TestRunMyDoc(ERP5TypeTestCase):
self
.
assertEquals
(
image_page_2
.
getData
(),
image_upload
.
read
().
decode
(
"base64"
))
self
.
assertEquals
(
image_page_2
.
getFilename
(),
image_reference
+
'.png'
)
self
.
assertEquals
(
image_page
.
getData
(),
''
)
def
test_getSeleniumTest
(
self
):
"""
Test the script that extracts Selenium Test from HTML body.
"""
test_page_html
=
"""<section><h1>TITLE</h1><details>DETAILS<details>
<test><table class="test" style="display: none;"> <tbody> </tbody></table> </test>
</section>
<section><h1>TITLE</h1><details>DETAILS<details><test>
<table class="test" style="display: none;">
<tbody>
<tr>
<td colspan="3"><span metal:use-macro="container/Zuite_viewTestMacroLibrary/macros/init_test_environment" style="display: none;">init</span></td>
</tr>
<tr>
<td>selectAndWait</td>
<td>name=select_module</td>
<td>label=Test Pages</td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Test Pages</td>
<td> <br /> </td>
</tr>
<tr style="opacity: 1;">
<td>clickAndWait</td>
<td>css=a.fast_input > span.image</td>
<td> <br /> </td>
</tr> </tbody></table> </test>
</section>
<section><h1>TITLE</h1><details>DETAILS<details><test>
<table class="test" style="display: none;"> <tbody>
<tr>
<td>verifyTextPresent</td>
<td>Test Pages</td>
<td> <br /> </td>
</tr> </tbody></table> </test>
</section>"""
expected_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>TEST</title>
</head>
<body>
<table name="SELENIUM-TEST" cellpadding="1" cellspacing="1" border="1">
<thead>
<tr class="title">
<td colspan="3">TEST</td>
</tr>
</thead>
<tbody>
<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>label=Test Pages</td>
</tr><tr><td>verifyTextPresent</td>
<td>Test Pages</td>
<td> <br></td>
</tr><tr style="opacity: 1;"><td>clickAndWait</td>
<td>css=a.fast_input > span.image</td>
<td> <br></td>
</tr><tr><td>verifyTextPresent</td>
<td>Test Pages</td>
<td> <br></td>
</tr>
</tbody>
</table>
</body>
</html>"""
test_page
=
self
.
portal
.
test_page_module
.
newContent
(
title
=
"TEST"
,
reference
=
'TESTPAGEREFERENCE'
,
text_content
=
test_page_html
)
self
.
assertEquals
(
test_page
.
TestPage_getSeleniumTest
(),
expected_test_html
)
self
.
stepTic
()
test_page
.
TestPage_runSeleniumTest
()
zuite
=
getattr
(
self
.
portal
.
portal_tests
,
'TESTPAGEREFERENCE'
,
None
)
self
.
assertNotEquals
(
zuite
,
None
)
zptest
=
getattr
(
zuite
,
"TEST"
,
None
)
self
.
assertNotEquals
(
zptest
,
None
)
self
.
assertEquals
(
zptest
.
_text
,
expected_test_html
.
strip
())
This diff is collapsed.
Click to expand it.
bt5/erp5_run_my_doc/bt/revision
View file @
e920ddfd
52
\ No newline at end of file
53
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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