From eb8ac1edcadcf4b9fe6089e42b2c5b583c75c837 Mon Sep 17 00:00:00 2001
From: Ayush Tiwari <ayush.tiwari@nexedi.com>
Date: Tue, 17 Apr 2018 14:48:48 +0200
Subject: [PATCH] [erp5_pdm_renderjs_ui_test]: Add macros to test correct links
 on stock view

---
 .../testConfirmedState.zpt                    |  2 +
 .../testDeliveredState.zpt                    |  2 +
 .../testOrderedState.zpt                      |  2 +
 .../testPlannedState.zpt                      |  2 +
 .../testReadyState.zpt                        |  2 +
 .../testStartedState.zpt                      |  2 +
 .../testStoppedState.zpt                      |  2 +
 .../PdmZuite_CommonTemplateForRenderjsUi.zpt  | 39 +++++++++++++++++++
 8 files changed, 53 insertions(+)

diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testConfirmedState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testConfirmedState.zpt
index 7cf96e7b2c..77cb7f281c 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testConfirmedState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testConfirmedState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testDeliveredState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testDeliveredState.zpt
index 0d95df5b4e..052c0f1cb6 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testDeliveredState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testDeliveredState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testOrderedState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testOrderedState.zpt
index 1f7907170e..ee8f870dd7 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testOrderedState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testOrderedState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testPlannedState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testPlannedState.zpt
index 167e444a16..3ce98c4e06 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testPlannedState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testPlannedState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testReadyState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testReadyState.zpt
index 9a4b135c7b..17df84fe27 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testReadyState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testReadyState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStartedState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStartedState.zpt
index 66d0d75563..f90a13df9c 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStartedState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStartedState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStoppedState.zpt b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStoppedState.zpt
index 84bb91aa7c..52d5208008 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStoppedState.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_stock_browser_zuite/testStoppedState.zpt
@@ -41,6 +41,8 @@ Test stock browser for confirmed state
   <tal:block metal:use-macro="here/PdmZuite_checkStockBrowserForRenderjsUi/macros/check_total_for_inventory" />
 </tal:block>
 
+<tal:block metal:use-macro="here/PdmZuite_CommonTemplateForRenderjsUi/macros/check_links_for_stocks" />
+
 <!-- Check the links in hardcoded way -->
 <!-- TODO: If possible, move to micros -->
 <tr>
diff --git a/bt5/erp5_pdm_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_renderjs_ui_test/PdmZuite_CommonTemplateForRenderjsUi.zpt b/bt5/erp5_pdm_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_renderjs_ui_test/PdmZuite_CommonTemplateForRenderjsUi.zpt
index 970685c93c..52eca50bdc 100644
--- a/bt5/erp5_pdm_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_renderjs_ui_test/PdmZuite_CommonTemplateForRenderjsUi.zpt
+++ b/bt5/erp5_pdm_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_pdm_renderjs_ui_test/PdmZuite_CommonTemplateForRenderjsUi.zpt
@@ -102,6 +102,45 @@
     </tr>
   </tal:block>
 
+  <tal:block metal:define-macro="check_links_for_stocks">
+    <tr>
+      <td colspan="3"><b>Check Correct Links For Stock View</b></td>
+    </tr>
+    <tr>
+      <td>waitForElementPresent</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[1]/a</td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>verifyValue</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[1]/a/@href</td>
+      <td>regexp:.*push_history.*</td>
+    </tr>
+    <tr>
+      <td>verifyValue</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[1]/td[1]/a/@href</td>
+      <td>regexp:.*view_movement_history.*</td>
+    </tr>
+    <tr>
+      <td>waitForElementPresent</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[1]/a</td>
+      <td></td>
+    </tr>
+    <tr>
+      <td>verifyValue</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[1]/a/@href</td>
+      <td>regexp:.*push_history.*</td>
+    </tr>
+    <tr>
+      <td>verifyValue</td>
+      <td>//div[@data-gadget-scope='field_listbox']//table/tbody/tr[2]/td[1]/a/@href</td>
+      <td>regexp:.*view_movement_history.*</td>
+    </tr>
+    <tr>
+      <td colspan="3"><p></p></td>
+    </tr>
+  </tal:block>
+
   <tal:block metal:define-macro="check_links">
     <tr>
       <td colspan="3"><b>Check Correct Links For Sale Packing List</b></td>
-- 
2.30.9