# HG changeset patch
# User Jorge Garcia <jorge.garcia@openbravo.com>
# Date 1501144642 -7200
#      Thu Jul 27 10:37:22 2017 +0200
# Node ID f97a178e879eb662267745f716d8ce16b5aa1e76
# Parent  58a150142c246209da760bd8c349688e8e266eb0
Verifies issue 36515: Improve BusinessPartner query performance removing location info from it

diff --git a/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java b/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java
--- a/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java
+++ b/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java
@@ -352,6 +352,7 @@
     testsAllowedToHaveLogclientErrors.add("SelectPrinterTests.NoPrintersConfigured");
     testsAllowedToHaveLogclientErrors
         .add("SelectPrinterTests.SwitchBetweenReceiptPrintersWhenError");
+    testsAllowedToHaveLogclientErrors.add("I34968_ReceiptPayOpenTicket");
 
     return testsAllowedToHaveLogclientErrors;
   }
diff --git a/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java b/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java
--- a/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java
+++ b/src-test/org/openbravo/test/mobile/retail/mobilecore/javascript/MobileCoreAPI.java
@@ -11,7 +11,7 @@
  * 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-2014 Openbravo S.L.U.
+ * All portions are Copyright (C) 2008-2017 Openbravo S.L.U.
  * All Rights Reserved.
  * Contributor(s):
  ************************************************************************
@@ -217,11 +217,11 @@
       }
     };
     final Object dbQueryResult = SeleniumHelper.executeScriptWithReturn("this.dbQueryResult");
-    if (dbQueryResult.equals(searchKeyDoesNotExistsError)) {
+    if (String.valueOf(dbQueryResult).equals(searchKeyDoesNotExistsError)) {
       throw new RuntimeException(String.format(
           "getWebSQLQueryResult returned a searchKey does not exists error. query: '%s'", query));
     }
-    if (dbQueryResult.equals(tableDoesNotExistsError)) {
+    if (String.valueOf(dbQueryResult).equals(tableDoesNotExistsError)) {
       throw new RuntimeException(String.format(
           "getWebSQLQueryResult returned a table does not exists error. query: '%s'", query));
     }
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/CancelAndRplcBlindReturn.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/CancelAndRplcBlindReturn.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/CancelAndRplcBlindReturn.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/cancelandreplace/CancelAndRplcBlindReturn.java
@@ -35,6 +35,20 @@
    */
   @Test
   public void test() {
+    // Do a sale first
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+    tap(TestIdPack.BUTTON_SEARCH);
+    write(TestIdPack.FIELD_SEARCH_TEXT, "Avalanche transceiver");
+    tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+    tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+
+    // Finish the receipt
+    tap(TestIdPack.BUTTON_PAY);
+    tap(TestIdPack.BUTTON_PAY_EXACT);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
     tap(TestIdPack.BUTTON_MENU);
     tap(TestIdPack.BUTTON_MENU_RETURNTHISRECEIPT);
     tap(TestIdPack.BUTTON_SEARCH);
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I31484_ReceiptModifyCustomerAddProduct.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I31484_ReceiptModifyCustomerAddProduct.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I31484_ReceiptModifyCustomerAddProduct.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I31484_ReceiptModifyCustomerAddProduct.java
@@ -11,7 +11,7 @@
  * 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-2016 Openbravo S.L.U.
+ * All portions are Copyright (C) 2008-2017 Openbravo S.L.U.
  * All Rights Reserved.
  * Contributor(s):
  ************************************************************************
@@ -54,7 +54,8 @@
 
   @Test
   public void test() {
-    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    tap(TestIdCore.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_CUSTOMERS);
     tap(TestIdPack.BUTTON_CUSTOMER_NEW);
     write(TestIdPack.FIELD_CUSTOMER_NAME, "Joahn");
     write(TestIdPack.FIELD_CUSTOMER_LASTNAME, "Does");
