calabash-android 0.4.9.pre3 → 0.4.9.pre4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7382b7dab96dabda3ddc20acc43dcf35dd064673
4
- data.tar.gz: db95474aa5d4d4a16e5226da72c1e961d880666e
3
+ metadata.gz: 702c76c045cbcad44d7eb7ea4d54ef0f53d655fb
4
+ data.tar.gz: 99eefccf4f0b8cbb1ffc44235765c9864ee4d5ff
5
5
  SHA512:
6
- metadata.gz: 066c58155a9d3e3c0a63384340c0e2998fa19fdb75521ccbb0020bfd12acd2e316fb519a0da7400ee024bb150ae1bea0d63f3ab0e4a8d58b7f69e55e9f64d9d0
7
- data.tar.gz: fe8ccf72731d38737eadccc1ee3ab10535f3e3c44098e409f49081d092b6d45abff9bf2112a8b5dcb9d5815584f6ffe5df4bab27db03deb1b97df7b5082f48b7
6
+ metadata.gz: 44cf3bdff8af50d4e7d7cf571188710d9738ceb0a3eb9d43955bf620b7b9f890a94fa246bfd7e52fdff310222a10ebafd77113e0ee7ebe171a3c0cb78814aa26
7
+ data.tar.gz: faf828a1d13f7cdf9588c1ede14e5405c2f32e327e269c9140bb08734d476629be569de2dad5c2223b87a6404d7260874e53efeb7152a07776b9bb5ea7217552
@@ -89,7 +89,7 @@ def sign_apk(app_path, dest_path)
89
89
  jarsigner_path = "jarsigner"
90
90
  end
91
91
 
92
- cmd = "#{jarsigner_path} -sigalg MD5withRSA -digestalg SHA1 -signedjar #{dest_path} -storepass #{keystore["keystore_password"]} -keystore #{keystore["keystore_location"]} #{app_path} #{keystore["keystore_alias"]}"
92
+ cmd = "#{jarsigner_path} -sigalg MD5withRSA -digestalg SHA1 -signedjar #{dest_path} -storepass #{keystore["keystore_password"]} -keystore #{keystore["keystore_location"]} \"#{app_path}\" #{keystore["keystore_alias"]}"
93
93
  log cmd
94
94
  unless system(cmd)
95
95
  puts "jarsigner command: #{cmd}"
@@ -172,7 +172,7 @@ def fingerprint_from_apk(app_path)
172
172
  raise "No RSA file found in META-INF. Cannot proceed." if rsa_files.empty?
173
173
  raise "More than one RSA file found in META-INF. Cannot proceed." if rsa_files.length > 1
174
174
 
175
- cmd = "#{keytool_path} -v -printcert -file #{rsa_files.first}"
175
+ cmd = "#{keytool_path} -v -printcert -file \"#{rsa_files.first}\""
176
176
  log cmd
177
177
  fingerprints = `#{cmd}`
178
178
  md5_fingerprint = extract_md5_fingerprint(fingerprints)
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.9.pre3"
3
+ VERSION = "0.4.9.pre4"
4
4
  end
5
5
  end
@@ -0,0 +1,63 @@
1
+ package sh.calaba.instrumentationbackend.query.ast;
2
+
3
+ import java.util.ArrayList;
4
+ import java.util.List;
5
+ import java.util.concurrent.ExecutionException;
6
+ import java.util.concurrent.Future;
7
+ import java.util.concurrent.TimeUnit;
8
+ import java.util.concurrent.TimeoutException;
9
+
10
+ import sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient.WebFuture;
11
+
12
+ @SuppressWarnings("rawtypes")
13
+ public class DoubleFuture implements Future {
14
+
15
+ private final WebFuture f1;
16
+ private final WebFuture f2;
17
+
18
+ public DoubleFuture(WebFuture f1, WebFuture f2) {
19
+ this.f1 = f1;
20
+ this.f2 = f2;
21
+ }
22
+
23
+ @Override
24
+ public boolean cancel(boolean mayInterruptIfRunning) {
25
+ return f1.cancel(mayInterruptIfRunning) && f2.cancel(mayInterruptIfRunning);
26
+ }
27
+
28
+ @SuppressWarnings({ "unchecked" })
29
+ @Override
30
+ public Object get() throws InterruptedException, ExecutionException {
31
+ Object o1 = f1.get();
32
+ Object o2 = f2.get();
33
+
34
+ List res = new ArrayList();
35
+ res.add(o1);
36
+ res.add(o2);
37
+ return res;
38
+ }
39
+
40
+ @SuppressWarnings({ "unchecked" })
41
+ @Override
42
+ public Object get(long timeout, TimeUnit unit) throws InterruptedException,
43
+ ExecutionException, TimeoutException {
44
+ Object o1 = f1.get(timeout, unit); ///this is actually double timeout
45
+ Object o2 = f2.get(timeout, unit);
46
+
47
+ List res = new ArrayList();
48
+ res.add(o1);
49
+ res.add(o2);
50
+ return res;
51
+ }
52
+
53
+ @Override
54
+ public boolean isCancelled() {
55
+ return f1.isCancelled() || f2.isCancelled();
56
+ }
57
+
58
+ @Override
59
+ public boolean isDone() {
60
+ return f1.isDone() && f2.isDone();
61
+ }
62
+
63
+ }
@@ -7,8 +7,10 @@ import java.lang.reflect.Method;
7
7
  import java.util.ArrayList;
