From d2a49fc2b6249f78e8efabfdb6781c68d8b4bdae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 31 Jul 2006 11:13:26 +0000
Subject: [PATCH] Update for the changes in ids in select elements. Add tests
 for portal status message, object_button actions and various cases of
 clicking the select button when nothing is selected.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8922 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../testButtonActions.xml                     | 136 ++++++++++++++++
 ...testDropDownListActionsNothingSelected.xml | 151 ++++++++++++++++++
 .../page_templates_zuite/testJumpActions.xml  |   2 +-
 .../testObjectActions.xml                     |  29 +++-
 .../testPortalStatusMessage.xml               | 142 ++++++++++++++++
 .../testWorkflowActions.xml                   |   2 +-
 6 files changed, 459 insertions(+), 3 deletions(-)
 create mode 100644 bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testButtonActions.xml
 create mode 100644 bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testDropDownListActionsNothingSelected.xml
 create mode 100644 bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testPortalStatusMessage.xml

diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testButtonActions.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testButtonActions.xml
new file mode 100644
index 0000000000..c481d22dff
--- /dev/null
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testButtonActions.xml
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_dav_writelocks</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<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>Test Button Actions</title>\n
+</head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="3">Test Button Actions</td></tr>\n
+</thead><tbody>\n
+<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
+<tr>\n
+  <td>open</td>\n
+  <td tal:content="string:\n
+  ${here/portal_url}/portal_types/Foo/PortalType_addAction?id=test_action&name=Dummy Button&category=object_button&icon=string:images/filenew.png&action=string:%24{portal_url}/view">Create a dummy action that redirects to the portal</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>open</td>\n
+  <td tal:content="string: ${here/portal_url}/foo_module/1/view">/erp5/foo_module/1/view</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>//img[@title=\'Dummy Button\']</td>\n
+  <td>Workflow Action to Portal</td>\n
+</tr>\n
+<tr>\n
+  <td>assertTextPresent</td>\n
+  <td>Welcome to ERP5</td>\n
+  <td></td>\n
+</tr>\n
+</body>\n
+</html>\n
+
+
+]]></string> </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>testButtonActions</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Persistence</string>
+          <string>PersistentMapping</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_container</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testDropDownListActionsNothingSelected.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testDropDownListActionsNothingSelected.xml
new file mode 100644
index 0000000000..a24d5f6616
--- /dev/null
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testDropDownListActionsNothingSelected.xml
@@ -0,0 +1,151 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_dav_writelocks</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<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>Test Drop Down List Action when Nothing is Selected</title>\n
+</head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="3">Test Drop Down List Action when Nothing is\n
+Selected</td></tr>\n
+</thead><tbody>\n
+<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
+<tr>\n
+  <td>open</td>\n
+  <td tal:content="string: ${here/portal_url}/foo_module/1/view">/erp5/foo_module/1/view</td>\n
+  <td></td>\n
+</tr>\n
+<!-- when clicking on the action button of a drop down when nothing is selected\n
+shouldn\'t do anything. -->\n
+<tal:block tal:repeat="button_title python:[\'Select Favorite\',\n
+                                            \'Select Module\',\n
+                                            \'Select Language\',\n
+                                            \'Jump\',\n
+                                            \'Action\']">\n
+  <tr>\n
+    <td>click</td>\n
+    <td tal:content="string://button[@title=\'${button_title}\']"/>\n
+    <td></td>\n
+  </tr>\n
+  <!-- FIXME: we cannot use clickAndWait in the previous action, because if no\n
+  redirection occurs, selenium hangs... -->\n
+  <tr>\n
+    <td>pause</td>\n
+    <td>1000</td>\n
+    <td></td>\n
+  </tr>\n
+  <tr>\n
+    <td>assertLocation</td>\n
+    <td tal:content="string: ${here/portal_url/getPortalPath}/foo_module/1/view">/erp5/foo_module/1/view</td>\n
+    <td/>\n
+  </tr>\n
+  <tr>\n
+    <td>assertTextNotPresent</td>\n
+    <td>Site Error</td>\n
+    <td/>\n
+  </tr>\n
+</tal:block>\n
+</body>\n
+</html>\n
+
+
+]]></string> </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>testDropDownListActionsNothingSelected</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Persistence</string>
+          <string>PersistentMapping</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_container</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testJumpActions.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testJumpActions.xml
index 4dbf87cdd0..be5ae65118 100644
--- a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testJumpActions.xml
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testJumpActions.xml
@@ -78,7 +78,7 @@
 </tr>\n
 <tr>\n
   <td>selectAndWait</td>\n
