# HG changeset patch
# User Jorge Garcia <jorge.garcia@openbravo.com>
# Date 1475509190 -7200
#      Mon Oct 03 17:39:50 2016 +0200
# Node ID 2389d4e27a5b318c10841edad78cdd5180b49ab9
# Parent  3b1913ea46927d963c0722cffdbce6fd5aad7e5d
Verifies issue 33939: SER QA 1790 Wrong remaining to pay amount when paying
with multicurrency

Added test I33939_WrongRemainingAmtWithMultiCurrency.

diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
@@ -548,6 +548,8 @@
   // Payment breakdown
   public static TestIdConstructor LABEL_RECEIPT_PAYMENT_ROW1_NAME = new TestIdConstructor(
       "listPaymentLines_row1_name"); //
+  public static TestIdConstructor LABEL_RECEIPT_PAYMENT_ROW1_FOREIGNAMOUNT = new TestIdConstructor(
+      "listPaymentLines_row1_foreignAmount"); //
   public static TestIdConstructor LABEL_RECEIPT_PAYMENT_ROW2_NAME = new TestIdConstructor(
       "listPaymentLines_row2_name"); //
   public static TestIdConstructor LABEL_RECEIPT_PAYMENT_ROW3_NAME = new TestIdConstructor(
diff --git a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I33939_WrongRemainingAmtWithMultiCurrency.java b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I33939_WrongRemainingAmtWithMultiCurrency.java
new file mode 100644
--- /dev/null
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I33939_WrongRemainingAmtWithMultiCurrency.java
@@ -0,0 +1,78 @@
+/*
+ *************************************************************************
+ * 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) 2016 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author JGA
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.layaway;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.common.junit.TestClassAnnotations;
+import org.openbravo.test.mobile.common.selenium.WebPOSTerminalHelper;
+import org.openbravo.test.mobile.common.selenium.javascript.BackboneHelper;
+import org.openbravo.test.mobile.common.selenium.javascript.SynchronizationHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+
+@TestClassAnnotations(isHighVolumeCompatible = false)
+public class I33939_WrongRemainingAmtWithMultiCurrency extends WebPOSTerminalHelper {
+  String docNumber;
+
+  @Test
+  public void test() {
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_LAYAWAYTHISRECEIPT);
+
+    tap(TestIdPack.BUTTON_BROWSE);
+    tap(TestIdPack.BUTTON_CATEGORY_BESTSELLERS);
+    tap(TestIdPack.BUTTON_PRODUCT_BESTSELLERS_AVALANCHETRANSCEIVER);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+
+    docNumber = BackboneHelper.getDocumentNo();
+
+    tap(TestIdPack.BUTTON_PAY);
+    tap(TestIdPack.BUTTON_CASHUSA);
+    write(TestIdPack.INPUT_POINTOFSALE, "100");
+    tap(TestIdPack.BUTTON_KEYPAD_ENTER);
+    tap(TestIdPack.BUTTON_LAYAWAY);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+    SynchronizationHelper.waitUntilDataIsInTheServer(); // Wait to the synchronization of the layway
+                                                        // in the server
+
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_LAYAWAYS);
+
+    write(TestIdPack.FIELD_SEARCH_RECEIPT, docNumber);
+    tap(TestIdPack.BUTTON_LAYAWAYS_SEARCH);
+    tap(TestIdPack.BUTTON_LAYAWAYS_ROW1);
+
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+    verify(TestIdPack.LABEL_RECEIPT_TYPE, "Layaway");
+    verify(TestIdPack.LABEL_RECEIPT_PAYMENT_ROW1_NAME, "USA Cash");
+    verify(TestIdPack.LABEL_RECEIPT_PAYMENT_ROW1_AMOUNT, "76.08");
+    verify(TestIdPack.LABEL_RECEIPT_PAYMENT_ROW1_FOREIGNAMOUNT, "(100.00 USD)");
+
+    tap(TestIdPack.BUTTON_PAY);
+    tap(TestIdPack.BUTTON_PAY_EXACT);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+}
