calabash-cucumber 0.17.1 → 0.18.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 634d208866c3c80558eea3cf6e002d436a38ca70
4
- data.tar.gz: d2800a32dec27bbbbb2fef975ca0c0714cfe4dcb
3
+ metadata.gz: 7beda75c6242b6bc7f82b44c1a61d3ed14a57a33
4
+ data.tar.gz: 0753bd7f7c8bb00bf02f769300cd2308568f405d
5
5
  SHA512:
6
- metadata.gz: c3d0e8203c996a79d956d3c1862a48a760a716f622ff070a053682816e0a06bd2e77daeaeb232a299592cef3a8bb060222a64d96bdc39250d484638becea859a
7
- data.tar.gz: ecf56d4a6ed42028125511566d7b5a8078c43bdc2925619e7f3ee56b9ce5a715d63057355c91800480bc61b3fdc7427ff4677a515ae6e1d786175374aad9b7a8
6
+ metadata.gz: b9bbeb8638dc56f4cbba5d1a14ff8904265e049011245f083aa1746edd5d7440aa3b5921ecbcb407eb5987e4c291fe306e7c795aa54edf40b2269fe65e046aa8
7
+ data.tar.gz: 91fd05fae2b029a11d7df9ce4645c2b9018cd5237a400bc692322d33ac350f7ddc56bfb53d9963330c68054e87785005387cd46dcfc32303b67b2459bee6eb8a
@@ -1,5 +1,6 @@
1
1
  require 'calabash-cucumber/utils/simulator_accessibility'
2
2
  require 'calabash-cucumber/utils/logging'
3
+ require "calabash-cucumber/environment"
3
4
  require 'run_loop'
4
5
 
5
6
  include Calabash::Cucumber::Logging
@@ -62,46 +63,99 @@ end
62
63
 
63
64
  def calabash_sim_locale(args)
64
65
 
65
- prefs_path = File.expand_path("#{@script_dir}/data/.GlobalPreferences.plist")
66
- plist = CFPropertyList::List.new(:file => prefs_path)
67
- hash = CFPropertyList.native_types(plist.value)
66
+ if args.length != 2
67
+ puts %Q{
68
+ Usage:
68
69
 
70
+ $ calabash-ios sim locale < language code > < locale code >
69
71
 
70
- if args.length == 0
71
- print_usage
72
- puts "Options: \n"
73
- puts hash['AppleLanguages'].join("\n")
74
- exit 0
75
- end
76
- lang = args.shift
77
- reg = nil
78
- if args.length == 1
79
- reg = args.shift
80
- end
72
+ Examples:
81
73
 
82
- langs = hash['AppleLanguages']
83
- lang_index = langs.find_index { |l| l == lang }
74
+ # French language and locale
75
+ $ calabash-ios sim locale fr fr
84
76
 
85
- if lang_index.nil?
86
- puts "Unable to find #{lang}..."
87
- puts "Options:\n#{langs.join("\n")}"
88
- exit 0
77
+ # Swiss French with Swiss German locale
78
+ $ calabash-ios sim locale fr-CH de_CH
79
+
80
+ By default, this method will change the default simulator for the active
81
+ Xcode version. If you want to target an alternative simulator, set the
82
+ DEVICE_TARGET environment variable.
83
+
84
+ $ DEVICE_TARGET="iPhone 6 (9.2)" calabash-ios sim locale en-US en_US
85
+ $ DEVICE_TARGET=B9BCAD64-1624-4277-9361-40EFFBD7C67F calabash-ios sim locale de de
86
+
87
+ This operation will quit and reset the simulator.
88
+ }
89
+ return false
89
90
  end
90
91
 
91
- langs[0], langs[lang_index] = langs[lang_index], langs[0]
92
+ language = args[0]
93
+ locale = args[1]
94
+
95
+ device_target = Calabash::Cucumber::Environment.device_target
96
+ default_target = RunLoop::Core.default_simulator
97
+
98
+ target = device_target || default_target
99
+
100
+ device = RunLoop::Device.device_with_identifier(target)
101
+
102
+ if device.nil?
103
+ if target == device_target
104
+ puts %Q{
105
+ Could not find simulator matching:
92
106
 
107
+ DEVICE_TARGET=#{device_target}
93
108
 
94
- if reg
95
- hash['AppleLocale'] = reg
109
+ Check the output of:
110
+
111
+ $ xcrun instruments -s devices
112
+
113
+ for a list of available simulators.
114
+ }
115
+ else
116
+ puts %Q{
117
+ Could not find the default simulator. Make sure that you have
118
+ the right version of run_loop installed for your Xcode version.
119
+ }
120
+ end
121
+
122
+ return false
96
123
  end
97
- res_plist = CFPropertyList::List.new
98
- res_plist.value = CFPropertyList.guess(hash)
99
- dirs = Dir.glob(File.join(File.expand_path("~/Library"), "Application Support", "iPhone Simulator", "*.*", "Library", "Preferences"))
100
- dirs.each do |sim_pref_dir|
101
- res_plist.save("#{sim_pref_dir}/.GlobalPreferences.plist", CFPropertyList::List::FORMAT_BINARY)
124
+
125
+ if device.physical_device?
126
+ puts %Q{
127
+ This tool is for simulators only.
128
+
129
+ #{target} is a physical device.
130
+ }
131
+ return false
102
132
  end
