frank-cucumber 0.5.5 → 0.6.0

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.
@@ -1,4 +1,37 @@
1
1
  Given /^I launch the app$/ do
2
- launch_app_in_simulator
3
- wait_for_frank_to_come_up
2
+
3
+ # kill the app if it's already running, just in case this helps
4
+ # reduce simulator flakiness when relaunching the app. Use a timeout of 5 seconds to
5
+ # prevent us hanging around for ages waiting for the ping to fail if the app isn't running
6
+ begin
7
+ Timeout::timeout(5) { press_home_on_simulator if frankly_ping }
8
+ rescue Timeout::Error
9
+ end
10
+
11
+ require 'sim_launcher/client'
12
+
13
+ app_path = ENV['APP_BUNDLE_PATH']
14
+ raise "APP_BUNDLE_PATH env variable was not set. \nPlease set the APP_BUNDLE_PATH environment variable to the path of your compiled Frankified iOS app bundle" if app_path.nil?
15
+
16
+ simulator = SimLauncher::Client.for_iphone_app( app_path, "4.2" )
17
+
18
+ num_timeouts = 0
19
+ loop do
20
+ begin
21
+ simulator.relaunch
22
+ wait_for_frank_to_come_up
23
+ break # if we make it this far without an exception then we're good to move on
24
+
25
+ rescue Timeout::Error
26
+ num_timeouts += 1
27
+ puts "Encountered #{num_timeouts} timeouts while launching the app."
28
+ if num_timeouts > 3
29
+ raise "Encountered #{num_timeouts} timeouts in a row while trying to launch the app."
30
+ end
31
+ end
32
+ end
33
+
34
+ # TODO: do some kind of waiting check to see that your initial app UI is ready
35
+ # e.g. Then "I wait to see the login screen"
36
+
4
37
  end
@@ -19,5 +19,6 @@ Gem::Specification.new do |s|
19
19
 
20
20
  s.add_dependency( "cucumber" )
21
21
  s.add_dependency( "rspec", [">=2.0"] )
22
+ s.add_dependency( "sim_launcher" )
22
23
  s.add_dependency( "json" ) # TODO: figure out how to be more permissive as to which JSON gems we allow
23
24
  end
@@ -185,21 +185,6 @@ module FrankHelper
185
185
  APPLESCRIPT}
186
186
  end
187
187
 
188
- def launch_app_in_simulator
189
- %x{osascript<<APPLESCRIPT
190
- application "iPhone Simulator" quit
191
- tell application "Xcode"
192
- set myprojectdocument to active project document
193
- set myproject to project of myprojectdocument
194
- tell myproject
195
- launch
196
- end tell
197
- end tell
198
- application "iPhone Simulator" activate
199
- APPLESCRIPT}
200
- sleep 5 # TODO: replace this with polling for the frank server
201
- end
202
-
203
188
  def quit_simulator
204
189
  %x{osascript<<APPLESCRIPT-
205
190
  application "iPhone Simulator" quit
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "0.5.5"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 5
8
- - 5
9
- version: 0.5.5
7
+ - 6
8
+ - 0
9
+ version: 0.6.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Hodgson
@@ -44,7 +44,7 @@ dependencies:
44
44
  type: :runtime
45
45
  version_requirements: *id002
46
46
  - !ruby/object:Gem::Dependency
47
- name: json
47
+ name: sim_launcher
48
48
  prerelease: false
49
49
  requirement: &id003 !ruby/object:Gem::Requirement
50
50
  requirements:
@@ -55,6 +55,18 @@ dependencies:
55
55
  version: "0"
56
56
  type: :runtime
57
57
  version_requirements: *id003
58
+ - !ruby/object:Gem::Dependency
59
+ name: json
60
+ prerelease: false
61
+ requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ type: :runtime
69
+ version_requirements: *id004
58
70
  description: Use cucumber to test native iOS apps via Frank
59
71
  email:
60
72
  - gems@thepete.net
@@ -69,9 +81,6 @@ files:
69
81
  - Gemfile
70
82
  - Rakefile
71
83
  - bin/frank-skeleton
72
- - example/features/example.feature
73
- - example/features/step_definitions/example_steps.rb
74
- - example/features/support/env.rb
75
84
  - features-skeleton/my_first.feature
76
85
  - features-skeleton/step_definitions/launch_steps.rb
77
86
  - features-skeleton/support/env.rb
@@ -1,5 +0,0 @@
1
- Feature: test frank-cuke integration
2
-
3
- Scenario: a passing test
4
- Given I simulate a memory warning
5
- Then I see colors!
@@ -1,19 +0,0 @@
1
- Given /^I wait (\d+) seconds$/ do |seconds|
2
- seconds = seconds.to_i
3
- sleep seconds
4
- end
5
-
6
- Then /^the test fails$/ do
7
- (2+2).should == 5
8
- end
9
-
10
- Then /^the test passes!$/ do
11
- (2+2).should == 4
12
- end
13
-
14
-
15
- Then /^I see colors!$/ do
16
- announce red "RED"
17
- announce blue "BLUE"
18
- announce green "GREEEN!"
19
- end
@@ -1 +0,0 @@
1
- require 'frank-cucumber'