Related issue 38739: In Open Receipt Selector allow multiple selection
authorEduardo Becerra <ebec70@yahoo.com>
Thu, 21 Feb 2019 08:54:29 +0100
changeset 8243 e6b197a1c1a3
parent 8242 0394e8ac85e0
child 8244 1573ea0380ff
child 8285 7d29000d58dd
child 8410 da4a9d888c0b
Related issue 38739: In Open Receipt Selector allow multiple selection
src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I38739_OpenMultipleReceipts.java
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Wed Feb 20 09:51:09 2019 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/TestIdPack.java	Thu Feb 21 08:54:29 2019 +0100
@@ -974,6 +974,8 @@
       "bpsloclistitemprinter_row1_bPLocAssignToReceiptContextMenuItem", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_POPUP_3DOTS_MANAGE_ADDRESS = new TestIdConstructor(
       "stBPAssignToReceipt_row1_bPAddressContextMenuItem", EnyoKind.BUTTON); //
+  public static TestIdConstructor BUTTON_POPUP_3DOTS_RELATED_DOCUMENTS = new TestIdConstructor(
+            "stBPAssignToReceipt_row1_bPReceiptsContextMenuItem", EnyoKind.BUTTON); //
   public static TestIdConstructor CUSTOMER_MULTIPRICELIST_SELECTOR = new TestIdConstructor(
       "customerPriceList_customerCombo", EnyoKind.BUTTON); //
 
@@ -3098,6 +3100,8 @@
       "openreceiptslistitemprinter_entitySearchBtn", EnyoKind.BUTTON);
   public static TestIdConstructor BUTTON_OPEN_RECEIPT_ROW1 = new TestIdConstructor(EnyoKind.BUTTON,
       "openreceiptslistitemprinter_row1_receiptSelectorRenderLine", "loadLayaway", false);
+  public static TestIdConstructor BUTTON_OPEN_RECEIPT_ROW2 = new TestIdConstructor(EnyoKind.BUTTON,
+      "openreceiptslistitemprinter_row2_receiptSelectorRenderLine", "loadLayaway", false);
   public static TestIdConstructor FIELD_OPEN_RECEIPT_FILTER_COMBO = new TestIdConstructor(
       "openreceiptslistitemprinter_entityFilterColumn"); //
   public static TestIdConstructor FIELD_OPEN_RECEIPT_FILTER_ORDERTYPE_COMBO = new TestIdConstructor(
@@ -3108,6 +3112,8 @@
       "openreceiptslistitemprinter_smallButton", EnyoKind.BUTTON); //
   public static TestIdConstructor BUTTON_OPEN_RECEIPT_ADVANCED_FILTER = new TestIdConstructor(
       "openreceiptslistitemprinter_advancedFilterWindowButtonReceipts", EnyoKind.BUTTON); //
+  public static TestIdConstructor BUTTON_OPEN_RECEIPT_OPEN_SELECTED = new TestIdConstructor(
+      "openreceiptslistitemprinter_btnOpenSelected", EnyoKind.BUTTON); //
   public static TestIdConstructor FIELD_OPEN_RECEIPT_ADVANCED_FILTER_ORDERTYPE_COMBO = new TestIdConstructor(
       "filters_inputorderType"); //
   public static TestIdConstructor BUTTON_OPEN_RECEIPT_ADVANCED_FILTER_CUSTOMER = new TestIdConstructor(
@@ -3154,6 +3160,8 @@
       "openreceiptslistitemprinter_row1_orderType"); //
   public static TestIdConstructor LABEL_OPEN_RECEIPT_SEARCH_RESULT_ROW2_ORDERTYPE = new TestIdConstructor(
       "openreceiptslistitemprinter_row2_orderType"); //