-  <td>jump_select</td>\n
+  <td>select_jump</td>\n
   <td>Jump Portal</td>\n
 </tr>\n
 <tr>\n
diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testObjectActions.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testObjectActions.xml
index 8dc0b8bd06..563b72a320 100644
--- a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testObjectActions.xml
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testObjectActions.xml
@@ -44,6 +44,12 @@
               </object>
             </value>
         </item>
+        <item>
+            <key> <string>_dav_writelocks</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
         <item>
             <key> <string>_text</string> </key>
             <value> <string encoding="cdata"><![CDATA[
@@ -72,7 +78,7 @@
 </tr>\n
 <tr>\n
   <td>selectAndWait</td>\n
-  <td>action_select</td>\n
+  <td>select_action</td>\n
   <td>Open Portal</td>\n
 </tr>\n
 <tr>\n
@@ -105,4 +111,25 @@
       </dictionary>
     </pickle>
   </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Persistence</string>
+          <string>PersistentMapping</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_container</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
 </ZopeData>
diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testPortalStatusMessage.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testPortalStatusMessage.xml
new file mode 100644
index 0000000000..210b94d23c
--- /dev/null
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testPortalStatusMessage.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0"?>
+<ZopeData>
+  <record id="1" aka="AAAAAAAAAAE=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Products.PageTemplates.ZopePageTemplate</string>
+          <string>ZopePageTemplate</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>__ac_local_roles__</string> </key>
+            <value>
+              <none/>
+            </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_subpath</string> </key>
+                                <value> <string>traverse_subpath</string> </value>
+                            </item>
+                          </dictionary>
+                        </value>
+                    </item>
+                  </dictionary>
+                </state>
+              </object>
+            </value>
+        </item>
+        <item>
+            <key> <string>_dav_writelocks</string> </key>
+            <value>
+              <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
+            </value>
+        </item>
+        <item>
+            <key> <string>_text</string> </key>
+            <value> <string encoding="cdata"><![CDATA[
+
+<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>Test Portal Status Message</title>\n
+</head>\n
+<body>\n
+<table cellpadding="1" cellspacing="1" border="1">\n
+<thead>\n
+<tr><td rowspan="1" colspan="3">Test Portal Status Message</td></tr>\n
+</thead><tbody>\n
+<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />\n
+<tr>\n
+  <td>open</td>\n
+  <td tal:content="string: ${here/portal_url}/foo_module/1/view?portal_status_message=Dummy+Portal+Status+Message">/erp5/foo_module/1/view</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>assertTextPresent</td>\n
+  <td>Dummy Portal Status Message</td>\n
+  <td></td>\n
+</tr>\n
+<!-- we also test our custom command: -->\n
+<tr>\n
+  <td>assertPortalStatusMessage</td>\n
+  <td>Dummy Portal Status Message</td>\n
+  <td></td>\n
+</tr>\n
+<!-- when we follow a link, psm must be empty. -->\n
+<tr>\n
+  <td>clickAndWait</td>\n
+  <td>link=View</td>\n
+  <td></td>\n
+</tr>\n
+<tr>\n
+  <td>assertPortalStatusMessage</td>\n
+  <td></td>\n
+  <td></td>\n
+</tr>\n
+</body>\n
+</html>\n
+
+
+]]></string> </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>testPortalStatusMessage</string> </value>
+        </item>
+        <item>
+            <key> <string>title</string> </key>
+            <value> <string></string> </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+  <record id="2" aka="AAAAAAAAAAI=">
+    <pickle>
+      <tuple>
+        <tuple>
+          <string>Persistence</string>
+          <string>PersistentMapping</string>
+        </tuple>
+        <none/>
+      </tuple>
+    </pickle>
+    <pickle>
+      <dictionary>
+        <item>
+            <key> <string>_container</string> </key>
+            <value>
+              <dictionary/>
+            </value>
+        </item>
+      </dictionary>
+    </pickle>
+  </record>
+</ZopeData>
diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testWorkflowActions.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testWorkflowActions.xml
index 71cba60a68..55837d5da8 100644
--- a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testWorkflowActions.xml
+++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testWorkflowActions.xml
@@ -76,7 +76,7 @@ objects in the selection.\n
 </tr>\n
 <tr>\n
   <td>selectAndWait</td>\n
-  <td>action_select</td>\n
+  <td>select_action</td>\n
   <td>Workflow Action to Portal</td>\n
 </tr>\n
 <tr>\n
-- 
2.30.9