103
133
 
134
+ RunLoop::CoreSimulator.set_language(device, language)
135
+ RunLoop::CoreSimulator.set_locale(device, locale)
136
+
137
+ puts %Q{
138
+ Set langauge to: '#{language}' and locale to: '#{locale}'.
139
+
140
+ Don't forget to launch your app with these options:
141
+
142
+ options = {
143
+ args = [
144
+ "-AppleLanguages", "(#{language})",
145
+ "-AppleLocale", "#{locale}"
146
+ ]
147
+ }
148
+
149
+ to ensure that your app launches with the correct primary langauge.
150
+
151
+ Examples:
152
+
153
+ * https://github.com/calabash/calabash-ios/wiki/Changing-Locale-and-Language
154
+ * https://github.com/calabash/Permissions/blob/master/features/0x/support/01_launch.rb
104
155
 
156
+ SUCCESS!
157
+ }
158
+ true
105
159
  end
106
160
 
107
161
 
Binary file
Binary file
@@ -1,9 +1,15 @@
1
- # Requiring this file will import Calabash and the Calabash predefined Steps.
2
- require 'calabash-cucumber/cucumber'
1
+ # Requiring this file will import:
2
+ # * the Calabash Cucumber API,
3
+ # * the Calabash Cucumber predefined Steps,
4
+ # * and the Calabash::Formatters::Html cucumber formatter.
5
+ require "calabash-cucumber/cucumber"
3
6
 
4
7
  # To use Calabash without the predefined Calabash Steps, uncomment these
5
8
  # three lines and delete the require above.
6
- # require 'calabash-cucumber/wait_helpers'
7
- # require 'calabash-cucumber/operations'
9
+ # require "calabash-cucumber/wait_helpers"
10
+ # require "calabash-cucumber/operations"
8
11
  # World(Calabash::Cucumber::Operations)
9
12
 
13
+ # Uncomment this line if you want the Calabash::Formatters::Html formatter.
14
+ # require "calabash-cucumber/formatters/html"
15
+
@@ -1,5 +1,6 @@
1
1
  require 'calabash-cucumber/wait_helpers'
2
2
  require 'calabash-cucumber/operations'
3
+ require "calabash-cucumber/formatters/html"
3
4
 
4
5
  World(Calabash::Cucumber::Operations)
5
6
 
@@ -0,0 +1,35 @@
1
+ require "cucumber/formatter/html"
2
+ require "uri"
3
+ require "pathname"
4
+
5
+ module Calabash
6
+ module Formatters
7
+ class Html < ::Cucumber::Formatter::Html
8
+ def embed_image(src, label)
9
+ if _output_relative? && _relative_uri?(src)
10
+ output_dir = Pathname.new(File.dirname(@io.path))
11
+ src_path = Pathname.new(src)
12
+ embed_relative_path = src_path.relative_path_from(output_dir)
13
+ super(embed_relative_path.to_s, label)
14
+ else
15
+ super(src, label)
16
+ end
17
+ end
18
+
19
+ def _relative_uri?(src)
20
+ uri = URI.parse(src)
21
+ return false if uri.scheme
22
+ not Pathname.new(src).absolute?
23
+ end
24
+
25
+
26
+ def _output_relative?
27
+ if @io.is_a?(File)
28
+ path = @io.path
29
+ _relative_uri?(path)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = "0.17.1"
6
+ VERSION = "0.18.0"
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = "0.17.1"
10
+ MIN_SERVER_VERSION = "0.18.0"
11
11
  end
12
12
  end
Binary file
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2016-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: calabash-common
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.0.2
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.0.2
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: edn
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -146,7 +132,7 @@ dependencies:
146
132
  requirements:
147
133
  - - ">="
148
134
  - !ruby/object:Gem::Version
149
- version: 2.0.3
135
+ version: 2.0.5
150
136
  - - "<"
151
137
  - !ruby/object:Gem::Version
152
138
  version: '3.0'
@@ -156,7 +142,7 @@ dependencies:
156
142
  requirements:
157
143
  - - ">="
158
144
  - !ruby/object:Gem::Version
159
- version: 2.0.3
145
+ version: 2.0.5
160
146
  - - "<"
161
147
  - !ruby/object:Gem::Version
162
148
  version: '3.0'
@@ -416,6 +402,7 @@ files:
416
402
  - lib/calabash-cucumber/environment.rb
417
403
  - lib/calabash-cucumber/environment_helpers.rb
418
404
  - lib/calabash-cucumber/failure_helpers.rb
405
+ - lib/calabash-cucumber/formatters/html.rb
419
406
  - lib/calabash-cucumber/http_helpers.rb
420
407
  - lib/calabash-cucumber/ibase.rb
421
408
  - lib/calabash-cucumber/ipad_1x_2x.rb
@@ -570,7 +557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
570
557
  version: '0'
571
558
  requirements: []
572
559
  rubyforge_project:
573
- rubygems_version: 2.4.8
560
+ rubygems_version: 2.5.1
574
561
  signing_key:
575
562
  specification_version: 4
576
563
  summary: Client for calabash-ios-server for automated functional testing on iOS