+  public static TestIdConstructor LABEL_OPEN_RECEIPT_ADVANCED_FILTER_INFO = new TestIdConstructor(
+      "openreceiptslistitemprinter_advancedFilterInfo"); //
   public static TestIdConstructor LABEL_OPEN_RECEIPT_SEARCH_RESULT_ROW3_ORDERTYPE = new TestIdConstructor(
       "openreceiptslistitemprinter_row3_orderType"); //
   public static TestIdConstructor BUTTON_OPEN_RECEIPT_CLOSE = new TestIdConstructor(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I38739_OpenMultipleReceipts.java	Thu Feb 21 08:54:29 2019 +0100
@@ -0,0 +1,157 @@
+/*
+ *************************************************************************
+ * 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) 2019 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author EBE
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor;
+import org.openbravo.test.mobile.retail.mobilecore.utils.ApplicationWindow;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I38739_OpenMultipleReceipts extends WebPOSTerminalHelper {
+
+  @Test
+  public void openSingleReceipt() {
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_OPENRECEIPT);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_SEARCH);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ROW1);
+    waitUntilCertainWindowIsReached(ApplicationWindow.POINTOFSALE);
+    verify(TestIdPack.LABEL_RECEIPT_COUNTER, "1");
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+
+  @Test
+  public void openMultipleReceipt() {
+    // Create a new receipt for Arturo Montoro
+    changeBP();
+    addAvalancheTransceiver();
+    payTicket(TestIdPack.BUTTON_PAYMENT_CASH);
+
+    // Select Arturo Montoro
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    write(TestIdPack.FIELD_CUSTOMER_MODAL, "Arturo");
+    tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+    tap(TestIdPack.BUTTON_POPUP_CUSTOMER_3DOTS);
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_RELATED_DOCUMENTS);
+    verify(TestIdPack.LABEL_OPEN_RECEIPT_ADVANCED_FILTER_INFO, "Advanced filter applied");
+    // Select two receipt
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, true);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ROW1);
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, false);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ROW2);
+    // Open selected
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED);
+    waitUntilCertainWindowIsReached(ApplicationWindow.POINTOFSALE);
+    verify(TestIdPack.LABEL_RECEIPT_COUNTER, "2");
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+
+  @Test
+  public void openMultipleReceiptAndSelectReturn() {
+    // Create a new receipt (return) for Arturo Montoro
+    changeBP();
+    addAvalancheTransceiver();
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_RETURNTHISRECEIPT);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "-150.50");
+    payTicket(TestIdPack.BUTTON_PAYMENT_CARD);
+
+    // Select Arturo Montoro
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    write(TestIdPack.FIELD_CUSTOMER_MODAL, "Arturo");
+    tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+    tap(TestIdPack.BUTTON_POPUP_CUSTOMER_3DOTS);
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_RELATED_DOCUMENTS);
+    verify(TestIdPack.LABEL_OPEN_RECEIPT_ADVANCED_FILTER_INFO, "Advanced filter applied");
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, true);
+    // Advanced Filters
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ADVANCED_FILTER);
+    TestIdPack.FIELD_OPEN_RECEIPT_ADVANCED_FILTER_ORDERTYPE_COMBO.enyoNode().executeExtension(
+        ".setSelected(1)");
+    tap(TestIdPack.BUTTON_ADVANCED_FILTERS_APPLY);
+    // Open Return
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ROW1);
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, false);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED);
+    waitUntilCertainWindowIsReached(ApplicationWindow.POINTOFSALE);
+    verify(TestIdPack.LABEL_RECEIPT_COUNTER, "1");
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+
+  @Test
+  public void openMultipleReceiptAndSelectOtherCustomer() {
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    write(TestIdPack.FIELD_CUSTOMER_MODAL, "Arturo");
+    tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+    tap(TestIdPack.BUTTON_POPUP_CUSTOMER_3DOTS);
+    tap(TestIdPack.BUTTON_POPUP_3DOTS_RELATED_DOCUMENTS);
+    verify(TestIdPack.LABEL_OPEN_RECEIPT_ADVANCED_FILTER_INFO, "Advanced filter applied");
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, true);
+    // Advanced Filters
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ADVANCED_FILTER);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ADVANCED_FILTER_CUSTOMER);
+    write(TestIdPack.FIELD_CUSTOMER_MODAL, "VBS Customer");
+    tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+    tap(TestIdPack.BUTTON_CUSTOMER_SEARCH_ROW1);
+    tap(TestIdPack.BUTTON_ADVANCED_FILTERS_APPLY);
+    // Open Receipt
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_ROW1);
+    isDisabled(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED, false);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_OPEN_SELECTED);
+    waitUntilCertainWindowIsReached(ApplicationWindow.POINTOFSALE);
+    verify(TestIdPack.LABEL_RECEIPT_COUNTER, "1");
+    tap(TestIdPack.BUTTON_DELETERECEIPT);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+
+  private void changeBP() {
+    tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+    write(TestIdPack.FIELD_CUSTOMER_MODAL, "Arturo");
+    tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+    tap(TestIdPack.BUTTON_CUSTOMER_SEARCH_ROW1);
+    verify(TestIdPack.BUTTON_RECEIPT_CUSTOMER, "Arturo Montoro");
+  }
+
+  private void addAvalancheTransceiver() {
+    tap(TestIdPack.BUTTON_SEARCH);
+    write(TestIdPack.FIELD_SEARCH_TEXT,
+        TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER.getRowName());
+    tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+    tap(TestIdPack.BUTTON_SEARCHPRODUCT_AVALANCHETRANSCEIVER);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+  }
+
+  private void payTicket(TestIdConstructor paymentMethod) {
+    tap(TestIdPack.BUTTON_PAY);
+    tap(paymentMethod);
+    tap(TestIdPack.BUTTON_PAY_EXACT);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+  }
+
+}