Commit d27edde1 authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui_test: update tests now that we use CKEditor

and add a few assertion on the posted messages content
parent 31b3ad6f
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
...@@ -49,16 +49,9 @@ ...@@ -49,16 +49,9 @@
<td>field_your_resource</td> <td>field_your_resource</td>
<td>FeatureRequire</td> <td>FeatureRequire</td>
</tr> </tr>
<tr> <tal:block tal:define="text_content string:Post test">
<td>waitForElementPresent</td> <tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
<td>//textarea[@id='field_my_description']</td> </tal:block>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@id='field_my_description']</td>
<td>Post test</td>
</tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//input[@data-i18n='[value]Proceed']</td> <td>//input[@data-i18n='[value]Proceed']</td>
...@@ -74,6 +67,11 @@ ...@@ -74,6 +67,11 @@
<td>Comments:</td> <td>Comments:</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForText</td>
<td>//ol[@id="post_list"]//li/p</td>
<td>Post test</td>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>Reference</td> <td>Reference</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
...@@ -49,16 +49,9 @@ ...@@ -49,16 +49,9 @@
<td>field_your_resource</td> <td>field_your_resource</td>
<td>FeatureRequire</td> <td>FeatureRequire</td>
</tr> </tr>
<tr> <tal:block tal:define="text_content string:Post test 1">
<td>waitForElementPresent</td> <tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
<td>//textarea[@id='field_my_description']</td> </tal:block>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@id='field_my_description']</td>
<td>Post test 1</td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Proceed']</td> <td>//input[@data-i18n='[value]Proceed']</td>
...@@ -75,25 +68,109 @@ ...@@ -75,25 +68,109 @@
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForText</td>
<td>//textarea[@id='comment']</td> <td>//ol[@id="post_list"]//li[1]/p</td>
<td></td> <td>Post test 1</td>
</tr> </tr>
<!-- The "just posted" message is available because it is retrieved from memcached,
eventhough it's not ingested yet. But this works only for one message, so to first message
posted when opening the SR and the second one posted as a comment, we need to flush
activities in between.
Not really good on one hand, because if activities are congested, there will be a problem
here, but on the other hand it allows us to see that once ingested messages are also properly
displayed
-->
<tr> <tr>
<td>type</td> <td>store</td>
<td>//textarea[@id='comment']</td> <td>javascript{selenium.browserbot.getCurrentWindow().location.href}</td>
<td>Post test 2</td> <td>current_location</td>
</tr> </tr>
<tr>
<td>open</td>
<td tal:content="string:${here/portal_url}/Zuite_waitForActivities"/>
<td/>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Done.</td>
<td/>
</tr>
<tr>
<td>open</td>
<td>${current_location}</td>
<td></td>
</tr>
<tal:block tal:define="text_content string:Post test 2">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
</tal:block>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//input[@data-i18n='[value]Post Comment']</td> <td>//input[@data-i18n='[value]Post Comment']</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForText</td>
<td>//ol[@id="post_list"]//li[2]/p</td>
<td>Post test 2</td>
</tr>
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]//li[1]/p</td>
<td>Post test 1</td>
</tr>
<!-- flush activities and post one more message, to exercice ingesting post
posted from support request comment, which uses a different code path than
post ingested when submitting a new support request.
-->
<tr>
<td>store</td>
<td>javascript{selenium.browserbot.getCurrentWindow().location.href}</td>
<td>current_location</td>
</tr>
<tr>
<td>open</td>
<td tal:content="string:${here/portal_url}/Zuite_waitForActivities"/>
<td/>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>By</td> <td>Done.</td>
<td/>
</tr>
<tr>
<td>open</td>
<td>${current_location}</td>
<td></td> <td></td>
</tr> </tr>
<tal:block tal:define="text_content string:Post test 3">
<tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
</tal:block>
<tr>
<td>click</td>
<td>//input[@data-i18n='[value]Post Comment']</td>
<td></td>
</tr>
<tr>
<td>waitForText</td>
<td>//ol[@id="post_list"]//li[3]/p</td>
<td>Post test 3</td>
</tr>
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]//li[1]/p</td>
<td>Post test 1</td>
</tr>
<tr>
<td>assertText</td>
<td>//ol[@id="post_list"]//li[2]/p</td>
<td>Post test 2</td>
</tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td colspan="3" tal:content="template/title"></td></tr> <tr><td colspan="3" tal:content="template/title"></td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" />
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td colspan="3" tal:content="template/title"></td></tr> <tr><td colspan="3" tal:content="template/title"></td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" />
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr> <tr><td rowspan="1" colspan="3">Support Request Zuite</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr> <tr>
<td>open</td> <td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td> <td>${base_url}/web_site_module/erp5_officejs_support_request_ui/</td>
...@@ -24,16 +24,9 @@ ...@@ -24,16 +24,9 @@
<td>//input[@data-i18n='[value]Submit New Support Request']</td> <td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tal:block tal:define="text_content string:Post test">
<td>waitForElementPresent</td> <tal:block metal:use-macro="container/Zuite_CommonTemplateForRenderjsUi/macros/type_ckeditor_text_content"/>
<td>//textarea[@id='field_my_description']</td> </tal:block>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@id='field_my_description']</td>
<td>Post test</td>
</tr>
<tr> <tr>
<td>type</td> <td>type</td>
<td>//input[@name='field_your_title']</td> <td>//input[@name='field_your_title']</td>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<thead> <thead>
<tr><td rowspan="1" colspan="3">Worklists on support request front page</td></tr> <tr><td rowspan="1" colspan="3">Worklists on support request front page</td></tr>
</thead><tbody> </thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/cleanup_module" />
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" /> <tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/create_data" />
......
portal = context.getPortalObject()
# This should have been created during setup by Zuite_setPreference, but
# we need to support cases where developer run test in his development
# instance without the setup steps of ERP5TypeFunctionalTestCase
pref = getattr(portal.portal_preferences, "erp5_ui_test_preference", None)
if pref is None:
pref = portal.portal_preferences.newContent(
id="erp5_ui_test_preference",
portal_type="Preference",
priority=1)
if pref.getPreferenceState() == 'disabled':
pref.enable()
# use fck editor, we test with this
pref.setPreferredTextEditor('fck_editor')
# set a preferred event resource, so that the web message we create
# gets indexed properly in stock table.
# XXX This ressource does not make much sense though, using something like
# "support request message post" would be closer to the real resource of
# these events.
preferred_event_resource = 'service_module/erp5_officejs_support_request_ui_test_service_003'
if portal.web_site_module.erp5_officejs_support_request_ui.getLayoutProperty(
'preferred_event_resource', None) != 'preferred_event_resource':
portal.web_site_module.erp5_officejs_support_request_ui.edit(
preferred_event_resource=preferred_event_resource
)
return "Done."
<?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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_setupSupportRequestPreference</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal" <tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"> xmlns:metal="http://xml.zope.org/namespaces/metal">
<tal:block metal:define-macro="init">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tr><td>openAndWait</td>
<td>${base_url}/ERP5Site_setupSupportRequestPreference</td><td></td></tr>
<tr><td>assertTextPresent</td>
<td>Done.</td><td></td></tr>
</tal:block>
<tal:block metal:define-macro="cleanup_module"> <tal:block metal:define-macro="cleanup_module">
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" /> <tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr><td>openAndWait</td> <tr><td>openAndWait</td>
......
...@@ -25,23 +25,9 @@ ...@@ -25,23 +25,9 @@
# #
############################################################################## ##############################################################################
import unittest
from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctionalTestCase
class TestSupportRequestUI(ERP5TypeFunctionalTestCase): class TestSupportRequestUI(ERP5TypeFunctionalTestCase):
foreground = 0
run_only = "officejs_support_request_ui_zuite" run_only = "officejs_support_request_ui_zuite"
def getBusinessTemplateList(self): del ERP5TypeFunctionalTestCase
return ( \ No newline at end of file
'erp5_web_renderjs_ui',
'erp5_web_renderjs_ui_test',
'erp5_ui_test_core',
'erp5_officejs_support_request_ui'
)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestSupportRequestUI))
return suite
\ 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