Related to issue 28933. Verifies issue 26458: Added 'I26458_LayawayCashupWrongTaxesInformation' test
authorRafa Alonso <rafael.alonso@openbravo.com>
Mon, 23 Feb 2015 17:44:44 +0100
changeset 4046 85ca32b7735a
parent 4045 724053423e16
child 4047 0d45662a39f4
Related to issue 28933. Verifies issue 26458: Added 'I26458_LayawayCashupWrongTaxesInformation' test
src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/AllLayawaysTests.java
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I26458_LayawayCashupWrongTaxesInformation.java
--- a/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java	Tue Feb 17 09:17:12 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/common/selenium/javascript/TestId.java	Mon Feb 23 17:44:44 2015 +0100
@@ -139,6 +139,7 @@
   BUTTON_RECEIPT_CUSTOMERADDRESS("receiptButtons_bplocbutton", EnyoKind.BUTTON), //
   LABEL_RECEIPT_TYPE("orderview_divText"), //
   LABEL_RECEIPT_PAY_REMAINING("paymentTabContent_totalpending"), //
+  LABEL_RECEIPT_PAY_EXACT("paymentTabContent_exactlbl"), //
   LABEL_RECEIPT_PAY_CHANGE("paymentTabContent_change"), //
   LABEL_RECEIPT_PAY_OVERPAYMENT("paymentTabContent_overpayment"), //
   LABEL_RECEIPT_PAY_NOTENOUGHCASH("paymentTabContent_noenoughchangelbl"), //
