bwoken 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +28 -14
- data/lib/bwoken.rb +11 -15
- data/lib/bwoken/build.rb +20 -3
- data/lib/bwoken/coffeescript.rb +8 -2
- data/lib/bwoken/device.rb +13 -0
- data/lib/bwoken/script.rb +13 -1
- data/lib/bwoken/simulator.rb +1 -1
- data/lib/bwoken/tasks/bwoken.rake +9 -7
- data/lib/bwoken/version.rb +1 -1
- metadata +18 -17
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Bwoken ![build status](https://secure.travis-ci.org/bendyworks/bwoken.png?branch=master)
|
2
2
|
|
3
|
-
Runs your UIAutomation tests from the command line for both iPhone and iPad.
|
3
|
+
Runs your UIAutomation tests from the command line for both iPhone and iPad, in the simulator or on your device.
|
4
4
|
|
5
5
|
Supports coffeescript and javascript.
|
6
6
|
|
@@ -9,6 +9,12 @@ Supports coffeescript and javascript.
|
|
9
9
|
|
10
10
|
## Usage
|
11
11
|
|
12
|
+
### Simulator or Device?
|
13
|
+
|
14
|
+
To run bwoken tests on your device, just plug it in! And if you want to run tests in the simulator, just unplug it!
|
15
|
+
|
16
|
+
### Running tests
|
17
|
+
|
12
18
|
Make sure bwoken is properly installed via one of the methods below. Then, build your project and run all your tests via:
|
13
19
|
|
14
20
|
$ rake
|
@@ -22,30 +28,31 @@ Or, to run the feature on both iphone and ipad
|
|
22
28
|
$ RUN=focused_test rake
|
23
29
|
|
24
30
|
|
25
|
-
## Installation
|
26
|
-
|
27
|
-
Ensure Xcode is up-to-date.
|
31
|
+
## Basic Installation
|
28
32
|
|
29
|
-
|
33
|
+
N.B.: This is the simplest way to get started and try out bwoken, but the recommended method is with RVM (see below).
|
34
|
+
You can use this method without affecting your ability to later use RVM.
|
30
35
|
|
31
|
-
|
36
|
+
Ensure Xcode is up-to-date.
|
32
37
|
|
33
38
|
Install bundler and init:
|
34
39
|
|
35
|
-
$ gem install bundler
|
40
|
+
$ sudo gem install bundler
|
36
41
|
$ bundle init
|
37
42
|
|
38
43
|
Add this line to your application's Gemfile:
|
39
44
|
|
40
45
|
gem 'bwoken'
|
41
46
|
|
42
|
-
|
47
|
+
Ensure your $PATH variable has bundler_bin at the front. This is usually done with .bash_profile:
|
43
48
|
|
44
|
-
$
|
49
|
+
$ echo 'export PATH=bundler_bin:$PATH' >> ~/.bash_profile
|
45
50
|
|
46
|
-
|
51
|
+
Restart your terminal.
|
47
52
|
|
48
|
-
|
53
|
+
And then execute:
|
54
|
+
|
55
|
+
$ bundle --binstubs=bundler_bin
|
49
56
|
|
50
57
|
Then, add the following line to your `Rakefile`:
|
51
58
|
|
@@ -60,11 +67,18 @@ Ensure your project is in a workspace rather than simply a project:
|
|
60
67
|
* In Xcode, select File -> Save as workspace...
|
61
68
|
* Save the workspace in the same directory as your .xcodeproj file
|
62
69
|
|
70
|
+
We have tried this on a standard lion installation and it works.
|
71
|
+
If you have issues please open an [issue](/bendyworks/bwoken/issues) and let us know.
|
63
72
|
|
64
|
-
|
73
|
+
|
74
|
+
## Installation with rvm (recommended)
|
65
75
|
|
66
76
|
Ensure Xcode is up-to-date.
|
67
77
|
|
78
|
+
Add an .rvmrc file to your project, such as:
|
79
|
+
|
80
|
+
$ echo 'rvm use 1.9.3@MyProject --create' >> .rvmrc
|
81
|
+
|
68
82
|
Install bundler and init:
|
69
83
|
|
70
84
|
$ gem install bundler
|
@@ -78,9 +92,9 @@ And then execute:
|
|
78
92
|
|
79
93
|
$ bundle --binstubs=bundler_bin
|
80
94
|
|
81
|
-
Ensure your
|
95
|
+
Ensure your after_cd_bundler rvm hook is enabled:
|
82
96
|
|
83
|
-
$
|
97
|
+
$ chmod u+x ~/.rvm/hooks/after_cd_bundler
|
84
98
|
|
85
99
|
Then, add the following line to your `Rakefile`:
|
86
100
|
|
data/lib/bwoken.rb
CHANGED
@@ -5,6 +5,7 @@ require 'bwoken/coffeescript'
|
|
5
5
|
require 'bwoken/formatters/colorful_formatter'
|
6
6
|
require 'bwoken/script'
|
7
7
|
require 'bwoken/simulator'
|
8
|
+
require 'bwoken/device'
|
8
9
|
require 'bwoken/version'
|
9
10
|
|
10
11
|
module Bwoken
|
@@ -18,11 +19,7 @@ module Bwoken
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def app_name
|
21
|
-
File.basename(
|
22
|
-
end
|
23
|
-
|
24
|
-
def app_dir
|
25
|
-
File.join(build_path, "#{app_name}.app")
|
22
|
+
File.basename(File.basename(workspace_or_project, '.xcodeproj'), '.xcworkspace')
|
26
23
|
end
|
27
24
|
|
28
25
|
def formatter
|
@@ -41,22 +38,21 @@ module Bwoken
|
|
41
38
|
'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate'
|
42
39
|
end
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
%w(xcworkspace xcodeproj).each do |xcode_root|
|
42
|
+
define_method xcode_root do
|
43
|
+
paths = Dir["#{project_path}/*.#{xcode_root}"]
|
44
|
+
fail "Error: Found more than one #{xcode_root} file in root" if paths.count > 1
|
45
|
+
paths.first
|
47
46
|
end
|
48
47
|
end
|
49
48
|
|
50
|
-
def
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def xcodeproj
|
55
|
-
File.join(project_path, "#{app_name}.xcodeproj")
|
49
|
+
def workspace_or_project
|
50
|
+
ws = xcworkspace
|
51
|
+
File.exists?(ws) ? ws : xcodeproj
|
56
52
|
end
|
57
53
|
|
58
54
|
def workspace_or_project_flag
|
59
|
-
ws =
|
55
|
+
ws = xcworkspace
|
60
56
|
if File.exists?(ws)
|
61
57
|
"-workspace #{ws}"
|
62
58
|
else
|
data/lib/bwoken/build.rb
CHANGED
@@ -1,8 +1,17 @@
|
|
1
1
|
require 'open3'
|
2
|
+
require 'bwoken/device'
|
2
3
|
|
3
4
|
module Bwoken
|
4
5
|
class Build
|
5
6
|
|
7
|
+
def app_dir
|
8
|
+
File.join(configuration_build_dir, "#{Bwoken.app_name}.app")
|
9
|
+
end
|
10
|
+
|
11
|
+
def build_path
|
12
|
+
File.join(Bwoken.project_path, 'build')
|
13
|
+
end
|
14
|
+
|
6
15
|
def scheme
|
7
16
|
Bwoken.app_name
|
8
17
|
end
|
@@ -12,13 +21,21 @@ module Bwoken
|
|
12
21
|
end
|
13
22
|
|
14
23
|
def sdk
|
15
|
-
|
24
|
+
if Bwoken::Device.connected?
|
25
|
+
'iphoneos'
|
26
|
+
else
|
27
|
+
'iphonesimulator5.1'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def configuration_build_dir
|
32
|
+
File.join(build_path, sdk)
|
16
33
|
end
|
17
34
|
|
18
35
|
def env_variables
|
19
36
|
{
|
20
37
|
'GCC_PREPROCESSOR_DEFINITIONS' => 'TEST_MODE=1',
|
21
|
-
'CONFIGURATION_BUILD_DIR' =>
|
38
|
+
'CONFIGURATION_BUILD_DIR' => configuration_build_dir
|
22
39
|
}
|
23
40
|
end
|
24
41
|
|
@@ -29,7 +46,7 @@ module Bwoken
|
|
29
46
|
def cmd
|
30
47
|
"xcodebuild \
|
31
48
|
#{Bwoken.workspace_or_project_flag} \
|
32
|
-
#{"-scheme #{scheme}" if Bwoken.
|
49
|
+
#{"-scheme #{scheme}" if Bwoken.xcworkspace} \
|
33
50
|
-configuration #{configuration} \
|
34
51
|
-sdk #{sdk} \
|
35
52
|
#{variables_for_cli} \
|
data/lib/bwoken/coffeescript.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'coffee_script/source'
|
3
|
-
require 'json'
|
3
|
+
require 'json'
|
4
4
|
require 'execjs'
|
5
5
|
|
6
6
|
module Bwoken
|
@@ -8,7 +8,13 @@ module Bwoken
|
|
8
8
|
class << self
|
9
9
|
|
10
10
|
def coffee_script_source
|
11
|
-
|
11
|
+
return @coffeescript if @coffeescript
|
12
|
+
|
13
|
+
@coffeescript = ''
|
14
|
+
open(CoffeeScript::Source.bundled_path) do |f|
|
15
|
+
@coffeescript << f.read
|
16
|
+
end
|
17
|
+
@coffeescript
|
12
18
|
end
|
13
19
|
|
14
20
|
def context
|
data/lib/bwoken/script.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'open3'
|
3
3
|
|
4
|
+
require 'bwoken/build'
|
5
|
+
|
4
6
|
module Bwoken
|
5
7
|
|
6
8
|
class ScriptFailedError < RuntimeError; end
|
@@ -54,13 +56,23 @@ module Bwoken
|
|
54
56
|
end
|
55
57
|
|
56
58
|
def cmd
|
59
|
+
build = Bwoken::Build.new
|
57
60
|
"#{File.expand_path('../../../bin', __FILE__)}/unix_instruments.sh \
|
61
|
+
#{device_flag} \
|
58
62
|
-D #{self.class.trace_file_path} \
|
59
63
|
-t #{Bwoken.path_to_automation_template} \
|
60
|
-
#{
|
64
|
+
#{build.app_dir} \
|
61
65
|
#{env_variables_for_cli}"
|
62
66
|
end
|
63
67
|
|
68
|
+
def device_flag
|
69
|
+
if Bwoken::Device.connected?
|
70
|
+
"-w #{Bwoken::Device.uuid}"
|
71
|
+
else
|
72
|
+
''
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
64
76
|
def make_results_path_dir
|
65
77
|
FileUtils.mkdir_p Bwoken.results_path
|
66
78
|
end
|
data/lib/bwoken/simulator.rb
CHANGED
@@ -2,7 +2,7 @@ module Bwoken
|
|
2
2
|
class Simulator
|
3
3
|
|
4
4
|
def self.plist_buddy; '/usr/libexec/PlistBuddy'; end
|
5
|
-
def self.plist_file; "#{Bwoken.app_dir}/Info.plist"; end
|
5
|
+
def self.plist_file; "#{Bwoken::Build.new.app_dir}/Info.plist"; end
|
6
6
|
|
7
7
|
def self.device_family= device_family
|
8
8
|
update_device_family_in_plist :delete_array
|
@@ -6,6 +6,7 @@ COMPILED_COFFEE = COFFEESCRIPTS.pathmap('%{^integration/coffeescript,integrat
|
|
6
6
|
JAVASCRIPTS = FileList['integration/javascript/**/*.js']
|
7
7
|
COPIED_JAVASCRIPTS = JAVASCRIPTS.pathmap('%{^integration/javascript,integration/tmp/javascript}d/%f')
|
8
8
|
|
9
|
+
BUILD_DIR = 'build'
|
9
10
|
IPHONE_DIR = 'integration/coffeescript/iphone'
|
10
11
|
IPAD_DIR = 'integration/coffeescript/ipad'
|
11
12
|
VENDOR_JS_DIR = 'integration/javascript'
|
@@ -17,6 +18,7 @@ directory IPHONE_DIR
|
|
17
18
|
directory IPAD_DIR
|
18
19
|
directory VENDOR_JS_DIR
|
19
20
|
directory RESULTS_DIR
|
21
|
+
directory BUILD_DIR
|
20
22
|
|
21
23
|
file EXAMPLE_COFFEE => IPHONE_DIR do |t|
|
22
24
|
open(t.name, 'w') do |io|
|
@@ -37,12 +39,6 @@ namespace :bwoken do
|
|
37
39
|
task :init => [IPAD_DIR, RESULTS_DIR, EXAMPLE_COFFEE, EXAMPLE_VENDOR_JS]
|
38
40
|
end
|
39
41
|
|
40
|
-
desc 'Compile the workspace'
|
41
|
-
task :build do
|
42
|
-
exit_status = Bwoken::Build.new.compile
|
43
|
-
raise unless exit_status == 0
|
44
|
-
end
|
45
|
-
|
46
42
|
COMPILED_COFFEE.zip(COFFEESCRIPTS).each do |target, source|
|
47
43
|
containing_dir = target.pathmap('%d')
|
48
44
|
directory containing_dir
|
@@ -67,13 +63,19 @@ CLOBBER.include('integration/tmp')
|
|
67
63
|
|
68
64
|
|
69
65
|
|
66
|
+
desc 'Compile the workspace'
|
67
|
+
task :build do
|
68
|
+
exit_status = Bwoken::Build.new.compile
|
69
|
+
raise unless exit_status == 0
|
70
|
+
end
|
71
|
+
|
70
72
|
|
71
73
|
device_families = %w(iphone ipad)
|
72
74
|
|
73
75
|
device_families.each do |device_family|
|
74
76
|
|
75
77
|
namespace device_family do
|
76
|
-
task :test => :coffeescript do
|
78
|
+
task :test => [RESULTS_DIR, :coffeescript] do
|
77
79
|
if ENV['RUN']
|
78
80
|
Bwoken::Script.run_one ENV['RUN'], device_family
|
79
81
|
else
|
data/lib/bwoken/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bwoken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
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-07-
|
13
|
+
date: 2012-07-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coffee-script-source
|
17
|
-
requirement: &
|
17
|
+
requirement: &70362206841360 !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: *70362206841360
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: colorful
|
28
|
-
requirement: &
|
28
|
+
requirement: &70362206840320 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70362206840320
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: execjs
|
39
|
-
requirement: &
|
39
|
+
requirement: &70362206839820 !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: *70362206839820
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rake
|
50
|
-
requirement: &
|
50
|
+
requirement: &70362206839180 !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: *70362206839180
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rspec
|
61
|
-
requirement: &
|
61
|
+
requirement: &70362206838380 !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: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70362206838380
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: guard-rspec
|
72
|
-
requirement: &
|
72
|
+
requirement: &70362206837680 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70362206837680
|
81
81
|
description: iOS UIAutomation Test Runner
|
82
82
|
email:
|
83
83
|
- brad@bendyworks.com
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- bin/unix_instruments.sh
|
93
93
|
- lib/bwoken/build.rb
|
94
94
|
- lib/bwoken/coffeescript.rb
|
95
|
+
- lib/bwoken/device.rb
|
95
96
|
- lib/bwoken/formatter.rb
|
96
97
|
- lib/bwoken/formatters/colorful_formatter.rb
|
97
98
|
- lib/bwoken/script.rb
|
@@ -114,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
115
|
version: '0'
|
115
116
|
segments:
|
116
117
|
- 0
|
117
|
-
hash:
|
118
|
+
hash: 3024521227927811859
|
118
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
120
|
none: false
|
120
121
|
requirements:
|
@@ -123,10 +124,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
124
|
version: '0'
|
124
125
|
segments:
|
125
126
|
- 0
|
126
|
-
hash:
|
127
|
+
hash: 3024521227927811859
|
127
128
|
requirements: []
|
128
129
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.8.
|
130
|
+
rubygems_version: 1.8.17
|
130
131
|
signing_key:
|
131
132
|
specification_version: 3
|
132
133
|
summary: Runs your UIAutomation tests from the command line for both iPhone and iPad;
|