Related to issue 28933. Verifies issue 29151: Added 'I29151_InterruptVoidLayaway' test
authorRafa Alonso <rafael.alonso@openbravo.com>
Sat, 07 Mar 2015 23:11:11 +0100
changeset 4061 311d8ee5ef7e
parent 4060 1675df5b4417
child 4062 6fd24a428a31
Related to issue 28933. Verifies issue 29151: Added 'I29151_InterruptVoidLayaway' test
src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I29151_InterruptVoidLayaway.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I29151_InterruptVoidLayaway.java	Sat Mar 07 23:11:11 2015 +0100
@@ -0,0 +1,82 @@
+/*
+ *************************************************************************
+ * 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.layaway;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+
+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.APIs.PosterminalAPI;
+import org.openbravo.test.mobile.common.selenium.terminals.WebPOSTerminalHelper;
+
+public class I29151_InterruptVoidLayaway extends WebPOSTerminalHelper {
+
+  @Test
+  @TestAnnotations(waitFixOf = 29151)
+  public void test() {
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_LAYAWAYTHISRECEIPT);
+    verify(TestId.LABEL_RECEIPT_TYPE, "To be laid away");
+    tap(TestId.BUTTON_BROWSE);
+    tap(TestId.BUTTON_CATEGORY_BACKPACKSANDTRAVEL);
+    tap(TestId.BUTTON_PRODUCT_BACKPACKSANDTRAVEL_WHISTLE);
+    verify(TestId.LABEL_TOTALTOPAY, "2.90");
+    final String receiptNo = BackboneHelper.getDocumentNo();
+    final String customer = get(TestId.BUTTON_RECEIPT_CUSTOMER);
+    tap(TestId.BUTTON_PAY);
+    tap(TestId.BUTTON_LAYAWAY);
+    verify(TestId.LABEL_TOTALTOPAY, "0.00");
+
+    // retrieve the layaway
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_LAYAWAYS);
+    write(TestId.FIELD_SEARCH_RECEIPT, receiptNo);
+    tap(TestId.BUTTON_LAYAWAYS_SEARCH);
+    tap(TestId.TABLE_RECEIPTSEARCH, String.format("%s - %s", receiptNo, customer));
+    // verifications
+    verify(TestId.LABEL_RECEIPT_TYPE, "Layaway");
+    verify(TestId.LABEL_RECEIPT_COUNTER, "1");
+    verify(TestId.LABEL_TOTALTOPAY, "2.90");
+
+    // void
+    tap(TestId.BUTTON_MENU);
+    tap(TestId.BUTTON_MENU_VOIDLAYAWAY);
+    assertThat(PosterminalAPI.getLastTabShown(), equalTo("payment"));
+    verify(TestId.LABEL_RECEIPT_TYPE, "Void this Layaway");
+    verify(TestId.LABEL_RECEIPT_COUNTER, "1");
+    verify(TestId.LABEL_TOTALTOPAY, "2.90");
+    isVisible(TestId.BUTTON_PAY_DONE, true);
+    isVisible(TestId.BUTTON_LAYAWAY, false);
+
+    tap(TestId.BUTTON_BROWSE);
+    tap(TestId.BUTTON_PAY);
+    assertThat(PosterminalAPI.getLastTabShown(), equalTo("payment"));
+
+    // restore
+    tap(TestId.BUTTON_DELETERECEIPT);
+  }
+
+}