# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1475156467 -19800
#      Thu Sep 29 19:11:07 2016 +0530
# Node ID 84b1f167aafc9a4f3c492b6d13c88732152b5f99
# Parent  fe18f0fdae2acf4fd56120ccdbade18f301ddd4a
Verifies issue 34109 : Added automated test 'I34109_VerifyInvoiceWithZeroAmount'

diff -r fe18f0fdae2a -r 84b1f167aafc src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I34109_VerifyInvoiceWithZeroAmount.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I34109_VerifyInvoiceWithZeroAmount.java	Thu Sep 29 19:11:07 2016 +0530
@@ -0,0 +1,70 @@
+/*
+ *************************************************************************
+ * 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 RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.common.selenium.WebPOSTerminalHelper;
+import org.openbravo.test.mobile.common.selenium.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.common.selenium.javascript.BackboneHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+
+public class I34109_VerifyInvoiceWithZeroAmount extends WebPOSTerminalHelper {
+
+  @Test
+  public void test() {
+    // Create Receipt
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_INVOICETHISRECEIPT);
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_LAYAWAYTHISRECEIPT);
+
+    // Add Product
+    tap(TestIdPack.BUTTON_BROWSE);
+    tap(TestIdPack.BUTTON_CATEGORY_MOUNTAINEERING);
+    tap(TestIdPack.BUTTON_PRODUCT_MOUNTAINEERING_AVALANCHETRANSCEIVER);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "150.50");
+    final String receiptNo = BackboneHelper.getDocumentNo();
+
+    // Update Price to "0"
+    tap(TestIdPack.BUTTON_RECEIPT_ROW1);
+    tap(TestIdPack.BUTTON_KEYPAD_0);
+    tap(TestIdPack.BUTTON_KEYPAD_PRICE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+    tap(TestIdPack.BUTTON_PAY);
+    tap(TestIdPack.BUTTON_PAY_DONE);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+    final String sql = String.format("select co.c_order_id, ci.c_invoice_id from c_order co "
+        + "join c_invoice ci on ci.c_order_id = co.c_order_id where co.documentno = '%s'",
+        receiptNo);
+    new DatabaseHelperSelect() {
+      @Override
+      protected void yieldResultSet(final ResultSet rs) throws SQLException {
+
+      }
+    }.execute(sql, 1);
+  }
+}
\ No newline at end of file
