class Steps

Public Instance Methods

check_focus_in_field(field) click to toggle source
# File lib/steps.rb, line 33
def check_focus_in_field(field)
  check_element_exists("view:'UIResponder' isFirstResponder:1 placeholder:'#{field}'")
end
check_ios_version() click to toggle source
# File lib/steps.rb, line 21
def check_ios_version
  server_version['iOS_version'].to_i
end
check_ui_element_label(ui_element, label) click to toggle source
# File lib/steps.rb, line 48
def check_ui_element_label(ui_element, label)
  query ("#{ui_element} marked:'#{label}'")
end
count_number_ui_elements(ui_element) click to toggle source
# File lib/steps.rb, line 60
def count_number_ui_elements(ui_element)
  query("#{ui_element}").count
end
enter_text_to_field(text, field) click to toggle source

workaround for situation when touching input field is required

# File lib/steps.rb, line 65
def enter_text_to_field(text, field)
  puts "I'm going to touch #{field} label"
  field.to_s.start_with?("UI") ? touch("#{field}") : touch("* marked:'#{field}'")
  wait_for_keyboard
  keyboard_enter_text text
end
hide_keyboard() click to toggle source
# File lib/steps.rb, line 44
def hide_keyboard
  query("view isFirstResponder:1", :resignFirstResponder)
end
is_disabled(button) click to toggle source
# File lib/steps.rb, line 25
def is_disabled(button)
  check_element_exists("button marked:'#{button}' isEnabled:0")
end
is_enabled(button) click to toggle source
# File lib/steps.rb, line 29
def is_enabled(button)
  check_element_exists("button marked:'#{button}' isEnabled:1")
end
is_keyboard_presented() click to toggle source
# File lib/steps.rb, line 37
def is_keyboard_presented
  res = element_exists("keyboardAutomatic")
  if res.empty?
    screenshot_and_raise("Keyboard is not presented")
  end
end
scroll_to_element(label) click to toggle source
# File lib/steps.rb, line 3
def scroll_to_element(label)
  wait_poll({:timeout_message => "There's no '#{label}' on screen. Tired of scrolling. Will go drink some coffee'",
             :until_exists => "label text:'#{label}'",
             :timeout => 3}) do
    scroll("tableView", :down)
  end
end
swipe_with_no_delta(direction) click to toggle source
# File lib/steps.rb, line 15
def swipe_with_no_delta(direction)
  #up, down, left, right
  swipe :"#{direction}", swipe_opt = {:'swipe-delta' => {} }
  wait_for_none_animating
end
touch_ui_element_text(ui_element, text) click to toggle source
# File lib/steps.rb, line 52
def touch_ui_element_text(ui_element, text)
  touch ("#{ui_element} marked:'#{text}'")
end
wait_for_ui_element_text(ui_element, text) click to toggle source
# File lib/steps.rb, line 56
def wait_for_ui_element_text(ui_element, text)
  wait_for_element_exists ("#{ui_element} marked:'#{text}'")
end
wait_to_see_text_containing(text) click to toggle source
# File lib/steps.rb, line 11
def wait_to_see_text_containing(text)
  wait_for(:timeout => 20) { element_exists("view {text LIKE '*#{text}*'}") }
end