Commit ee566452 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_officejs_support_request_ui_test: Add test to make sure we have all...

erp5_officejs_support_request_ui_test: Add test to make sure we have all expected actions to access support request web site
parent 9cfc340e
...@@ -19,11 +19,6 @@ ...@@ -19,11 +19,6 @@
<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>
<td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//div[@id='wrap1']</td> <td>//div[@id='wrap1']</td>
......
...@@ -21,19 +21,51 @@ ...@@ -21,19 +21,51 @@
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td> <td>//a[@data-i18n="Support Requests"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>click</td> <td>click</td>
<td>//input[@data-i18n="[value]Generate RSS"]</td> <td>//a[@data-i18n="Support Requests"]</td>
<td></td> <td></td>
</tr> </tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//input[@value="RSS Link"]</td> <td>//a[contains(text(), "Actions")]</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>click</td>
<td>//a[contains(text(), "Actions")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[contains(text(), "Generate RSS")]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), "Generate RSS")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[contains(text(), "Copy to clipboard")]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//button[contains(text(), "Copy to clipboard")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//button[contains(text(), "Copied")]</td>
<td></td>
</tr>
<!-- <!--
Firefox RSS compatibility issue: Firefox RSS compatibility issue:
...@@ -52,7 +84,7 @@ didn't start with "https://", Selenium test will automatically add ...@@ -52,7 +84,7 @@ didn't start with "https://", Selenium test will automatically add
resources. So we can't use the "view_source" in selenium tests to see plain RSS. resources. So we can't use the "view_source" in selenium tests to see plain RSS.
In order to avoid Firefox open RSS in its own way. We need to set the content type In order to avoid Firefox open RSS in its own way. We need to set the content type
as palin "text/plain" instead the "application/rss+xml". So we introduced as palin "text/plain" instead the "application/rss+xml". So we introduced
"Zuite_callMethodAsPlainText" to change the "content-type" and call "Zuite_callMethodAsPlainText" to change the "content-type" and call
"SupportRequestModule_viewLastSupportRequestListAsRss" again. Then the Firefox "SupportRequestModule_viewLastSupportRequestListAsRss" again. Then the Firefox
will open the RSS as plain text. will open the RSS as plain text.
......
...@@ -68,17 +68,17 @@ class SupportRequestTestCase(ERP5TypeTestCase, object): ...@@ -68,17 +68,17 @@ class SupportRequestTestCase(ERP5TypeTestCase, object):
def createUserAndLogin(self): def createUserAndLogin(self):
self.user = self.portal.person_module.newContent( self.user = self.portal.person_module.newContent(
first_name=self.id() first_name=self.id()
) )
self.user.newContent( self.user.newContent(
portal_type='Assignment' portal_type='Assignment'
).open() ).open()
self.user_password = self.newPassword() self.user_password = self.newPassword()
self.user.newContent( self.user.newContent(
id='erp5_login', id='erp5_login',
portal_type='ERP5 Login', portal_type='ERP5 Login',
reference=self.id(), reference=self.id(),
password=self.user_password password=self.user_password
).validate() ).validate()
self.user.validate() self.user.validate()
self.tic() self.tic()
...@@ -94,6 +94,46 @@ class SupportRequestTestCase(ERP5TypeTestCase, object): ...@@ -94,6 +94,46 @@ class SupportRequestTestCase(ERP5TypeTestCase, object):
class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase): class TestSupportRequestCreateNewSupportRequest(SupportRequestTestCase):
def test_existing_portal_type_action_to_support_request(self):
portal_type_list = [
p for p in self.portal.getPortalDocumentTypeList() \
if p not in ("Sound", "Video", "Web Page", 'Video', 'Web Illustration',
'Web Manifest', 'Web Page', 'Web Script', 'Web Style',
'Web Table')]
# Should not happens but we never know
assert portal_type_list, portal_type_list
for portal_type_str in portal_type_list:
portal_type = self.portal.portal_types[portal_type_str]
action_list = portal_type.objectValues(portal_type="Action Information")
filtered_action_list = [action.getReference() \
for action in sorted(action_list, key=lambda x: x.getFloatIndex()) \
if action.getActionType() == "object_officejs_support_request_view"
]
self.assertIn("officejs_support_request_preview",
filtered_action_list,
"missing officejs_support_request_preview in {}".format(portal_type_str))
self.assertIn("officejs_support_request_view",
filtered_action_list,
"missing officejs_support_request_view in {}".format(portal_type_str))
self.assertIn("officejs_support_request_download", filtered_action_list,
"missing officejs_support_request_download in {}".format(portal_type_str))
self.assertEqual(filtered_action_list[0], "officejs_support_request_preview",
"Unexpected action to {} => {}".format(portal_type,
filtered_action_list[0]))
for portal_type_str in ["Support Request", "Support Request Module"]:
portal_type = self.portal.portal_types[portal_type_str]
action_list = portal_type.objectValues(portal_type="Action Information")
filtered_action_list = [action.getReference() \
for action in sorted(action_list, key=lambda x: x.getFloatIndex()) \
if action.getActionType() == "object_officejs_support_request_view"
]
self.assertIn("officejs_support_request_view",
filtered_action_list,
"missing officejs_support_request_view in {}".format(portal_type_str))
def test_submit_support_request(self): def test_submit_support_request(self):
self.getWebSite().SupportRequestModule_createSupportRequest( self.getWebSite().SupportRequestModule_createSupportRequest(
description='<b>Help !!!</b>', description='<b>Help !!!</b>',
......
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