frank-cucumber 0.8.14 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- data/frank-cucumber.gemspec +1 -0
- data/frank-skeleton/libFrank.a +0 -0
- data/frank-skeleton/libShelley.a +0 -0
- data/lib/frank-cucumber/bonjour.rb +73 -0
- data/lib/frank-cucumber/frank_helper.rb +15 -2
- data/lib/frank-cucumber/gateway.rb +4 -5
- data/lib/frank-cucumber/keyboard_helper.rb +1 -1
- data/lib/frank-cucumber/version.rb +1 -1
- metadata +28 -16
data/frank-cucumber.gemspec
CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
s.add_dependency( "i18n" )
|
24
24
|
s.add_dependency( "plist" )
|
25
25
|
s.add_dependency( "json" ) # TODO: figure out how to be more permissive as to which JSON gems we allow
|
26
|
+
s.add_dependency( "dnssd" )
|
26
27
|
|
27
28
|
s.add_development_dependency( "rr" )
|
28
29
|
end
|
data/frank-skeleton/libFrank.a
CHANGED
Binary file
|
data/frank-skeleton/libShelley.a
CHANGED
Binary file
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'timeout'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Frank module Cucumber
|
5
|
+
class Bonjour
|
6
|
+
|
7
|
+
FRANK_SERVICE_NAME = 'Frank UISpec server'
|
8
|
+
FRANK_PORT = 37265
|
9
|
+
LOOKUP_TIMEOUT = 10
|
10
|
+
|
11
|
+
def debug string
|
12
|
+
puts string if $DEBUG
|
13
|
+
end
|
14
|
+
|
15
|
+
def found_a_frank( reply )
|
16
|
+
debug reply.inspect
|
17
|
+
unless reply.flags.add?
|
18
|
+
debug 'got a non-add reply'
|
19
|
+
debug "flags: #{reply.flags.to_a.inspect}"
|
20
|
+
return nil
|
21
|
+
end
|
22
|
+
|
23
|
+
resolve_service = DNSSD::Service.new
|
24
|
+
addr_service = DNSSD::Service.new
|
25
|
+
resolve_service.resolve reply do |r|
|
26
|
+
debug "#{r.name} on #{r.target}:#{r.port}"
|
27
|
+
|
28
|
+
address = nil
|
29
|
+
addr_service.getaddrinfo r.target do |addrinfo|
|
30
|
+
address = addrinfo.address
|
31
|
+
break
|
32
|
+
end
|
33
|
+
|
34
|
+
debug "first address for #{r.target} is #{address}"
|
35
|
+
return address
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def browse_for_franks_address
|
40
|
+
require 'dnssd'
|
41
|
+
|
42
|
+
DNSSD.browse! '_http._tcp.' do |reply|
|
43
|
+
debug 'got a reply'
|
44
|
+
if reply.name == FRANK_SERVICE_NAME
|
45
|
+
address = found_a_frank(reply)
|
46
|
+
if address
|
47
|
+
debug "OK WE HAVE AN ADDRESS: #{address}"
|
48
|
+
return address
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def lookup_frank_base_uri
|
55
|
+
puts "finding Frank server via Bonjour..."
|
56
|
+
address = begin
|
57
|
+
Timeout::timeout(LOOKUP_TIMEOUT){ address = browse_for_franks_address }
|
58
|
+
rescue Timeout::Error
|
59
|
+
puts "could not find Frank within #{LOOKUP_TIMEOUT} seconds"
|
60
|
+
end
|
61
|
+
|
62
|
+
if address
|
63
|
+
puts "...found Frank via Bonjour: #{address}"
|
64
|
+
return URI::HTTP.new( 'http', nil, address, FRANK_PORT, nil, nil, nil, nil, nil )
|
65
|
+
else
|
66
|
+
puts '...failed to find Frank server via Bonjour'
|
67
|
+
return nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
end end
|
@@ -3,6 +3,7 @@ require 'frank-cucumber/gateway'
|
|
3
3
|
require 'frank-cucumber/host_scripting'
|
4
4
|
require 'frank-cucumber/wait_helper'
|
5
5
|
require 'frank-cucumber/keyboard_helper'
|
6
|
+
require 'frank-cucumber/bonjour'
|
6
7
|
|
7
8
|
module Frank module Cucumber
|
8
9
|
|
@@ -13,16 +14,28 @@ module FrankHelper
|
|
13
14
|
|
14
15
|
class << self
|
15
16
|
# TODO: adding an ivar to the module itself is a big ugyl hack. We need a FrankDriver class, or similar
|
16
|
-
attr_accessor :selector_engine
|
17
|
+
attr_accessor :selector_engine, :server_base_url
|
18
|
+
|
17
19
|
def use_shelley_from_now_on
|
18
20
|
@selector_engine = 'shelley_compat'
|
19
21
|
end
|
22
|
+
|
23
|
+
def test_on_physical_device_via_bonjour
|
24
|
+
@server_base_url = Bonjour.new.lookup_frank_base_uri
|
25
|
+
raise 'could not detect running Frank server' unless @server_base_url
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
29
|
def selector_engine
|
23
30
|
Frank::Cucumber::FrankHelper.selector_engine || 'uiquery' # default to UIQuery for backwards compatibility
|
24
31
|
end
|
32
|
+
|
33
|
+
def base_server_url
|
34
|
+
Frank::Cucumber::FrankHelper.server_base_url
|
35
|
+
end
|
25
36
|
|
37
|
+
|
38
|
+
|
26
39
|
def touch( uiquery )
|
27
40
|
touch_successes = frankly_map( uiquery, 'touch' )
|
28
41
|
raise "could not find anything matching [#{uiquery}] to touch" if touch_successes.empty?
|
@@ -203,7 +216,7 @@ module FrankHelper
|
|
203
216
|
end
|
204
217
|
|
205
218
|
def frank_server
|
206
|
-
@_frank_server ||= Frank::Cucumber::Gateway.new
|
219
|
+
@_frank_server ||= Frank::Cucumber::Gateway.new( base_server_url )
|
207
220
|
end
|
208
221
|
|
209
222
|
end
|
@@ -4,11 +4,10 @@ require 'uri'
|
|
4
4
|
module Frank module Cucumber
|
5
5
|
|
6
6
|
class Gateway
|
7
|
-
|
8
|
-
DEFAULT_PORT = 37265
|
7
|
+
DEFAULT_BASE_URL = "http://localhost:37265/"
|
9
8
|
|
10
|
-
def initialize(
|
11
|
-
@
|
9
|
+
def initialize( base_url = nil )
|
10
|
+
@base_url = URI.parse (base_url || DEFAULT_BASE_URL).to_s
|
12
11
|
end
|
13
12
|
|
14
13
|
def ping
|
@@ -72,7 +71,7 @@ class Gateway
|
|
72
71
|
private
|
73
72
|
|
74
73
|
def frank_url_for( verb )
|
75
|
-
url = @
|
74
|
+
url = @base_url.clone
|
76
75
|
url.path = '/'+verb
|
77
76
|
url
|
78
77
|
end
|
@@ -6,7 +6,7 @@ module KeyboardHelper
|
|
6
6
|
text_to_type = text_to_type+"\n" unless text_to_type.end_with?("\n")
|
7
7
|
res = frank_server.send_post(
|
8
8
|
'type_into_keyboard',
|
9
|
-
:text_to_type => text_to_type
|
9
|
+
:text_to_type => text_to_type
|
10
10
|
)
|
11
11
|
Frank::Cucumber::Gateway.evaluate_frankly_response( res, "typing the following into the keyboard '#{text_to_type}'" )
|
12
12
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frank-cucumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-06-06 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: cucumber
|
17
|
-
requirement: &
|
17
|
+
requirement: &70354211328540 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70354211328540
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
requirement: &
|
28
|
+
requirement: &70354211327880 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70354211327880
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sim_launcher
|
39
|
-
requirement: &
|
39
|
+
requirement: &70354211327300 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70354211327300
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: i18n
|
50
|
-
requirement: &
|
50
|
+
requirement: &70354211326740 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70354211326740
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: plist
|
61
|
-
requirement: &
|
61
|
+
requirement: &70354211326180 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70354211326180
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: json
|
72
|
-
requirement: &
|
72
|
+
requirement: &70354211325680 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,10 +77,21 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :runtime
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70354211325680
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: dnssd
|
83
|
+
requirement: &70354211325200 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
type: :runtime
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *70354211325200
|
81
92
|
- !ruby/object:Gem::Dependency
|
82
93
|
name: rr
|
83
|
-
requirement: &
|
94
|
+
requirement: &70354211324620 !ruby/object:Gem::Requirement
|
84
95
|
none: false
|
85
96
|
requirements:
|
86
97
|
- - ! '>='
|
@@ -88,7 +99,7 @@ dependencies:
|
|
88
99
|
version: '0'
|
89
100
|
type: :development
|
90
101
|
prerelease: false
|
91
|
-
version_requirements: *
|
102
|
+
version_requirements: *70354211324620
|
92
103
|
description: Use cucumber to test native iOS apps via Frank
|
93
104
|
email:
|
94
105
|
- gems@thepete.net
|
@@ -138,6 +149,7 @@ files:
|
|
138
149
|
- frank-skeleton/libShelley.a
|
139
150
|
- lib/frank-cucumber.rb
|
140
151
|
- lib/frank-cucumber/app_bundle_locator.rb
|
152
|
+
- lib/frank-cucumber/bonjour.rb
|
141
153
|
- lib/frank-cucumber/color_helper.rb
|
142
154
|
- lib/frank-cucumber/core_frank_steps.rb
|
143
155
|
- lib/frank-cucumber/frank_helper.rb
|