# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1491479278 -19800
#      Thu Apr 06 17:17:58 2017 +0530
# Node ID d8e8678c63c17161ffde327b34bd0aa62248b33f
# Parent  93a8a105b68995b4f89e5e2226916b67a4c241e9
Verifies issue 35691 : Added automated test 'I35691_VerifyCustomerLocationCountry'

diff -r 93a8a105b689 -r d8e8678c63c1 src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java
--- a/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java	Mon Apr 03 11:08:15 2017 -0600
+++ b/src-test/org/openbravo/test/mobile/core/utils/AllowedErrorsHelper.java	Thu Apr 06 17:17:58 2017 +0530
@@ -26,6 +26,7 @@
 import java.util.HashMap;
 
 import org.openbravo.test.mobile.core.junit.SequentialTestInfo;
+import org.openbravo.test.mobile.retail.pack.selenium.tests.customercreation.I35691_VerifyCustomerLocationCountry;
 import org.openbravo.test.mobile.retail.pack.selenium.tests.offline.LoginOfflineCashmanagementWaitNoForce;
 import org.openbravo.test.mobile.retail.pack.selenium.tests.offline.VerifyOfflineMode;
 import org.openbravo.test.mobile.retail.pack.selenium.tests.offline.VerifyOfflineModeII;
@@ -95,6 +96,7 @@
     testsAllowedToHaveTomcatErrors.add("SelectBothAddress");
     testsAllowedToHaveTomcatErrors.add("I34927_VerifyCustomerAddressesNagivationPath");
     testsAllowedToHaveTomcatErrors.add("I35248_VerifyUpdateCustomerOnLayaway");
+    testsAllowedToHaveTomcatErrors.add(I35691_VerifyCustomerLocationCountry.class.getSimpleName());
     // Suite Offline
     // login online
     testsAllowedToHaveTomcatErrors.add("LoginOnlineAllowedFlows");
diff -r 93a8a105b689 -r d8e8678c63c1 src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Mon Apr 03 11:08:15 2017 -0600
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Thu Apr 06 17:17:58 2017 +0530
@@ -278,6 +278,8 @@
       "editCustomerHeader_assigncustomeraddrtoticket", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_ASSIGN_ADDRESS_TO_TICKET_SHIP = new TestIdConstructor(
       "editCustomerHeader_assigncustomeraddrtoticketship", EnyoKind.BUTTON); //
+  public static TestIdConstructor INPUTBOX_CUSTOMER_COUNTRY = new TestIdConstructor(
+      "newAttribute_customerAddrCountry");
   public static TestIdConstructor COMBOBOX_CUSTOMER_COUNTRY = new TestIdConstructor(
       "customerAddrCountry_customerAddrCombo");
   public static TestIdConstructor FIELD_CUSTOMER_ADDRESS_COUNTRY = new TestIdConstructor(
@@ -815,6 +817,8 @@
       "bpsloclistitemprinter_row1_bPLocEditContextMenuItem", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_POPUP_3DOTS_VIEW = new TestIdConstructor(
       "bpsloclistitemprinter_row1_bPLocDetailsContextMenuItem", EnyoKind.BUTTON); //
+  public static TestIdConstructor BUTTON_POPUP_3DOTS_ROW2_VIEW = new TestIdConstructor(
+      "bpsloclistitemprinter_row2_bPLocDetailsContextMenuItem", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_POPUP_CUSTOMER_3DOTS = new TestIdConstructor(
       "stBPAssignToReceipt_row1_listButton", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_POPUP_CUSTOMER_3DOTS_DETAILS = new TestIdConstructor(
diff -r 93a8a105b689 -r d8e8678c63c1 src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/customercreation/I35691_VerifyCustomerLocationCountry.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/customercreation/I35691_VerifyCustomerLocationCountry.java	Thu Apr 06 17:17:58 2017 +0530
@@ -0,0 +1,77 @@
+/*
+ *************************************************************************
+ * 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) 2017 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.customercreation;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.utils.OBUtils;
+import org.openbravo.test.mobile.retail.mobilecore.javascript.TestRegistryHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I35691_VerifyCustomerLocationCountry extends WebPOSTerminalHelper {
+
+  @Test
+  public void test() {
+
+    final String customerName = "TestCustomer_" + System.currentTimeMillis();
+
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    tap(TestIdPack.BUTTON_CUSTOMER_NEW);
+    write(TestIdPack.FIELD_CUSTOMER_NAME, customerName);
+    verify(TestIdPack.LABEL_USE_SAME_ADDR, "Use the same address for shipping and invoicing");
+    tap(TestIdPack.CHECK_USE_SAME_ADDR);
+
+    write(TestIdPack.FIELD_CUSTOMER_ADDRESS_LOC_NAME, customerName + " Addr Ship");
+    write(TestIdPack.FIELD_CUSTOMER_ADDRESS_INV_NAME, customerName + " Addr Invi");
+    tap(TestIdPack.BUTTON_CUSTOMER_SAVE);
+    TestRegistryHelper.waitForPopupToUpdate();
+    tap(TestIdPack.BUTTON_CUSTOMER_ASSIGNTOCUSTOMER);
+    reload();
+
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    OBUtils.pause(1000);
+    tap(TestIdPack.BUTTON_POPUP_CUSTOMER_3DOTS);
+    tap(TestIdPack.BUTTON_POPUP_CUSTOMER_3DOTS_DETAILS);
+    tap(TestIdPack.BUTTON_CUSTOMER_EDIT_CUSTOMER);
+    tap(TestIdPack.BUTTON_CUSTOMER_SAVE);
+
+    tap(TestIdPack.BUTTON_CUSTOMER_MANAGE_ADDRESS);
+    OBUtils.pause(1000);
+    // Address 1
+    tap(TestIdPack.BUTTON_POPUP_3DOTS);
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_VIEW);
+    verify(TestIdPack.INPUTBOX_CUSTOMER_COUNTRY, "Spain");
+    tap(TestIdPack.BUTTON_ADDRESS_DETAIL_POPUP_CLOSE);
+    // Address 2
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_ROW2);
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_ROW2_VIEW);
+    verify(TestIdPack.INPUTBOX_CUSTOMER_COUNTRY, "Spain");
+    tap(TestIdPack.BUTTON_ADDRESS_DETAIL_POPUP_CLOSE);
+
+    reload();
+
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    tap(TestIdPack.BUTTON_DELETERECEIPT_CONFIRM);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+}
\ No newline at end of file
