calabash-android 0.3.2.pre1 → 0.3.2.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,10 @@
1
1
  require 'calabash-android/management/adb'
2
+ require 'calabash-android/operations'
3
+ include Calabash::Android::Operations
4
+
5
+ AfterConfiguration do |config|
6
+ wake_up
7
+ end
2
8
 
3
9
  Before do |scenario|
4
10
  start_test_server_in_background
@@ -33,10 +33,6 @@ module Operations
33
33
  Device.default_device(self)
34
34
  end
35
35
 
36
- def shutdown_test_server
37
- default_device.shutdown_test_server
38
- end
39
-
40
36
  def performAction(action, *arguments)
41
37
  default_device.perform_action(action, *arguments)
42
38
  end
@@ -50,10 +46,18 @@ module Operations
50
46
  default_device.uninstall_app(ENV["PACKAGE_NAME"])
51
47
  end
52
48
 
49
+ def wake_up
50
+ default_device.wake_up()
51
+ end
52
+
53
53
  def start_test_server_in_background
54
54
  default_device.start_test_server_in_background()
55
55
  end
56
56
 
57
+ def shutdown_test_server
58
+ default_device.shutdown_test_server
59
+ end
60
+
57
61
  def screenshot_embed(options={:prefix => nil, :name => nil, :label => nil})
58
62
  default_device.screenshot_embed(options)
59
63
  end
@@ -270,6 +274,13 @@ module Operations
270
274
  end
271
275
  end
272
276
 
277
+ def wake_up
278
+ wake_up_cmd = "#{adb_command} shell am start -a android.intent.action.MAIN -n sh.calaba.android.test/sh.calaba.instrumentationbackend.WakeUp"
279
+ log "Waking up device using:"
280
+ log wake_up_cmd
281
+ raise "Could not wake up the device" unless system(wake_up_cmd)
282
+ end
283
+
273
284
  def start_test_server_in_background
274
285
  cmd = "#{adb_command} shell am instrument -e target_package #{ENV["PACKAGE_NAME"]} -e main_activity #{ENV["MAIN_ACTIVITY"]} -e class sh.calaba.instrumentationbackend.InstrumentationBackend sh.calaba.android.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
275
286
  log "Starting test server using:"
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.3.2.pre1"
3
+ VERSION = "0.3.2.pre2"
4
4
  end
5
5
  end
@@ -6,6 +6,15 @@
6
6
  <application android:label="instrumentation_backend">
7
7
  <uses-library android:name="android.test.runner" />
8
8
  <uses-library android:name="com.google.android.maps" android:required="false" />
9
+ <activity
10
+ android:name="sh.calaba.instrumentationbackend.WakeUp"
11
+ android:label="WakeUp"
12
+ android:exported="true"
13
+ android:launchMode="singleInstance"
14
+ android:finishOnTaskLaunch="true"
15
+ android:stateNotNeeded="true"
16
+ android:noHistory="false"
17
+ android:excludeFromRecents="true"/>
9
18
  </application>
10
19
  <uses-sdk android:minSdkVersion="4" />
11
20
  <instrumentation android:targetPackage="#targetPackage#" android:name="sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner" />
@@ -0,0 +1,30 @@
1
+ package sh.calaba.instrumentationbackend;
2
+
3
+ import android.app.Activity;
4
+ import android.os.Bundle;
5
+ import android.os.Handler;
6
+ import android.view.Window;
7
+ import android.view.WindowManager;
8
+
9
+ /**
10
+ * @author casidiablo
11
+ * @version 1.0
12
+ */
13
+ public class WakeUp extends Activity {
14
+ @Override
15
+ public void onCreate(Bundle savedInstanceState) {
16
+ super.onCreate(savedInstanceState);
17
+
18
+ Window window = getWindow();
19
+ window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
20
+ | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
21
+ | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
22
+
23
+ Handler handler = new Handler();
24
+ handler.postDelayed(new Runnable() {
25
+ public void run() {
26
+ WakeUp.this.finish();
27
+ }
28
+ }, 200);
29
+ }
30
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2.pre1
4
+ version: 0.3.2.pre2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -174,6 +174,7 @@ files:
174
174
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/InstrumentationBackend.java
175
175
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java
176
176
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/TestHelpers.java
177
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/WakeUp.java
177
178
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/Action.java
178
179
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/Actions.java
179
180
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java