# HG changeset patch
# User Mario Castello <mario.castello@peoplewalking.com>
# Date 1488315880 21600
#      mar feb 28 15:04:40 2017 -0600
# Node ID a0dcf159de2ff71ccd9a9d45e834a2ae46e37fb6
# Parent  935fce295c0c966b2261337816577b3f6019ffa9
Verifies issue 35120: Added automated test I35120_CashupAfterAddProduct

diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I35120_CashupAfterAddProduct.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I35120_CashupAfterAddProduct.java
new file mode 100644
--- /dev/null
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cashup/I35120_CashupAfterAddProduct.java
@@ -0,0 +1,49 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo S.L.U.
+ * All portions are Copyright (C) 2008-2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author MCA
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.cashup;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I35120_CashupAfterAddProduct extends WebPOSTerminalHelper {
+
+  @Test
+  public void test() {
+    // Register hook for "OBPOS_PreAddProductToOrder to simulate asynchrony"
+    SeleniumHelper.executeScript("OB.UTIL.HookManager.registerHook('OBPOS_PreAddProductToOrder', "
+        + " function(args, callback) { setTimeout(function() { "
+        + " OB.UTIL.HookManager.callbackExecutor(args,callback); }, 1000) })");
+
+    tap(TestIdPack.BUTTON_BROWSE);
+    tap(TestIdPack.BUTTON_CATEGORY_BACKPACKSANDTRAVEL);
+    tap(TestIdPack.BUTTON_PRODUCT_BACKPACKSANDTRAVEL_ALPINESKIING);
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_CASHUP);
+    tap(TestIdPack.BUTTON_CASHUP_CANCEL);
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    tap(TestIdPack.BUTTON_DELETERECEIPT_CONFIRM);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+}
