Commit 7924d351 authored by Jérome Perrin's avatar Jérome Perrin

Re-enable "Diff Object" "Diff Module Objects" for users

This is used and should not be disabled.

There was an error when clicking this dialog, fix that error instead.

See merge request !1301
parents 01310e93 813d4942
...@@ -264,6 +264,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -264,6 +264,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [], expected = {'folder': [],
'global': [], 'global': [],
'object': [], 'object': [],
'object_action': [{'id': 'diff_object_action', 'title': 'Diff Object'}],
'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style 'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style
'object_hidden': [{'id': 'view_historical_comparison', 'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'}, 'title': 'View Historical Comparison'},
...@@ -285,6 +286,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -285,6 +286,7 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [], expected = {'folder': [],
'global': [], 'global': [],
'object': [], 'object': [],
'object_action': [{'id': 'diff_object_action', 'title': 'Diff Object'}],
'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style 'object_exchange': [{'id': 'csv_export', 'title': 'Export Csv File'}], # erp5_csv_style
'object_hidden': [{'id': 'view_historical_comparison', 'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'}, 'title': 'View Historical Comparison'},
......
...@@ -63,48 +63,56 @@ ...@@ -63,48 +63,56 @@
<td>Diff Module Objects</td> <td>Diff Module Objects</td>
</tr> </tr>
<!-- Check the diff content --> <tal:block tal:repeat="_ python: (1, 2)">
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/2</td>
</tr>
<tr> <!-- Check the diff content -->
<td>assertText</td> <tr>
<td>//a[@class="listbox_title"]</td> <td>verifyValue</td>
<td>exact:Diff</td> <td>field_your_first_path</td>
</tr> <td>bar_module/1</td>
<tr> </tr>
<td>waitForElementPresent</td> <tr>
<td>//tr[@class='listbox-data-line-2 DataA']</td> <td>verifyValue</td>
<td></td> <td>field_your_second_path</td>
</tr> <td>bar_module/2</td>
<tr> </tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<tr>
<td>assertText</td>
<td>//a[@class="listbox_title"]</td>
<td>exact:Diff</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[1]</td>
<td>title</td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-2 DataA']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- submit the action again, it should be same -->
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
</tal:block>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -54,48 +54,58 @@ ...@@ -54,48 +54,58 @@
<td>Diff Object</td> <td>Diff Object</td>
</tr> </tr>
<!-- Check the diff content --> <tal:block tal:repeat="_ python: (1, 2)">
<tr>
<td>verifyValue</td>
<td>field_your_first_path</td>
<td>bar_module/1</td>
</tr>
<tr>
<td>verifyValue</td>
<td>field_your_second_path</td>
<td>bar_module/1</td>
</tr>
<tr> <!-- Check the diff content -->
<td>assertText</td> <tr>
<td>//a[@class="listbox_title"]</td> <td>verifyValue</td>
<td>exact:Diff</td> <td>field_your_first_path</td>
</tr> <td>bar_module/1</td>
<tr> </tr>
<td>waitForElementPresent</td> <tr>
<td>//tr[@class='listbox-data-line-1 DataB']</td> <td>verifyValue</td>
<td></td> <td>field_your_second_path</td>
</tr> <td>bar_module/1</td>
<tr> </tr>
<td>assertText</td>
<td>//tr[@class='listbox-data-line-1 DataB']/td[1]</td> <tr>
<td>title</td> <td>assertText</td>
</tr> <td>//a[@class="listbox_title"]</td>
<tr> <td>exact:Diff</td>
<td>assertElementPresent</td> </tr>
<td>//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox="public"]</td> <tr>
<td></td> <td>waitForElementPresent</td>
</tr> <td>//tr[@class='listbox-data-line-1 DataB']</td>
<tr> <td></td>
<td>storeEval</td> </tr>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td> <tr>
<td>_data_gadget_value</td> <td>assertText</td>
</tr> <td>//tr[@class='listbox-data-line-1 DataB']/td[1]</td>
<tr> <td>title</td>
<td>verifyEval</td> </tr>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td> <tr>
<td>---+++@@-1+1@@-Title1+Title2</td> <td>assertElementPresent</td>
</tr> <td>//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox="public"]</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>document.querySelector('#selenium_myiframe').contentWindow.document.evaluate("//tr[@class='listbox-data-line-1 DataB']/td[2]/div[@data-gadget-sandbox='public']", document.querySelector('#selenium_myiframe').contentWindow.document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.getAttribute('data-gadget-value');</td>
<td>_data_gadget_value</td>
</tr>
<tr>
<td>verifyEval</td>
<td>storedVars['_data_gadget_value'].replace(/(\r\n\t|\n|\r\t)/gm,"").replace(/\s+/g, '')</td>
<td>---+++@@-1+1@@-Title1+Title2</td>
</tr>
<!-- submit the action again, it should be same -->
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
</tal:block>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
<value> <value>
<tuple> <tuple>
<string>Manage portal</string> <string>View</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<key> <string>permissions</string> </key> <key> <string>permissions</string> </key>
<value> <value>
<tuple> <tuple>
<string>Manage portal</string> <string>View</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -98,7 +98,7 @@ if ((first_path is None and second_path is None) and ...@@ -98,7 +98,7 @@ if ((first_path is None and second_path is None) and
# In case the list_selection_name is there, it can be the case of selection # In case the list_selection_name is there, it can be the case of selection
# from the module, hence we get the paths from the selection and use them to # from the module, hence we get the paths from the selection and use them to
# create diff. # create diff.
if list_selection_name is not None: if list_selection_name:
selected_object_list = portal.portal_selections.getSelectionCheckedValueList( selected_object_list = portal.portal_selections.getSelectionCheckedValueList(
selection_name=list_selection_name) selection_name=list_selection_name)
first_object = selected_object_list[0] first_object = selected_object_list[0]
......
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