8
8
  import java.util.Collections;
9
9
  import java.util.HashMap;
10
+ import java.util.HashSet;
10
11
  import java.util.List;
11
12
  import java.util.Map;
13
+ import java.util.Set;
12
14
  import java.util.concurrent.Callable;
13
15
  import java.util.concurrent.Future;
14
16
  import java.util.concurrent.TimeUnit;
@@ -35,6 +37,14 @@ import android.widget.TextView;
35
37
 
36
38
  public class UIQueryUtils {
37
39
 
40
+ private static final Set<String> DOM_TEXT_TYPES;
41
+ static {
42
+ DOM_TEXT_TYPES = new HashSet<String>();
43
+ DOM_TEXT_TYPES.add("email");
44
+ DOM_TEXT_TYPES.add("text");
45
+ DOM_TEXT_TYPES.add("");
46
+ }
47
+
38
48
  @SuppressWarnings({ "unchecked", "rawtypes" })
39
49
  public static List subviews(Object o) {
40
50
 
@@ -415,33 +425,33 @@ public class UIQueryUtils {
415
425
  Map rect = (Map) map.get("rect");
416
426
  Map hitPoint = extractHitPointFromRect(rect);
417
427
 
418
- map.put("hit-point", hitPoint);
419
- Map result = new HashMap();
420
- result.put("type", "touch");
421
- result.put("gesture", "tap");
422
- map.put("action", result);
428
+ map.put("hit-point", hitPoint);
423
429
  map.put("enabled", true);
424
430
  map.put("visible", true);
425
- String nodeName = (String) map.get("nodeName");
426
- if (nodeName != null && nodeName.toLowerCase().equals("input")) {
427
- String domType = extractDomType((String)map.get("html"));
428
- map.put("domType", domType);
429
- Log.i("Calabash - domtype", domType);
430
- if (domType!=null && domType.equals("password")) {
431
- map.put("entry_types", Collections.singletonList("password"));
432
- }
433
- else {
434
- map.put("entry_types", Collections.singletonList("text"));
435
- }
436
-
437
- }
438
-
439
-
440
-
441
431
  map.put("value", null);
442
432
  map.put("type", "dom");
443
433
  map.put("name", null);
444
434
  map.put("label", null);
435
+ map.put("children", Collections.EMPTY_LIST);
436
+ String html = (String)map.get("html");
437
+ String nodeName = (String) map.get("nodeName");
438
+ if (nodeName != null && nodeName.toLowerCase().equals("input")) {
439
+ String domType = extractDomType(html);
440
+ if (isDomPasswordType(domType)) {
441
+ map.put("entry_types", Collections.singletonList("password"));
442
+ }
443
+ else if (isDomTextType(domType)) {
444
+ map.put("entry_types", Collections.singletonList("text"));
445
+ }
446
+ else {
447
+ map.put("entry_types", Collections.emptyList());
448
+ }
449
+ map.put("value", extractAttribute(html, "value"));
450
+ map.put("type", "dom");
451
+ map.put("name", extractAttribute(html, "name"));
452
+ map.put("label", extractAttribute(html, "title"));
453
+ }
454
+
445
455
  return map;
446
456
 
447
457
  }
@@ -474,8 +484,27 @@ public class UIQueryUtils {
474
484
 
475
485
  }
476
486
 
477
- public static String extractDomType(String string) {
478
- String[] split = string.split("type=");
487
+ private static boolean isDomTextType(String domType) {
488
+ if (domType == null) {
489
+ return true;
490
+ }
491
+ return DOM_TEXT_TYPES.contains(domType);
492
+ }
493
+
494
+ private static boolean isDomPasswordType(String domType) {
495
+ return "password".equalsIgnoreCase(domType);
496
+ }
497
+
498
+ // naive implementation only works for (valid) input tags
499
+ public static String extractDomType(String input) {
500
+ return extractAttribute(input, "type");
501
+ }
502
+
503
+ public static String extractAttribute(String input, String attribute) {
504
+ String[] split = input.split(attribute+"=");
505
+ if (split.length == 1) {
506
+ split = input.split(attribute+" =");
507
+ }
479
508
  if (split.length > 1) {
480
509
  String lastPart = split[1];
481
510
  if (lastPart == null) {
@@ -500,6 +529,8 @@ public class UIQueryUtils {
500
529
 
501
530
  }
502
531
 
532
+
533
+
503
534
  public static List<String> elementEntryTypes(View view) {
504
535
  if (view instanceof TextView) {
505
536
  TextView textView = (TextView) view;
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.4.9.pre3
4
+ version: 0.4.9.pre4
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: 2013-08-16 00:00:00.000000000 Z
11
+ date: 2013-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -422,6 +422,7 @@ files:
422
422
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/BeginsWithRelation.java
423
423
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ComparisonOperator.java
424
424
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ContainsRelation.java
425
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/DoubleFuture.java
425
426
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/EndsWithRelation.java
426
427
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/InvalidUIQueryException.java
427
428
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/LikeRelation.java