calabash-android 0.3.2.pre3 → 0.3.2.pre4

Sign up to get free protection for your applications and to get access to all the features.
@@ -244,12 +244,24 @@ module Operations
244
244
  end
245
245
 
246
246
  @@screenshot_count ||= 0
247
- res = http("/screenshot")
248
-
249
247
  path = "#{prefix}#{name}_#{@@screenshot_count}.png"
250
- File.open(path, 'wb') do |f|
251
- f.write res
248
+
249
+ if ENV["SCREENSHOT_VIA_USB"] == "true"
250
+ screenshot_cmd = "java -jar #{File.join(File.dirname(__FILE__), 'lib', 'screenShotTaker.jar')} #{path}"
251
+ log screenshot_cmd
252
+ raise "Could not take screenshot" unless system(screenshot_cmd)
253
+ else
254
+ begin
255
+ res = http("/screenshot")
256
+ rescue EOFError
257
+ raise "Could not take screenshot. App is most likely not running anymore."
258
+ end
259
+ File.open(path, 'wb') do |f|
260
+ f.write res
261
+ end
252
262
  end
263
+
264
+
253
265
  @@screenshot_count += 1
254
266
  path
255
267
  end
@@ -304,7 +316,11 @@ module Operations
304
316
  end
305
317
 
306
318
  def shutdown_test_server
307
- http("/kill")
319
+ begin
320
+ http("/kill")
321
+ rescue EOFError
322
+ log ("Could not kill app. App is most likely not running anymore.")
323
+ end
308
324
  end
309
325
 
310
326
  ##location
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.3.2.pre3"
3
+ VERSION = "0.3.2.pre4"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@ public class EnterTextByCssSelector implements Action {
14
14
  public Result execute(String... args) {
15
15
  final String cssSelector = args[0];
16
16
  final String value = args[1];
17
-
17
+
18
18
  for (CalabashChromeClient ccc : CalabashChromeClient.findAndPrepareWebViews()) {
19
19
  final WebView webView = ccc.getWebView();
20
20
 
@@ -72,10 +72,10 @@ public class EnterTextByCssSelector implements Action {
72
72
  " fireHTMLEvent(elem, 'blur');\n" +
73
73
  " }\n" +
74
74
  "";
75
-
75
+
76
76
  webView.loadUrl("javascript:(function() {" +
77
77
  functions +
78
- "var elem = document.getElementById('" + cssSelector + "'); selectInputField(elem); enterTextIntoInputField(elem, '" + value + "'); deselectInputField(elem); " +
78
+ "var elem = document.querySelector(\"" + cssSelector + "\"); selectInputField(elem); enterTextIntoInputField(elem, '" + value + "'); deselectInputField(elem); " +
79
79
  "prompt('calabash:true');" +
80
80
  "})()");
81
81
  }
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.pre3
4
+ version: 0.3.2.pre4
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-15 00:00:00.000000000 Z
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber