calabash-android 0.8.0.pre1 → 0.8.0.pre2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f3c04184513136f46a2e22bdee2267e6a0197d2
4
- data.tar.gz: 308434d9e8d514059c51e8c3af29d9da6d0f2ab2
3
+ metadata.gz: cc0a5ca87b41a3b21f898f7d27a156e6a12c2679
4
+ data.tar.gz: 3a3efb9ed3632879c1fc8476d77e11207c3e19bd
5
5
  SHA512:
6
- metadata.gz: c4d55875019e0c5e5906d05648b3e6f96ee2dd22a85f30a7827a244992b841b633561433a0b54aa52a6d4b49a540c976a3e5dce049edff292a135451fe1a0266
7
- data.tar.gz: 98082ec475eec0c11a73c085c4112a7ef92a77c67d3e343c9e62768682ed090ad799c623ad894dac03218189cef6e41e6edd14f8b6f76e45639e1f5559143808
6
+ metadata.gz: df6bda16ea2e67aa9904badbb85d81ac36bf4cbb57222df20fae15c6069c0e7d7753fa8c735fa30417f74b781c94fdfaf5b313245a445d1c2eba989bc97b8d1f
7
+ data.tar.gz: 8c727c35e57d94f9f7be437f7eea008357401724df69015415a265d70769870b5e4bd795e5afb2c91067c44ba5bd0d885c2686e0eeeecfd8a469e19d914a976c
@@ -15,11 +15,6 @@ def calabash_console(app_path = nil)
15
15
 
16
16
  ENV['IRBRC'] = path
17
17
 
18
-
19
- unless ENV['MAIN_ACTIVITY']
20
- ENV['MAIN_ACTIVITY'] = main_activity(app_path)
21
- end
22
-
23
18
  unless ENV['APP_PATH']
24
19
  ENV['APP_PATH'] = app_path
25
20
  end
@@ -17,11 +17,11 @@ def calabash_run(app_path = nil)
17
17
 
18
18
  test_server_path = test_server_path(app_path)
19
19
 
20
- main_activity = ENV['MAIN_ACTIVITY'] || main_activity(app_path)
20
+ env = "APP_PATH=\"#{app_path}\" TEST_APP_PATH=\"#{test_server_path}\""
21
21
 
22
- env = "MAIN_ACTIVITY=#{main_activity} "\
23
- "APP_PATH=\"#{app_path}\" "\
24
- "TEST_APP_PATH=\"#{test_server_path}\""
22
+ if ENV['MAIN_ACTIVITY']
23
+ env = "#{env} MAIN_ACTIVITY=#{ENV['MAIN_ACTIVITY']}"
24
+ end
25
25
  else
26
26
  env = ""
27
27
  end
@@ -18,10 +18,10 @@ require 'calabash-android/env'
18
18
  require 'calabash-android/environment'
19
19
  require 'calabash-android/dot_dir'
20
20
  require 'calabash-android/logging'
21
+ require 'calabash-android/retry'
21
22
  require 'calabash-android/store/preferences'
22
23
  require 'calabash-android/usage_tracker'
23
24
  require 'calabash-android/dependencies'
24
- require 'retriable'
25
25
  require 'cucumber'
26
26
  require 'date'
27
27
  require 'time'
@@ -188,6 +188,24 @@ module Calabash module Android
188
188
  default_device.clear_preferences(name)
189
189
  end
190
190
 
191
+ def set_activity_orientation(orientation)
192
+ unless orientation.is_a?(Symbol)
193
+ raise ArgumentError, "Orientation is not a symbol"
194
+ end
195
+
196
+ unless orientation == :landscape || orientation == :portrait ||
197
+ orientation == :reverse_landscape || orientation == :reverse_portrait
198
+ raise ArgumentError, "Invalid orientation given. Use :landscape, :portrait, :reverse_landscape, or :reverse_portrait"
199
+ end
200
+
201
+ perform_action("set_activity_orientation", orientation.to_s)
202
+ end
203
+
204
+ # Note: Android 2.2 will always return either portrait or landscape, not reverse_portrait or reverse_landscape
205
+ def get_activity_orientation
206
+ perform_action("get_activity_orientation")
207
+ end
208
+
191
209
  def query(uiquery, *args)
