Class: IElement

Inherits:
ElementBase show all
Includes:
Calabash::Cucumber::Core, Calabash::Cucumber::KeyboardHelpers, Calabash::Cucumber::WaitHelpers
Defined in:
lib/CalabashPageObjects/ielement.rb

Overview

The ios specific implementation of ElementBase.

Instance Attribute Summary

Attributes inherited from ElementBase

#locator

Instance Method Summary collapse

Methods inherited from ElementBase

#check, #checked?, #look_for, #present?, #prod, #screen_query, #text, #uncheck, #when_visible

Constructor Details

#initialize(*args) ⇒ IElement

Returns a new instance of IElement.



7
8
9
10
# File 'lib/CalabashPageObjects/ielement.rb', line 7

def initialize(*args)
  @wait_error = Calabash::Cucumber::WaitHelpers::WaitError
  super(*args)
end

Instance Method Details

#input(value, options = {}) ⇒ Object

The ios libs have a different name for the method to clear the test from a field.



22
23
24
25
26
27
28
29
# File 'lib/CalabashPageObjects/ielement.rb', line 22

def input(value, options = {})
  opts = options_parser(options, timeout: 1, parent: nil, webview: false)
  find(opts[:timeout], opts[:parent], opts[:webview])
  puts "Clearing text from element with locator #{@locator}..." if CPO_LOGGING
  clear_text(@locator)
  puts "Entering text in element with locator #{@locator}..." if CPO_LOGGING
  enter_text(@locator, value)
end

#when_not_visible(options = {}) ⇒ Object

Need to override the method in the Element class as this one has a different name in the iOS libs. Waits for an element to not be present. Can take an argument for timeout. Default is 10 seconds.



15
16
17
18
19
# File 'lib/CalabashPageObjects/ielement.rb', line 15

def when_not_visible(options = {})
  opts = options_parser(options, timeout: 10)
  puts "Waiting for element with locator #{@locator} to not be present..." if CPO_LOGGING
  wait_for_element_does_not_exists(@locator, timeout: opts[:timeout], screenshot_on_error: false)
end