Sha256: 8227ad46616a2f278503e5de29aa8225e3debec679291566d1cf321ee7c67363

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

# rake ios[ios/element/alert]
describe 'ios/element/alert' do
  def nav_once
    screen.must_equal catalog
    wait_true { text('alerts').click; tag('UIANavigationBar').name == 'Alerts' } # wait for true
    tag('UIANavigationBar').name.must_equal 'Alerts'

    # redefine method as no-op after it's invoked once
    self.class.send :define_method, :nav_once, proc {}
  end

  def after_last
    alert_accept if exists { text('UIActionSheet <title>') }
    back_click
    screen.must_equal catalog
    sleep 1
  end

  before do
    nav_once
    open_alert
  end

  def open_alert
    wait_true do
      return true if exists { text('UIActionSheet <title>') }
      text('Show OK-Cancel').click
      text('UIActionSheet <title>').displayed?
    end
  end

  # iOS 7 is not using the alert methods. alert is nil.
  def ios7_alert_detected
    execute_script 'UIATarget.localTarget().frontMostApp().alert().isNil()'
  end

  t 'alert_accept' do
    alert_accept
  end

  t 'alert_dismiss' do
    alert_dismiss
  end

  t 'after_last' do
    after_last
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
appium_lib-3.0.3 ios_tests/lib/ios/specs/ios/element/alert.rb
appium_lib-3.0.2 ios_tests/lib/ios/specs/ios/element/alert.rb
appium_lib-3.0.1 ios_tests/lib/ios/specs/ios/element/alert.rb
appium_lib-3.0.0 ios_tests/lib/ios/specs/ios/element/alert.rb
appium_lib-2.1.0 ios_tests/lib/ios/specs/ios/element/alert.rb
appium_lib-2.0.0 ios_tests/lib/ios/specs/ios/element/alert.rb