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

officejs_support_request_ui_test: partial translation test

erp5_officejs_support_request_ui does not yet supports translation fully,
but we start testing translation.

For now only home page and panel are covered.

For the need of this test:
 - depend on erp5_l10n_fr because we'll test in french
 - modify test service so that its title is translated to french (and depend
   on erp5_content_translation for easier management of these translations)
parent 295e7c8e
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Zuite" module="Products.Zelenium.zuite"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>translation_zuite</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testHomePageListboxTranslation</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>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">The title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Home Page Listbox Translation</td></tr>
</thead><tbody>
<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/create_data" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/fr/</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="document_table"]//tr/td[1]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//h1</td>
<td>glob:Modifications récentes*</td>
</tr>
<!-- listbox title -->
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[1]</td>
<td>Titre</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[2]</td>
<td>Référence</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[3]</td>
<td>Type de la demande d'assistance</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[4]</td>
<td>Demandé par</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[5]</td>
<td>Date du commentaire</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[6]</td>
<td>Auteur du commentaire</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[7]</td>
<td>Date de début</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//thead/tr/th[8]</td>
<td>État</td>
</tr>
<!-- listbox content -->
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[1]</td>
<td>Yesterday - PlaneMaking - Open</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[2]</td>
<td>glob:SR*</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[3]</td>
<td>Rapport d'anomalie</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[4]</td>
<td></td>
</tr>
<!-- this is a date relative to now, so we can not really test this part -->
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[5]</td>
<td>glob:*20*</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[6]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[7]</td>
<td>glob:*20*</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[@class="document_table"]//tr/td[8]</td>
<td>Ouvert</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testHomePagePanelTranslation</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>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">The title</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Home Page Panel Translation</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_SupportRequestUITemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/fr/</td>
<td></td>
</tr>
<!-- hack to display Views&Decisions on panel for small screen-->
<tr>
<td>getEval</td>
<td>window.matchMedia = function () {return {matches:true}}</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, "panel")]//a</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-home")]</td>
<td>Accueil</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-life-ring")]</td>
<td>Demandes d'assistance</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-sliders")]</td>
<td>Préférences</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-power-off")]</td>
<td>Déconnexion</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-eye")]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-eye")]</td>
<td>Vues</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-cogs")]</td>
<td>Décisions</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSupportRequestPanelTranslation</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>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<title tal:content="template/title">Support Request Panel Translation</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Support Request Panel Translation</td></tr>
</thead><tbody>
<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/create_data" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/erp5_officejs_support_request_ui/fr/</td>
<td></td>
</tr>
<!-- hack to display Views&Decisions on panel for small screen-->
<tr>
<td>getEval</td>
<td>window.matchMedia = function () {return {matches:true}}</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@data-i18n='[value]Submit New Support Request']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@class="document_table"]//tr/td[1]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@class="document_table"]//tr/td[1]/a</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-home")]</td>
<td>Accueil</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-life-ring")]</td>
<td>Demandes d'assistance</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-sliders")]</td>
<td>Préférences</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//a[contains(@class, "ui-icon-power-off")]</td>
<td>Déconnexion</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-eye")]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-eye")]</td>
<td>Vues</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dl/dd[1]</td>
<td>Général</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dl/dd[2]</td>
<td>Historique</td>
</tr>
<tr>
<td>assertText</td>
<td>//div[contains(@class, "panel")]//dt[contains(@class, "ui-icon-cogs")]</td>
<td>Décisions</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@class, "panel")]//dl/dd/a[text() = "Clôturer le ticket"]</td>
<td></td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
......@@ -52,6 +52,27 @@
</tuple>
</value>
</item>
<item>
<key> <string>__translation_dict</string> </key>
<value>
<dictionary>
<item>
<key>
<tuple>
<string>title</string>
<string>fr</string>
</tuple>
</key>
<value>
<tuple>
<string>BugReport</string>
<string>Rapport d\'anomalie</string>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
......
......@@ -6,6 +6,7 @@ included in business template.
display statistics about recent support requests (like "less than 2 days from now"),
we need to generate support requests at a date relative from now.
"""
import time
from DateTime import DateTime
from datetime import timedelta
......@@ -25,30 +26,38 @@ portal.support_request_module.newContent(
portal_type='Support Request',
title="Two Weeks ago - PlaneMaking - Submitted",
start_date=DateTime(now - timedelta(days=15)),
resource_value=portal.service_module.erp5_officejs_support_request_ui_test_service_001,
source_project_value=portal.project_module.erp5_officejs_support_request_ui_test_project_001,
).submit()
portal.support_request_module.newContent(
portal_type='Support Request',
title="Last Week 2 - RobotMaking - Open",
start_date=DateTime(now - timedelta(days=5)),
resource_value=portal.service_module.erp5_officejs_support_request_ui_test_service_001,
source_project_value=portal.project_module.erp5_officejs_support_request_ui_test_project_001,
).validate()
portal.support_request_module.newContent(
portal_type='Support Request',
title="Last Week - RobotMaking - Open",
start_date=DateTime(now - timedelta(days=4)),
resource_value=portal.service_module.erp5_officejs_support_request_ui_test_service_001,
source_project_value=portal.project_module.erp5_officejs_support_request_ui_test_project_001,
).validate()
portal.support_request_module.newContent(
portal_type='Support Request',
title="Yesterday - RobotMaking - Submitted",
start_date=DateTime(now - timedelta(days=1)),
resource_value=portal.service_module.erp5_officejs_support_request_ui_test_service_001,
source_project_value=portal.project_module.erp5_officejs_support_request_ui_test_project_001,
).submit()
# sleep a bit to make sure "Yesterday - PlaneMaking - Open" is the most recent, some tests asserts
# the listbox sorted by modification date
time.sleep(1)
portal.support_request_module.newContent(
portal_type='Support Request',
title="Yesterday - PlaneMaking - Open",
start_date=DateTime(now - timedelta(days=1)),
resource_value=portal.service_module.erp5_officejs_support_request_ui_test_service_001,
source_project_value=portal.project_module.erp5_officejs_support_request_ui_test_project_001,
).validate()
......
......@@ -30,4 +30,10 @@ from Products.ERP5Type.tests.ERP5TypeFunctionalTestCase import ERP5TypeFunctiona
class TestSupportRequestUI(ERP5TypeFunctionalTestCase):
run_only = "officejs_support_request_ui_zuite"
def afterSetUp(self):
super(TestSupportRequestUI, self).afterSetUp()
# fix consistency to update translation
self.portal.web_site_module.erp5_officejs_support_request_ui.fixConsistency()
self.tic()
del ERP5TypeFunctionalTestCase
\ No newline at end of file
......@@ -3,3 +3,5 @@ erp5_ui_test
erp5_web_renderjs_ui
erp5_officejs_support_request_ui
erp5_web_renderjs_ui_test
erp5_content_translation
erp5_l10n_fr
\ 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