Verifies issue 39897 : Added Automated Test 'I39897_VerifyCRWithDeliveryModes'
authorRanjith S R <ranjith@qualiantech.com>
Thu, 10 Jan 2019 18:29:57 +0530
changeset 8041 30df0ae396c3
parent 8040 862f61e2a875
child 8042 85b3f9db7c06
Verifies issue 39897 : Added Automated Test 'I39897_VerifyCRWithDeliveryModes'
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/TestIdExtModules.java
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/suites/concurrent/job011/DeliveryModesSuite.java
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/suites/concurrent/job011/DeliveryModesSuiteHV.java
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/AllDeliveryModesTests.java
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/AllDeliveryModesTestsHV.java
src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/I39897_VerifyCRWithDeliveryModes.java
--- a/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/TestIdExtModules.java	Tue Jan 08 15:48:55 2019 -0500
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/TestIdExtModules.java	Thu Jan 10 18:29:57 2019 +0530
@@ -11,7 +11,7 @@
  * 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-2018 Openbravo S.L.U.
+ * All portions are Copyright (C) 2008-2019 Openbravo S.L.U.
  * All Rights Reserved.
  * Contributor(s):
  ************************************************************************
@@ -388,6 +388,18 @@
   public static TestIdConstructor POPUP_ACTIVE_DISCOUNTS = new TestIdConstructor(
       "UI_DiscountsPopup");
 
