Related to issue 28933. Verifies issue 25623: Updated and new test
authorRafa Alonso <rafael.alonso@openbravo.com>
Mon, 16 Mar 2015 12:51:12 +0100
changeset 4103 47d170ef0267
parent 4102 2fb6225540a0
child 4104 5a05c6f195bb
Related to issue 28933. Verifies issue 25623: Updated and new test
src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifiedReturnsAlreadyReturned.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifiedReturnsAvoidMoreThanOrdered.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifyReturnAvoidMoreThanOrdered.java
--- a/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java	Mon Mar 16 23:18:18 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java	Mon Mar 16 12:51:12 2015 +0100
@@ -311,7 +311,7 @@
   BUTTON_VERIFIEDRETURNS_ROW1("prslistitemprinter_row1_listPRsLine", EnyoKind.BUTTON), //
   LABEL_VERIFIEDRETURNS_ROW1_TITLE("prslistitemprinter_row1_topLine"), //
   BUTTON_VERIFIEDRETURNS_LINES_CHECK("line1_checkboxButtonReturn", EnyoKind.BUTTON), //
-  BUTTON_VERIFIEDRETURNS_LINES_ALLCHECK("header_checkboxButtonAll2", EnyoKind.BUTTON), //
+  BUTTON_VERIFIEDRETURNS_LINES_CHECKALL("header_checkboxButtonAll", EnyoKind.BUTTON), //
 
   LABEL_VERIFIEDRETURNS_LINES_PRODUCT("line1_product"), //
   LABEL_VERIFIEDRETURNS_LINES_REMAININGQTY("line1_remainingQuantity"), //
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifiedReturnsAlreadyReturned.java	Mon Mar 16 12:51:12 2015 +0100
@@ -0,0 +1,80 @@
+/*
+ *************************************************************************
+ * 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) 2015 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAL
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.returns;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.common.TestAnnotations;
+import org.openbravo.test.mobile.common.selenium.javascript.BackboneHelper;
+import org.openbravo.test.mobile.common.selenium.javascript.TestId;
+import org.openbravo.test.mobile.common.selenium.javascript.TestRegistryHelper;
+import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
+
+public class I25623_VerifiedReturnsAlreadyReturned extends WebPOSTerminalHelper {
+
+  @Test
+  @TestAnnotations(from = "RR15Q2")
+  public void test() {
+    final String receiptNo1 = BackboneHelper.getDocumentNo();
+    final String customer = get(TestId.BUTTON_RECEIPT_CUSTOMER);
+    tap(TestId.BUTTON_BROWSE);
+    tap(TestId.BUTTON_CATEGORY_LIGHTINGANDELECTRONICS);
+    tap(TestId.BUTTON_PRODUCT_LIGHTINGANDELECTRONICS_BASECAMPLANTERN);
+    verify(TestId.LABEL_TOTALTOPAY, "55.50");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_PAY_EXACT);
+    tap(TestId.BUTTON_PAY_DONE);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+
+    // return the receipt
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
+    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
+    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
+    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
+    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_CHECK);
+    tap(TestId.BUTTON_POPUP_APPLY);
+    verify(TestId.LABEL_TOTALTOPAY, "-55.50");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_PAY_EXACT);
+    tap(TestId.BUTTON_PAY_DONE);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+
+    // verify that returning the receipt again, does nothing
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
+    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
+    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
+    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
+
+    TestRegistryHelper.waitForPopupToUpdate();
+
+    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_CHECKALL);
+    tap(TestId.BUTTON_POPUP_APPLY);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifiedReturnsAvoidMoreThanOrdered.java	Mon Mar 16 12:51:12 2015 +0100
@@ -0,0 +1,128 @@
+/*
+ *************************************************************************
+ * 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-2014 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAL
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.returns;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.common.TestAnnotations;
+import org.openbravo.test.mobile.common.selenium.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.common.selenium.javascript.BackboneHelper;
+import org.openbravo.test.mobile.common.selenium.javascript.TestId;
+import org.openbravo.test.mobile.common.selenium.javascript.TestRegistryHelper;
+import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
+
+/**
+ * Verifies that we do not return more than ordered
+ *
+ * @author MDJ
+ *
+ */
+public class I25623_VerifiedReturnsAvoidMoreThanOrdered extends WebPOSTerminalHelper {
+
+  @Test
+  @TestAnnotations(from = "RR15Q2")
+  public void test() {
+    final String receiptNo1 = BackboneHelper.getDocumentNo();
+    final String customer = get(TestId.BUTTON_RECEIPT_CUSTOMER);
+    tap(TestId.BUTTON_BROWSE);
+    tap(TestId.BUTTON_CATEGORY_BESTSELLERS);
+    tap(TestId.BUTTON_PRODUCT_BESTSELLERS_AVALANCHETRANSCEIVER);
+    tap(TestId.BUTTON_EDIT);
+    tap(TestId.BUTTON_KEYPAD_5);
+    tap(TestId.BUTTON_KEYPAD_QUANTITY);
+    verify(TestId.LABEL_TOTALTOPAY, "752.50");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_PAY_EXACT);
+    tap(TestId.BUTTON_PAY_DONE);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+    checkOrder(receiptNo1);
+
+    final String receiptNo2 = BackboneHelper.getDocumentNo();
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
+    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
+    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
+    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
+    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_CHECKALL);
+    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_PRODUCT, "Avalanche transceiver");
+    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_TOTALQTY, "5");
+    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_REMAININGQTY, "5");
+    write(TestId.INPUT_VERIFIEDRETURNS_LINES_QTY, "1");
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
+    tap(TestId.BUTTON_POPUP_APPLY);
+    verify(TestId.LABEL_TOTALTOPAY, "-451.50");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_PAY_EXACT);
+    tap(TestId.BUTTON_PAY_DONE);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+    checkOrder(receiptNo2);
+
+    final String receiptNo3 = BackboneHelper.getDocumentNo();
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
+    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
+    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
+    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
+    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
+
+    TestRegistryHelper.waitForPopupToUpdate();
+
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_CHECKALL);
+    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_PRODUCT, "Avalanche transceiver");
+    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_TOTALQTY, "5");
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
+    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
+    tap(TestId.BUTTON_POPUP_APPLY);
+    verify(TestId.LABEL_TOTALTOPAY, "-301.00");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_PAY_EXACT);
+    tap(TestId.BUTTON_PAY_DONE);
+    checkOrder(receiptNo3);
+  }
+
+  private void checkOrder(final String receiptNo) {
+    // verify that the order has been saved in the backend
+    final String sql = "select documentno from C_ORDER  " + "WHERE documentno='" + receiptNo + "'";
+
+    new DatabaseHelperSelect() {
+      @Override
+      protected void yieldResultSet(final ResultSet rs) throws SQLException {
+        final String documentno = rs.getString("documentno");
+
+        assertThat("'Expected' didn't return the expected data", documentno, equalTo(receiptNo));
+      }
+    }.execute(sql, 1);
+  }
+}
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I25623_VerifyReturnAvoidMoreThanOrdered.java	Mon Mar 16 23:18:18 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- *************************************************************************
- * 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-2014 Openbravo S.L.U.
- * All Rights Reserved.
- * Contributor(s):
- ************************************************************************
- *
- * @author RAL
- *
- */
-
-package org.openbravo.test.mobile.retail.pack.selenium.tests.returns;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.junit.Test;
-import org.openbravo.test.mobile.common.TestAnnotations;
-import org.openbravo.test.mobile.common.selenium.database.DatabaseHelperSelect;
-import org.openbravo.test.mobile.common.selenium.javascript.BackboneHelper;
-import org.openbravo.test.mobile.common.selenium.javascript.TestId;
-import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
-
-/**
- * Verifies that we do not return more than ordered
- * 
- * @author MDJ
- * 
- */
-public class I25623_VerifyReturnAvoidMoreThanOrdered extends WebPOSTerminalHelper {
-
-  @Test
-  @TestAnnotations(from = "RR15Q2")
-  public void test() {
-    final String receiptNo1 = BackboneHelper.getDocumentNo();
-    final String customer = get(TestId.BUTTON_RECEIPT_CUSTOMER);
-    tap(TestId.BUTTON_BROWSE);
-    tap(TestId.BUTTON_CATEGORY_BESTSELLERS);
-    tap(TestId.BUTTON_PRODUCT_BESTSELLERS_AVALANCHETRANSCEIVER);
-    tap(TestId.BUTTON_EDIT);
-    tap(TestId.BUTTON_KEYPAD_5);
-    tap(TestId.BUTTON_KEYPAD_QUANTITY);
-    verify(TestId.LABEL_TOTALTOPAY, "752.50");
-    tap(TestId.BUTTON_PAY);
-    tap(TestId.BUTTON_PAY_EXACT);
-    tap(TestId.BUTTON_PAY_DONE);
-    verify(TestId.LABEL_TOTALTOPAY, "0.00");
-    checkOrder(receiptNo1);
-
-    final String receiptNo2 = BackboneHelper.getDocumentNo();
-    tap(TestId.BUTTON_MENU);
-    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
-    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
-    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
-    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
-    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_CHECK);
-    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_PRODUCT, "Avalanche transceiver");
-    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_TOTALQTY, "5");
-    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_REMAININGQTY, "5");
-    write(TestId.INPUT_VERIFIEDRETURNS_LINES_QTY, "1");
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
-    tap(TestId.BUTTON_POPUP_APPLY);
-    verify(TestId.LABEL_TOTALTOPAY, "-451.50");
-    tap(TestId.BUTTON_PAY);
-    tap(TestId.BUTTON_PAY_EXACT);
-    tap(TestId.BUTTON_PAY_DONE);
-    verify(TestId.LABEL_TOTALTOPAY, "0.00");
-    checkOrder(receiptNo2);
-
-    final String receiptNo3 = BackboneHelper.getDocumentNo();
-    tap(TestId.BUTTON_MENU);
-    tap(TestId.BUTTON_MENU_VERIFIEDRETURN);
-    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo1);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_SEARCH);
-    verify(TestId.LABEL_VERIFIEDRETURNS_ROW1_TITLE, String.format("%s - %s", receiptNo1, customer));
-    tap(TestId.BUTTON_VERIFIEDRETURNS_ROW1);
-    verify(TestId.LABEL_POPUP_DOCUMENTNO, receiptNo1);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_ALLCHECK);
-    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_PRODUCT, "Avalanche transceiver");
-    verify(TestId.LABEL_VERIFIEDRETURNS_LINES_TOTALQTY, "5");
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYMINUS);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
-    tap(TestId.BUTTON_VERIFIEDRETURNS_LINES_QTYPLUS);
-    tap(TestId.BUTTON_POPUP_APPLY);
-    verify(TestId.LABEL_TOTALTOPAY, "-301.00");
-    tap(TestId.BUTTON_PAY);
-    tap(TestId.BUTTON_PAY_EXACT);
-    tap(TestId.BUTTON_PAY_DONE);
-    checkOrder(receiptNo3);
-  }
-
-  private void checkOrder(final String receiptNo) {
-    // verify that the order has been saved in the backend
-    final String sql = "select documentno from C_ORDER  " + "WHERE documentno='" + receiptNo + "'";
-
-    new DatabaseHelperSelect() {
-      @Override
-      protected void yieldResultSet(final ResultSet rs) throws SQLException {
-        final String documentno = rs.getString("documentno");
-
-        assertThat("'Expected' didn't return the expected data", documentno, equalTo(receiptNo));
-      }
-    }.execute(sql, 1);
-  }
-}