diff --git a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSelectionCheckedUids.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSelectionCheckedUids.xml new file mode 100644 index 0000000000000000000000000000000000000000..e423ad238be6a6620fa0277804713800e0c8ba0c --- /dev/null +++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/listbox_zuite/testSelectionCheckedUids.xml @@ -0,0 +1,281 @@ +<?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>_owner</string> </key> + <value> + <none/> + </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 View Mode</title>\n +</head>\n +<body>\n +<table cellpadding="1" cellspacing="1" border="1">\n +<thead>\n +<tr><td rowspan="1" colspan="3">Test View Mode</td></tr>\n +</thead><tbody>\n +<tal:block metal:use-macro="here/ListBoxZuite_CommonTemplate/macros/init" />\n +<tr>\n + <td>open</td>\n + <td>${base_url}/foo_module/FooModule_createObjects?num:int=5</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>assertTextPresent</td>\n + <td>Created Successfully.</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>open</td>\n + <td>${base_url}/portal_types/Foo Module/PortalType_addAction?id=test_action&name=Dummy Action&category=object_action&action=string:%24{object_url}/ListBoxZuite_getSelectionCheckedUidsAsHtml</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>open</td>\n + <td>${base_url}/foo_module/ListBoxZuite_waitForActivities</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>assertTextPresent</td>\n + <td>Done.</td>\n + <td></td>\n +</tr>\n +\n +<!-- If the list is filtered when invoking an action from object_action, the\n +selection\'s checked uids are set to the uids of the filtered objects. -->\n +<tr>\n + <td>open</td>\n + <td>${base_url}/foo_module/view</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>clickAndWait</td>\n + <td>Folder_filter:method</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <td>//tr[@id=\'listbox_data_line_1\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>clickAndWait</td>\n + <td>Folder_filter:method</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>selectAndWait</td>\n + <td>select_action</td>\n + <td>Dummy Action</td>\n +</tr>\n +<tr>\n + <td>assertTitle</td>\n + <td>len(checked_uids) == 1</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>assertText</td>\n + <td>//tr[1]/td[2]</td>\n + <td>1</td>\n +</tr>\n +\n +<!-- If selection is not in filtered mode, when selection an action from\n +object_action, selection checked uids will be updated to the list of selected\n +uids.\n +-->\n +<tr>\n + <td>open</td>\n + <td>${base_url}/foo_module/view</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>clickAndWait</td>\n + <td>Folder_show:method</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <td>//tr[@id=\'listbox_data_line_1\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <td>//tr[@id=\'listbox_data_line_2\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>selectAndWait</td>\n + <td>select_action</td>\n + <td>Dummy Action</td>\n +</tr>\n +<tr>\n + <td>assertTitle</td>\n + <td>len(checked_uids) == 2</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>assertText</td>\n + <td>//tr[1]/td[2]</td>\n + <td>1</td>\n +</tr>\n +<tr>\n + <td>assertText</td>\n + <td>//tr[2]/td[2]</td>\n + <td>2</td>\n +</tr>\n +\n +<!-- paranoia. Select some uids, filter, unselect some uids and check we\n +only have selected uids.\n +-->\n +<tr>\n + <td>open</td>\n + <td>${base_url}/foo_module/view</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>clickAndWait</td>\n + <td>Folder_show:method</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <td>//tr[@id=\'listbox_data_line_1\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <td>//tr[@id=\'listbox_data_line_2\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>clickAndWait</td>\n + <td>Folder_filter:method</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>click</td>\n + <!-- unselect 1 -->\n + <td>//tr[@id=\'listbox_data_line_0\']/td[1]/input</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>selectAndWait</td>\n + <td>select_action</td>\n + <td>Dummy Action</td>\n +</tr>\n +<tr>\n + <td>assertTitle</td>\n + <td>len(checked_uids) == 1</td>\n + <td></td>\n +</tr>\n +<tr>\n + <td>assertText</td>\n + <td>//tr[1]/td[2]</td>\n + <td>2</td>\n +</tr>\n +\n +</tbody></table>\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>testSelectionCheckedUids</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/testExchangeActions.xml b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testExchangeActions.xml index 49c75fd6d70becf2ff2952e34d89a37b262ac32c..903ee01b3202548445ca852b3c9c012dff1c5e78 100644 --- a/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testExchangeActions.xml +++ b/bt5/erp5_ui_test/PathTemplateItem/portal_tests/page_templates_zuite/testExchangeActions.xml @@ -86,7 +86,6 @@ <td>Welcome to ERP5</td>\n <td></td>\n </tr>\n -<!-- TODO: test "real workflow actions" -->\n </body>\n </html>\n diff --git a/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_getSelectionCheckedUidsAsHtml.xml b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_getSelectionCheckedUidsAsHtml.xml new file mode 100644 index 0000000000000000000000000000000000000000..b6b600860641b35e3f2c23ff598ef42b93293f85 --- /dev/null +++ b/bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/ListBoxZuite_getSelectionCheckedUidsAsHtml.xml @@ -0,0 +1,221 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <tuple> + <string>Products.PythonScripts.PythonScript</string> + <string>PythonScript</string> + </tuple> + <none/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Python_magic</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <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_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>_body</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +"""This scripts prints a table of all checked uids as html.\n +The title of the html is in the form "len(checked_uids) == %d"\n +The body contains some /table/tr with td[0] for uid and td[1] for id\n +"""\n +\n +if selection_name is None:\n + return "selection_name parameter not passed"\n +\n +portal = context.getPortalObject()\n +checked_uids = portal.portal_selections\\\n + .getSelectionCheckedUidsFor(selection_name)\n +getObj = portal.portal_catalog.getObject\n +checked_uids_objs = [getObj(uid) for uid in checked_uids]\n +checked_uids_objs.sort(lambda x,y:cmp(x.getId(), y.getId()))\n +\n +# we produce html for easier Selenium parsing\n +table = "\\n".join(["<tr><td>%s</td><td>%s</td></tr>" % (\n + x.getUid(), x.getId()) for x in checked_uids_objs])\n +return """<html>\n +<head><title>len(checked_uids) == %d</title></head>\n +<body>\n +<table>\n + %s\n +</table>\n +</body>\n +</html>""" % (len(checked_uids), table)\n + + +]]></string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_dav_writelocks</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_filepath</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_owner</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>selection_name=None, **kw</string> </value> + </item> + <item> + <key> <string>errors</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>func_code</string> </key> + <value> + <object> + <klass> + <global name="FuncCode" module="Shared.DC.Scripts.Signature"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>co_argcount</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>selection_name</string> + <string>kw</string> + <string>None</string> + <string>_getattr_</string> + <string>context</string> + <string>portal</string> + <string>checked_uids</string> + <string>getObj</string> + <string>append</string> + <string>$append0</string> + <string>_getiter_</string> + <string>uid</string> + <string>checked_uids_objs</string> + <string>x</string> + <string>table</string> + <string>len</string> + </tuple> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>func_defaults</string> </key> + <value> + <tuple> + <none/> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ListBoxZuite_getSelectionCheckedUidsAsHtml</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </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/bt/revision b/bt5/erp5_ui_test/bt/revision index eebd1d10b6ec9917baf4df7f2e3de79e031a9af7..b2412e34dff05e77952f3f930772631cac5a3be7 100644 --- a/bt5/erp5_ui_test/bt/revision +++ b/bt5/erp5_ui_test/bt/revision @@ -1 +1 @@ -61 \ No newline at end of file +62 \ No newline at end of file