lib/appium_lib/common/helper.rb in appium_lib-0.14.0 vs lib/appium_lib/common/helper.rb in appium_lib-0.15.0

- old
+ new

@@ -28,20 +28,12 @@ # @param max_wait [Integer] the maximum time in seconds to wait for. # Note that max wait 0 means infinity. # @param interval [Float] the time in seconds to wait after calling the block # @param block [Block] the block to call # @return [Object] the result of block.call - def wait max_wait=-1, interval=0.5, &block - if max_wait == -1 - max_wait = begin - $driver.default_wait - rescue - end - max_wait ||= 30 - end - - # Rescue Timeout::Error: execution expired + def wait max_wait=30, interval=0.5, &block + max_wait = 1 if max_wait <= 0 result = nil timeout max_wait do until (result = begin; block.call || true; rescue; end) sleep interval end @@ -58,19 +50,11 @@ # Give up after 30 seconds. # @param max_wait [Integer] the maximum time in seconds to wait for # @param interval [Float] the time in seconds to wait after calling the block # @param block [Block] the block to call # @return [Object] the result of block.call - def wait_true max_wait=-1, interval=0.5, &block - if max_wait == -1 - max_wait = begin - $driver.default_wait - rescue - end - max_wait ||= 30 - end - - # Rescue Timeout::Error: execution expired + def wait_true max_wait=30, interval=0.5, &block + max_wait = 1 if max_wait <= 0 result = nil timeout max_wait do until (result = begin; block.call; rescue; end) sleep interval end \ No newline at end of file