# HG changeset patch
# User Ranjith S R <ranjith@qualiantech.com>
# Date 1533621238 -19800
#      Tue Aug 07 11:23:58 2018 +0530
# Node ID 152dd9db62926c0c733b195fabda8a475009934c
# Parent  b3b770c69242daa1cf167105bb19d93c4c11af03
Related to issue 37309 : Added OBWait on tap of EnyoNode Buttons

diff -r b3b770c69242 -r 152dd9db6292 src-test/org/openbravo/test/mobile/retail/mobilecore/intuitive/IntuitiveCommandsMobileCore.java
--- a/src-test/org/openbravo/test/mobile/retail/mobilecore/intuitive/IntuitiveCommandsMobileCore.java	Fri Aug 03 11:32:31 2018 +0530
+++ b/src-test/org/openbravo/test/mobile/retail/mobilecore/intuitive/IntuitiveCommandsMobileCore.java	Tue Aug 07 11:23:58 2018 +0530
@@ -25,6 +25,7 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThan;
+import static org.junit.Assert.assertFalse;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -212,7 +213,42 @@
       if (SequentialTestInfo.getHighVolumenMode()) {
         time_start = System.currentTimeMillis();
       }
-      enyoNode.tap();
+      if (enyoNode.getEnyoKind() == EnyoKind.BUTTON) {
+        final boolean isDisabledExists = (Boolean) enyoNode
+            .executeExtensionWithReturn(".getDisabled !== undefined");
+
+        new OBWait(100, OBConstants.MAX_RETRY_GET_DOM_ID_THROTTLE) {
+          boolean isVisible = false;
+
+          @Override
+          protected boolean until(final int currentIteration) {
+            isVisible = enyoNode.isVisible();
+            if (!isVisible) {
+              return false;
+            }
+            if (!isDisabledExists || (isDisabledExists && enyoNode.isDisabled() == false)) {
+              enyoNode.tap();
+              return true;
+            } else {
+              return false;
+            }
+          }
+
+          @Override
+          protected void timeout() {
+            if (!isVisible) {
+              assertFalse(String.format("The button '%s' didn't enter the visible state.", //
+                  dom.toString()), true);
+            } else {
+              assertFalse(String.format("The button '%s' didn't enter the enabled state.", //
+                  dom.toString()), true);
+            }
+          }
+        };
+      } else {
+        enyoNode.tap();
+      }
+
       if (SequentialTestInfo.getHighVolumenMode()) {
         verifyHighVolumeTime(dom);
       }
diff -r b3b770c69242 -r 152dd9db6292 src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I37309_VerifyEnyoTab.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I37309_VerifyEnyoTab.java	Tue Aug 07 11:23:58 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ *************************************************************************
+ * 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) 2015 Openbravo S.L.U.
+ * All Rights Reserved.
+ * Contributor(s):
+ ************************************************************************
+ *
+ * @author RAN
+ *
+ */
+
+package org.openbravo.test.mobile.retail.pack.selenium.tests.system;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.openbravo.test.mobile.retail.pack.API.WebPOSAPI;
+import org.openbravo.test.mobile.retail.pack.selenium.terminals.WebPOSTerminalHelper;
+
+public class I37309_VerifyEnyoTab extends WebPOSTerminalHelper {
+
+  @Test
+  public void test() {
+    long startTime = new Date().getTime();
+    WebPOSAPI.cleanCashup(this);
+    long endTime = new Date().getTime();
+    System.out.println("cleanCashup execution time : " + (endTime - startTime));
+  }
+}
\ No newline at end of file
