Sha256: 7f33bb5ff2d3e4c90440c008fee9512b60368d2478a286cffb87b46a3875dc55

Contents?: true

Size: 1.77 KB

Versions: 20

Compression:

Stored size: 1.77 KB

Contents

# common methods
def back_click(opts = {})
  opts ||= {}
  search_wait = opts.fetch(:wait, 60 * 1.7)
  # iOS may have multiple 'back' buttons
  # select the first displayed? back button.
  wait(search_wait) do
    button_exact('Back').click
  end
end

def leave_textfields
  back_click
  screen.must_equal catalog
end

def go_to_textfields
  screen.must_equal catalog
  wait_true do
    UI::Inventory.xcuitest? ? find_element(:name, 'TextFields').click : text('textfield').click
    screen == 'TextFields' # wait for screen transition
  end
end

def screen
  $driver.find_element(:class, UI::Inventory.navbar).name
end

def catalog
  'UICatalog'
end

module UI
  module Inventory
    def self.xcuitest?
      $driver.automation_name_is_xcuitest?
    end

    def self.navbar
      xcuitest? ? 'XCUIElementTypeNavigationBar' : 'UIANavigationBar'
    end

    def self.button
      xcuitest? ? 'XCUIElementTypeButton' : 'UIAButton'
    end

    def self.static_text
      xcuitest? ? 'XCUIElementTypeStaticText' : 'UIAStaticText'
    end

    def self.text_field
      xcuitest? ? 'XCUIElementTypeTextField' : 'UIATextField'
    end

    def self.secure_text_field
      xcuitest? ? 'XCUIElementTypeSecureTextField' : 'UIASecureTextField'
    end

    def self.picker
      xcuitest? ? 'XCUIElementTypePicker' : 'UIAPicker'
    end

    def self.action_sheet
      xcuitest? ? 'XCUIElementTypeActionSheet' : 'UIActionSheet'
    end

    def self.table
      xcuitest? ? 'XCUIElementTypeTable' : 'UIATable'
    end

    def self.table_cell
      xcuitest? ? 'XCUIElementTypeCell' : 'UIATableCell'
    end

    def self.other
      xcuitest? ? 'XCUIElementTypeOther' : raise('unknown UIA element: other')
    end

    def self.status_bar
      xcuitest? ? 'XCUIElementTypeStatusBar' : 'UIAStatusBar'
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
appium_lib-9.4.5 ios_tests/lib/common.rb
appium_lib-9.4.4 ios_tests/lib/common.rb
appium_lib-9.4.3 ios_tests/lib/common.rb
appium_lib-9.4.2 ios_tests/lib/common.rb
appium_lib-9.4.1 ios_tests/lib/common.rb
appium_lib-9.4.0 ios_tests/lib/common.rb
appium_lib-9.3.8 ios_tests/lib/common.rb
appium_lib-9.3.7 ios_tests/lib/common.rb
appium_lib-9.3.6 ios_tests/lib/common.rb
appium_lib-9.3.5 ios_tests/lib/common.rb
appium_lib-9.3.4 ios_tests/lib/common.rb
appium_lib-9.3.3 ios_tests/lib/common.rb
appium_lib-9.3.2 ios_tests/lib/common.rb
appium_lib-9.3.1 ios_tests/lib/common.rb
appium_lib-9.3.0 ios_tests/lib/common.rb
appium_lib-9.2.0 ios_tests/lib/common.rb
appium_lib-9.1.3 ios_tests/lib/common.rb
appium_lib-9.1.2 ios_tests/lib/common.rb
appium_lib-9.1.1 ios_tests/lib/common.rb
appium_lib-9.1.0 ios_tests/lib/common.rb