Verifies issue 39928 : Added Automated Test "I39928_VerifyReceiptWithZeroLines"
authorRanjith S R <ranjith@qualiantech.com>
Mon, 28 Jan 2019 17:18:44 +0530
changeset 8117 918237bba90f
parent 8116 8d765fc7dbc3
child 8118 03de69d63b09
child 8272 108ad629bc24
Verifies issue 39928 : Added Automated Test "I39928_VerifyReceiptWithZeroLines"
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I39928_VerifyReceiptWithZeroLines.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I39928_VerifyReceiptWithZeroLines.java	Mon Jan 28 17:18:44 2019 +0530
@@ -0,0 +1,65 @@
+/*
+ *************************************************************************
+ * 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 RAN
+ *
+ */
+package org.openbravo.test.mobile.retail.pack.selenium.tests.receipts;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.core.selenium.SeleniumHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I39928_VerifyReceiptWithZeroLines extends WebPOSTerminalHelper {
+
+  final String strCarlStudson = "Carl Studson";
+
+  @Test
+  public void test() {
+    Boolean perSaveRemoveTicket = false;
+    try {
+      tap(TestIdPack.BUTTON_RECEIPT_CUSTOMER);
+      write(TestIdPack.FIELD_CUSTOMER_MODAL, strCarlStudson);
+      tap(TestIdPack.BUTTON_CUSTOMER_MODAL_SEARCH);
+      verify(TestIdPack.LABEL_CUSTOMER_SEARCH_IDENTIFIER, strCarlStudson);
+      tap(TestIdPack.BUTTON_CUSTOMER_SEARCH_ROW1);
+      assertThat(strCarlStudson, equalTo(get(TestIdPack.BUTTON_RECEIPT_CUSTOMER)));
+      reload();
+      verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+      assertThat(strCarlStudson, equalTo(get(TestIdPack.BUTTON_RECEIPT_CUSTOMER)));
+
+      perSaveRemoveTicket = (Boolean) SeleniumHelper
+          .executeScriptWithReturn("OB.MobileApp.model.get('permissions').OBPOS_remove_ticket;");
+      SeleniumHelper
+          .executeScript("OB.MobileApp.model.get('permissions').OBPOS_remove_ticket=true;");
+
+      tap(TestIdPack.BUTTON_DELETERECEIPT);
+      tap(TestIdPack.BUTTON_DELETERECEIPT_CONFIRM);
+      verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+    } finally {
+      // restore preference value
+      SeleniumHelper.executeScript(String.format(
+          "OB.MobileApp.model.get('permissions').OBPOS_remove_ticket=%s;", perSaveRemoveTicket));
+    }
+  }
+}
\ No newline at end of file