--- a/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/AllLayawaysTests.java	Tue Feb 17 09:17:12 2015 +0100
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/AllLayawaysTests.java	Mon Feb 23 17:44:44 2015 +0100
@@ -28,7 +28,8 @@
 
 @RunWith(Suite.class)
 @SuiteClasses({ CreateLayawayII.class, I27615_PartiallyPaidLayaway.class,
-    LAWa010_CreateLayaway.class, I28963_DoNotShowUseCreditButtonOnLayaways.class })
+    LAWa010_CreateLayaway.class, I28963_DoNotShowUseCreditButtonOnLayaways.class,
+    I26458_LayawayCashupWrongTaxesInformation.class })
 public class AllLayawaysTests {
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I26458_LayawayCashupWrongTaxesInformation.java	Mon Feb 23 17:44:44 2015 +0100
@@ -0,0 +1,145 @@
+/*
+ *************************************************************************
+ * 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-2015 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAL
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.layaway;
+
+import org.junit.Test;
+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;
+import org.openbravo.test.mobile.common.selenium.testhelpers.WebPOSSnippet;
+import org.openbravo.test.mobile.common.selenium.utils.Format;
+
+public class I26458_LayawayCashupWrongTaxesInformation extends WebPOSTerminalHelper {
+
+  @Test
+  public void test() {
+    // create layaway
+    tap(TestId.BUTTON_BROWSE);
+    tap(TestId.BUTTON_CATEGORY_BACKPACKSANDTRAVEL);
+    tap(TestId.BUTTON_PRODUCT_BACKPACKSANDTRAVEL_ALPINESKIING);
+    tap(TestId.BUTTON_EDIT);
+    WebPOSSnippet.tapKeypad(this, 200);
+    tap(TestId.BUTTON_KEYPAD_PRICE);
+    verify(TestId.LABEL_TOTALTOPAY, "200.00");
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_LAYAWAYTHISRECEIPT);
+    final String receiptNo = BackboneHelper.getDocumentNo();
+    final String customer = get(TestId.BUTTON_RECEIPT_CUSTOMER);
+    verify(TestId.LABEL_RECEIPT_TYPE, "To be laid away");
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_LAYAWAY);
+    verify(TestId.LABEL_TOTALTOPAY, Format.floatToWebPOSFloat(0));
+
+    // reopen and partial pay 100
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_LAYAWAYS);
+    tap(TestId.BUTTON_LAYAWAYS_SEARCH);
+    tap(TestId.TABLE_RECEIPTSEARCH, String.format("%s - %s", receiptNo, customer));
+    verify(TestId.LABEL_TOTALTOPAY, "200.00");
+    tap(TestId.BUTTON_PAY);
+    verify(TestId.LABEL_RECEIPT_PAY_REMAINING, "200.00€");
+    isDisabled(TestId.BUTTON_LAYAWAY, false);
+    WebPOSSnippet.tapKeypad(this, 100);
+    tap(TestId.BUTTON_CASH);
+    verify(TestId.LABEL_RECEIPT_PAY_REMAINING, "100.00€");
+    tap(TestId.BUTTON_LAYAWAY);
+    verify(TestId.LABEL_TOTALTOPAY, Format.floatToWebPOSFloat(0));
+
+    // perform a cashup
+    WebPOSSnippet.cleanCashup(this);
+
+    // reopen and pay the remaining 100
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_LAYAWAYS);
+    tap(TestId.BUTTON_LAYAWAYS_SEARCH);
+    tap(TestId.TABLE_RECEIPTSEARCH, String.format("%s - %s", receiptNo, customer));
+    verify(TestId.LABEL_TOTALTOPAY, "200.00");
+    tap(TestId.BUTTON_PAY);
+    verify(TestId.LABEL_RECEIPT_PAY_REMAINING, "100.00€");
+    isDisabled(TestId.BUTTON_LAYAWAY, false);
+    WebPOSSnippet.tapKeypad(this, 100);
+    tap(TestId.BUTTON_CASH);
+    verify(TestId.LABEL_RECEIPT_PAY_EXACT, "Exact amount paid.");
+    tap(TestId.BUTTON_LAYAWAY);
+    verify(TestId.LABEL_TOTALTOPAY, Format.floatToWebPOSFloat(0));
+
+    // final cashup
+    finalCashup();
+  }
+
+  private void finalCashup() {
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_CASHUP);
+    // step 1 of 5
+    tap(TestId.BUTTON_CASHUP_NEXT);
+    // step 2 of 5
+    tap(TestId.BUTTON_CASHUP_COUNTCASH_50);
+    tap(TestId.BUTTON_CASHUP_COUNTCASH_50);
+    tap(TestId.BUTTON_CASHUP_NEXT);
+    // step 3 of 5
+    tap(TestId.BUTTON_CASHUP_CARD_OK);
+    tap(TestId.BUTTON_CASHUP_CASHUSA_OK);
+    tap(TestId.BUTTON_CASHUP_VOUCHER_OK);
+    tap(TestId.BUTTON_CASHUP_NEXT);
+    // step 4 of 5
+    // cash
+    tap(TestId.BUTTON_CASHUP_KEEPNOTHING);
+    tap(TestId.BUTTON_CASHUP_NEXT);
+    // usa cash
+    tap(TestId.BUTTON_CASHUP_KEEPNOTHING);
+    tap(TestId.BUTTON_CASHUP_NEXT);
+    // voucher
+    tap(TestId.BUTTON_CASHUP_KEEPNOTHING);
+    tap(TestId.BUTTON_CASHUP_NEXT);
+
+    // step 5 of 5
+    verify(TestId.LABEL_CASHUP_STEP5_TITLE, "Step 5 of 5: Post, print and close");
+    verify(TestId.LABEL_CASHUP_POSTPRINTANDCLOSE, "Post, Print & Close");
+
+    verify(TestId.LABEL_CASHUP_NETSALES_AMOUNT, Format.floatToWebPOSFloat(0));
+    // verify(TestId.LABEL_CASHUP_NETSALES_TAX21, Format.floatToWebPOSFloat(0));
+    // verify(TestId.LABEL_CASHUP_NETSALES_2_TAX21, "1.35");
+    verify(TestId.LABEL_CASHUP_GROSSSALES_AMOUNT, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_NETRETURNS_AMOUNT, Format.floatToWebPOSFloat(0));
+    // verify(TestId.LABEL_CASHUP_NETRETURMS_TAX21, "1.35");
+    verify(TestId.LABEL_CASHUP_GROSSRETURNS_AMOUNT, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_TOTALTRASACTIONS, Format.floatToWebPOSFloat(0));
+
+    verify(TestId.LABEL_CASHUP_STARTING_TOTAL, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_WITHDRAWAL_TOTAL, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_DEPOSIT_TOTAL, Format.floatToWebPOSFloat(100F));
+    verify(TestId.LABEL_CASHUP_EXPECTED_TOTAL, Format.floatToWebPOSFloat(100F));
+    verify(TestId.LABEL_CASHUP_COUNTED_TOTAL, Format.floatToWebPOSFloat(100F));
+    verify(TestId.LABEL_CASHUP_DIFFERENCE_TOTAL, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_TOTALTOKEEP_TOTAL, Format.floatToWebPOSFloat(0));
+    verify(TestId.LABEL_CASHUP_TOTALTODEPOSIT_TOTAL, Format.floatToWebPOSFloat(100F));
+
+    tap(TestId.BUTTON_CASHUP_POSTPRINTANDCLOSE);
+
+    // done
+    verify(TestId.LABEL_POPUP_TITLE, "Good job!");
+    tap(TestId.BUTTON_POPUP_OK);
+    verify(TestId.LABEL_TOTALTOPAY, Format.floatToWebPOSFloat(0));
+  }
+
+}