Verifies issue
38424 : Added automated test 'I38424_VerifyReturnReasonForMultiSelectLine
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/returns/I38424_VerifyReturnReasonForMultiSelectLine.java Mon Apr 30 11:47:12 2018 +0530
@@ -0,0 +1,86 @@
+/*
+ *************************************************************************
+ * 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) 2018 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.returns;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.retail.mobilecore.database.DatabaseHelperSelect;
+import org.openbravo.test.mobile.retail.mobilecore.javascript.BackboneHelper;
+import org.openbravo.test.mobile.retail.mobilecore.selenium.TestIdConstructor;
+import org.openbravo.test.mobile.retail.pack.selenium.TestIdPack;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I38424_VerifyReturnReasonForMultiSelectLine extends WebPOSTerminalHelper {
+
+ private final String returnReason2 = "F2DFD7FBC0E34580BEFA1938783B3319";
+
+ @Test
+ public void test() {
+ tap(TestIdPack.BUTTON_MENU);
+ tap(TestIdPack.BUTTON_MENU_RETURNTHISRECEIPT);
+
+ addProduct(TestIdPack.BUTTON_SEARCHPRODUCT_ADHESIVEBODYWARNMERS);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "-3.60");
+ addProduct(TestIdPack.BUTTON_SEARCHPRODUCT_ADHESIVEBODYWARMERSCLASSIC);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "-8.60");
+ tap(TestIdPack.BUTTON_RECEIPT_ROW1);
+ tap(TestIdPack.BUTTON_EDIT);
+ tap(TestIdPack.BUTTON_MULTISELECTION_BTN_SINGLESELECTION);
+ tap(TestIdPack.BUTTON_MULTISELECTION_BTN_SELECTALL);
+ verify(TestIdPack.LABEL_EDIT_DESCRIPTION, "2 ticket lines selected");
+
+ TestIdPack.COMBO_EDIT_RETURN_REASON.enyoNode().executeExtension(".setSelected(2)");
+ TestIdPack.COMBO_EDIT_RETURN_REASON.enyoNode().executeExtension(".change()");
+ TestIdPack.COMBO_EDIT_RETURN_REASON.enyoNode().executeExtension(".waterfall('onchange')");
+
+ final String receiptNo = BackboneHelper.getDocumentNo();
+ tap(TestIdPack.BUTTON_PAY);
+ tap(TestIdPack.BUTTON_PAY_EXACT);
+ tap(TestIdPack.BUTTON_PAY_DONE);
+ verify(TestIdPack.LABEL_TOTALTOPAY, "0.00");
+
+ final String sql = String.format("select col.c_return_reason_id from c_orderline col "
+ + "join c_order co on co.c_order_id = col.c_order_id "
+ + "where co.documentno = '%s' order by col.created", receiptNo);
+
+ new DatabaseHelperSelect() {
+ @Override
+ protected void yieldResultSet(ResultSet rs) throws SQLException {
+ assertThat(returnReason2, equalTo(rs.getString("c_return_reason_id")));
+ }
+ }.execute(sql, 2);
+
+ }
+
+ private void addProduct(final TestIdConstructor testId) {
+ tap(TestIdPack.BUTTON_SEARCH);
+ write(TestIdPack.FIELD_SEARCH_TEXT, testId.getRowName());
+ tap(TestIdPack.BUTTON_SEARCH_EXECUTE);
+ tap(testId);
+ }
+}
\ No newline at end of file