Class: Calabash::Cucumber::PlaybackActions

Inherits:
Object
  • Object
show all
Includes:
ConnectionHelpers, PlaybackHelpers, QueryHelpers
Defined in:
lib/calabash-cucumber/actions/playback_actions.rb

Constant Summary

Constants included from PlaybackHelpers

Calabash::Cucumber::PlaybackHelpers::DATA_PATH

Instance Method Summary collapse

Methods included from QueryHelpers

#escape_quotes, #point_from

Methods included from ConnectionHelpers

#connection, #http

Methods included from PlaybackHelpers

#find_compatible_recording, #interpolate, #load_playback_data, #load_recording, #playback, #playback_file_directories, #record_begin, #record_end, #recording_name_for

Instance Method Details

#double_tap(options) ⇒ Object



16
17
18
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 16

def double_tap(options)
  playback('double_tap', options)
end

#flick(*args) ⇒ Object



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

def flick(*args)
  raise error_message('flick')
end

#pan(from, to, options = {}) ⇒ Object



80
81
82
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 80

def pan(from,to,options={})
  interpolate 'pan', options.merge(:start => from, :end => to)
end

#pinch(in_out, options) ⇒ Object



84
85
86
87
88
89
90
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 84

def pinch(in_out,options)
  file = "pinch_in"
  if in_out==:out
    file = "pinch_out"
  end
  playback(file, options)
end

#send_app_to_background(secs) ⇒ Object



92
93
94
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 92

def send_app_to_background(secs)
  raise 'Not implemented when running without instruments / UIA'
end

#swipe(dir, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 32

def swipe(dir, options={})
  current_orientation = options[:status_bar_orientation].to_sym
  if current_orientation == :left
    case dir
      when :left then
        dir = :down
      when :right then
        dir = :up
      when :up then
        dir = :left
      when :down then
        dir = :right
      else
    end
  end

  if current_orientation == :right
    case dir
      when :left then
        dir = :up
      when :right then
        dir = :down
      when :up then
        dir = :right
      when :down then
        dir = :left
      else
    end
  end

  if current_orientation == :up
    case dir
      when :left then
        dir = :right
      when :right then
        dir = :left
      when :up then
        dir = :down
      when :down then
        dir = :up
      else
    end
  end

  playback("swipe_#{dir}", options)

end

#touch(options) ⇒ Object



12
13
14
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 12

def touch(options)
  playback('touch', options)
end

#touch_hold(options) ⇒ Object



28
29
30
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 28

def touch_hold(options)
  playback('touch_hold', options)
end

#two_finger_tap(*args) ⇒ Object



20
21
22
# File 'lib/calabash-cucumber/actions/playback_actions.rb', line 20

def two_finger_tap(*args)
  raise error_message('two_finger_tap')
end