192
210
  converted_args = []
193
211
  args.each do |arg|
@@ -618,7 +636,7 @@ module Calabash module Android
618
636
  log wake_up_cmd
619
637
  raise "Could not wake up the device" unless system(wake_up_cmd)
620
638
 
621
- Retriable.retriable :tries => 10, :interval => 1 do
639
+ Calabash::Android::Retry.retry :tries => 10, :interval => 1 do
622
640
  raise "Could not remove the keyguard" if keyguard_enabled?
623
641
  end
624
642
  end
@@ -648,7 +666,7 @@ module Calabash module Android
648
666
  env_options = options.clone
649
667
  env_options.delete(:intent)
650
668
 
651
- env_options[:main_activity] ||= main_activity(@app_path)
669
+ env_options[:main_activity] ||= ENV['MAIN_ACTIVITY'] || 'null'
652
670
  env_options[:test_server_port] ||= @test_server_port
653
671
  env_options[:class] ||= "sh.calaba.instrumentationbackend.InstrumentationBackend"
654
672
 
@@ -668,12 +686,12 @@ module Calabash module Android
668
686
  log cmd
669
687
  raise "Could not execute command to start test server" unless system("#{cmd} 2>&1")
670
688
 
671
- Retriable.retriable :tries => 100, :interval => 0.1 do
689
+ Calabash::Android::Retry.retry :tries => 100, :interval => 0.1 do
672
690
  raise "App did not start" unless app_running?
673
691
  end
674
692
 
675
693
  begin
676
- Retriable.retriable :tries => 300, :interval => 0.1 do
694
+ Calabash::Android::Retry.retry :tries => 300, :interval => 0.1 do
677
695
  log "Checking if instrumentation backend is ready"
678
696
 
679
697
  log "Is app running? #{app_running?}"
@@ -0,0 +1,24 @@
1
+ module Calabash
2
+ module Android
3
+ module Retry
4
+ def self.retry(opts, &blk)
5
+ tries = opts[:tries]
6
+ interval = opts[:interval]
7
+
8
+ tries.times do |try|
9
+ begin
10
+ blk.call
11
+ return
12
+
13
+ rescue => e
14
+ if (try + 1) >= tries
15
+ raise
16
+ else
17
+ sleep interval
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -7,7 +7,8 @@ Then /^I press the menu key$/ do
7
7
  end
8
8
 
9
9
  Then /^I press the enter button$/ do
10
- perform_action('send_key_enter')
10
+ press_user_action_button
11
+ # Or, possibly, press_enter_button
11
12
  end
12
13
 
13
14
 
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.8.0.pre1"
3
+ VERSION = "0.8.0.pre2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.pre1
4
+ version: 0.8.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -38,26 +38,6 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.8'
41
- - !ruby/object:Gem::Dependency
42
- name: retriable
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: 1.3.3.1
48
- - - "<"
49
- - !ruby/object:Gem::Version
50
- version: '1.5'
51
- type: :runtime
52
- prerelease: false
53
- version_requirements: !ruby/object:Gem::Requirement
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: 1.3.3.1
58
- - - "<"
59
- - !ruby/object:Gem::Version
60
- version: '1.5'
61
41
  - !ruby/object:Gem::Dependency
62
42
  name: slowhandcuke
63
43
  requirement: !ruby/object:Gem::Requirement
@@ -367,6 +347,7 @@ files:
367
347
  - lib/calabash-android/monkey_helpers.rb
368
348
  - lib/calabash-android/operations.rb
369
349
  - lib/calabash-android/removed_actions.txt
350
+ - lib/calabash-android/retry.rb
370
351
  - lib/calabash-android/steps/assert_steps.rb
371
352
  - lib/calabash-android/steps/check_box_steps.rb
372
353
  - lib/calabash-android/steps/context_menu_steps.rb