+  // Delivery Modes
+  public static TestIdConstructor BUTTON_EDIT_DELIVERYMODES = new TestIdConstructor(
+      "actionButtonsContainer_deliveryModesButton", EnyoKind.BUTTON); //
+  public static TestIdConstructor POPUP_DELIVERYMODES = new TestIdConstructor(
+      "OBRDM_ReceiptMultilines"); //
+  public static TestIdConstructor COMBO_DELIVERYMODES_LIST = new TestIdConstructor(
+      "ReceiptLineDeliveryMode_renderCombo", EnyoKind.BUTTON); //
+  public static TestIdConstructor BUTTON_DELIVERYMODES_APPLY = new TestIdConstructor(
+      "bodyButtons_receiptMultiLinePropertiesApplyBtn", EnyoKind.BUTTON); //
+  public static TestIdConstructor BUTTON_DELIVERYMODES_CANCEL = new TestIdConstructor(
+      "bodyButtons_receiptMultiLinePropertiesCancelBtn", EnyoKind.BUTTON); //
+
   // Combos
   public static TestIdConstructor POPUP_COMBO = new TestIdConstructor("OBCOMBO_Popup"); //
   public static TestIdConstructor BUTTON_PRODUCT_BACKPACKSANDTRAVEL_BACKPACKCB1 = new TestIdConstructor(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/suites/concurrent/job011/DeliveryModesSuite.java	Thu Jan 10 18:29:57 2019 +0530
@@ -0,0 +1,48 @@
+/*
+ *************************************************************************
+ * 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.extmodules.selenium.suites.concurrent.job011;
+
+import org.junit.AfterClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.openbravo.test.mobile.core.utils.SuiteHelper;
+import org.openbravo.test.mobile.retail.extmodules.selenium.tests.deliverymodes.AllDeliveryModesTests;
+import org.openbravo.test.mobile.retail.extmodules.selenium.tests.loginlogout.ExtModLogoutAndCloseBrowser;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+//
+    AllDeliveryModesTests.class, //
+
+    ExtModLogoutAndCloseBrowser.class //
+})
+public class DeliveryModesSuite extends SuiteHelper {
+
+  @AfterClass
+  public static void afterclass() {
+    nameChild(DeliveryModesSuite.class.getSimpleName());
+    SuiteHelper.afterclass();
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/suites/concurrent/job011/DeliveryModesSuiteHV.java	Thu Jan 10 18:29:57 2019 +0530
@@ -0,0 +1,48 @@
+/*
+ *************************************************************************
+ * 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.extmodules.selenium.suites.concurrent.job011;
+
+import org.junit.AfterClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.openbravo.test.mobile.core.utils.SuiteHelper;
+import org.openbravo.test.mobile.retail.extmodules.selenium.tests.deliverymodes.AllDeliveryModesTestsHV;
+import org.openbravo.test.mobile.retail.extmodules.selenium.tests.loginlogout.ExtModLogoutAndCloseBrowser;
+
+@RunWith(Suite.class)
+@SuiteClasses({
+//
+    AllDeliveryModesTestsHV.class, //
+
+    ExtModLogoutAndCloseBrowser.class //
+})
+public class DeliveryModesSuiteHV extends SuiteHelper {
+
+  @AfterClass
+  public static void afterclass() {
+    nameChild(DeliveryModesSuiteHV.class.getSimpleName());
+    SuiteHelper.afterclass();
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/AllDeliveryModesTests.java	Thu Jan 10 18:29:57 2019 +0530
@@ -0,0 +1,33 @@
+/*
+ *************************************************************************
+ * 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.extmodules.selenium.tests.deliverymodes;
+
+import org.junit.runner.RunWith;
+import org.openbravo.test.mobile.core.junit.toolbox.SuiteClassesToolbox;
+import org.openbravo.test.mobile.retail.mobilecore.junit.OBWildcardPatternSuite;
+
+@RunWith(OBWildcardPatternSuite.class)
+@SuiteClassesToolbox()
+public class AllDeliveryModesTests {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/AllDeliveryModesTestsHV.java	Thu Jan 10 18:29:57 2019 +0530
@@ -0,0 +1,35 @@
+/*
+ *************************************************************************
+ * 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.extmodules.selenium.tests.deliverymodes;
+
+import org.junit.runner.RunWith;
+import org.openbravo.test.mobile.core.junit.toolbox.SuiteClassesToolbox;
+import org.openbravo.test.mobile.retail.mobilecore.annotations.SuiteAnnotations;
+import org.openbravo.test.mobile.retail.mobilecore.junit.OBWildcardPatternSuite;
+
+@RunWith(OBWildcardPatternSuite.class)
+@SuiteClassesToolbox
+@SuiteAnnotations(activateHighVolumeMode = true)
+public class AllDeliveryModesTestsHV {
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/deliverymodes/I39897_VerifyCRWithDeliveryModes.java	Thu Jan 10 18:29:57 2019 +0530
@@ -0,0 +1,89 @@
+/*
+ *************************************************************************
+ * 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.extmodules.selenium.tests.deliverymodes;
+
+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.extmodules.selenium.TestIdExtModules;
+import org.openbravo.test.mobile.retail.extmodules.selenium.terminals.WebPOSExtModulesTerminalHelper;
+import org.openbravo.test.mobile.retail.mobilecore.javascript.BackboneHelper;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+
+public class I39897_VerifyCRWithDeliveryModes extends WebPOSExtModulesTerminalHelper {
+
+  @Test
+  public void test() {
+    // Add Product with Delivery Mode
+    tap(TestIdExtModules.BUTTON_SEARCH);
+    write(TestIdExtModules.FIELD_SEARCH_TEXT,
+        TestIdExtModules.BUTTON_SEARCHPRODUCT_ADHESIVEBODYWARNMERS.getRowName());
+    tap(TestIdExtModules.BUTTON_SEARCH_EXECUTE);
+    tap(TestIdExtModules.BUTTON_SEARCHPRODUCT_FIRSTROW);
+    verify(TestIdExtModules.LABEL_TOTALTOPAY, "3.60");
+    tap(TestIdExtModules.BUTTON_RECEIPT_ROW1);
+    tap(TestIdExtModules.BUTTON_EDIT_DELIVERYMODES);
+    isVisible(TestIdExtModules.POPUP_DELIVERYMODES, true);
+    tap(TestIdExtModules.BUTTON_DELIVERYMODES_APPLY);
+    final String receiptNo = BackboneHelper.getDocumentNo();
+    tap(TestIdExtModules.BUTTON_PAY);
+
+    final String lineDeliveryMode = (String) SeleniumHelper
+        .executeScriptWithReturn("OB.MobileApp.model.receipt.attributes.lines.models[0].attributes.obrdmDeliveryMode");
+    assertThat("Delivery Mode is not set to Receipt Line", lineDeliveryMode,
+        equalTo("PickAndCarry"));
+
+    tap(TestIdExtModules.BUTTON_PAY_EXACT);
+    tap(TestIdExtModules.BUTTON_PAY_DONE);
+    verify(TestIdExtModules.LABEL_TOTALTOPAY, "0.00");
+
+    // Do Cancel And Replace
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_OPENRECEIPT);
+    write(TestIdPack.FIELD_OPEN_RECEIPT_FILTER_TXT, receiptNo);
+    tap(TestIdPack.BUTTON_OPEN_RECEIPT_SEARCH);
+    tap(TestIdPack.TABLE_OPEN_RECEIPT, receiptNo);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "3.60");
+    tap(TestIdPack.BUTTON_MENU);
+    tap(TestIdPack.BUTTON_MENU_CANCELANDREPLACE);
+    verify(TestIdPack.LABEL_RECEIPT_TYPE, "'Cancel and Replace' of  " + receiptNo);
+    verify(TestIdExtModules.LABEL_RECEIPT_ROW1_DELIVEREDDISCOUNTNAME,
+        "-- Delivery Mode: Pick and carry");
+    tap(TestIdExtModules.BUTTON_RECEIPT_ROW1);
+    tap(TestIdExtModules.BUTTON_KEYPAD_2);
+    tap(TestIdExtModules.BUTTON_KEYPAD_QUANTITY);
+    verify(TestIdPack.LABEL_TOTALTOPAY, "7.20");
+    tap(TestIdExtModules.BUTTON_SEARCH);
+    write(TestIdExtModules.FIELD_SEARCH_TEXT,
+        TestIdExtModules.BUTTON_SEARCHPRODUCT_ALPINESKIING.getRowName());
+    tap(TestIdExtModules.BUTTON_SEARCH_EXECUTE);
+    tap(TestIdExtModules.BUTTON_SEARCHPRODUCT_FIRSTROW);
+    verify(TestIdExtModules.LABEL_TOTALTOPAY, "117.10");
+    tap(TestIdExtModules.BUTTON_PAY);
+    tap(TestIdExtModules.BUTTON_PAY_EXACT);
+    tap(TestIdExtModules.BUTTON_PAY_DONE);
+    verify(TestIdExtModules.LABEL_TOTALTOPAY, "0.00");
+  }
+}
\ No newline at end of file