Module: Calabash::Cucumber::StatusBarHelpers

Included in:
Core
Defined in:
lib/calabash-cucumber/status_bar_helpers.rb

Overview

> Map

Instance Method Summary collapse

Instance Method Details

#device_orientation(force_down = false) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 5

def device_orientation(force_down=false)
  res = map(nil, :orientation, :device).first

  if ['face up', 'face down'].include?(res)
    if ENV['CALABASH_FULL_CONSOLE_OUTPUT'] == '1'
      if force_down
        puts "WARN  found orientation '#{res}' - will rotate to force orientation to 'down'"
      end
    end

    return res unless force_down
    return rotate_home_button_to :down
  end

  return res unless res.eql?('unknown')
  return res unless force_down
  rotate_home_button_to(:down)
end

#landscape?Boolean

returns true if orientation is landscape

Returns:

  • (Boolean)


35
36
37
38
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 35

def landscape?
  o = status_bar_orientation
  o.eql?('right') or o.eql?('left')
end

#portrait?Boolean

returns true if orientation is portrait

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 29

def portrait?
  o = status_bar_orientation
  o.eql?('up') or o.eql?('down')
end

#status_bar_orientationObject



24
25
26
# File 'lib/calabash-cucumber/status_bar_helpers.rb', line 24

def status_bar_orientation
  map(nil, :orientation, :status_bar).first
end