snapshot 1.12.1 → 1.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/assets/SnapshotHelper.swift +3 -3
- data/lib/snapshot/fixes/hardware_keyboard_fix.rb +0 -2
- data/lib/snapshot/fixes/simulator_zoom_fix.rb +0 -2
- data/lib/snapshot/latest_ios_version.rb +2 -2
- data/lib/snapshot/options.rb +12 -7
- data/lib/snapshot/reset_simulators.rb +1 -1
- data/lib/snapshot/runner.rb +34 -6
- data/lib/snapshot/setup.rb +1 -1
- data/lib/snapshot/test_command_generator.rb +1 -1
- data/lib/snapshot/version.rb +1 -1
- data/lib/snapshot.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f66739b39604b0850729cdbc3ec8b7c285b8dc0d
|
4
|
+
data.tar.gz: a724757422b90bd6b7c438d2550322d0c19422fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ea43999e4268e07952c39b1788e35ff0609d150d10e6ef71eda5b556aea4368f51270039caf0928d596f532b1a575fa298a168744688e8252b6039aa9887f5c
|
7
|
+
data.tar.gz: 87eb051ee9eee593b5e264426c7caa810bc3077cc7909a92f245b53f65a8741701dea62037bfbb7a15addff8d556cd146d1b22b4b93e2481985c3cfda35a141c
|
data/README.md
CHANGED
@@ -81,7 +81,7 @@ Please check out the [MigrationGuide to 1.0](/snapshot/MigrationGuide.md) :+1:
|
|
81
81
|
|
82
82
|
-------
|
83
83
|
|
84
|
-
<h5 align="center"><code>snapshot</code> is part of <a href="https://fastlane.tools">fastlane</a>:
|
84
|
+
<h5 align="center"><code>snapshot</code> is part of <a href="https://fastlane.tools">fastlane</a>: The easiest way to automate building and releasing your iOS and Android apps.</h5>
|
85
85
|
|
86
86
|
# Features
|
87
87
|
- Create hundreds of screenshots in multiple languages on all simulators
|
@@ -329,7 +329,7 @@ When the user calls `snapshot(...)` in the UI Tests (Swift or Objective C) the s
|
|
329
329
|
|
330
330
|
In the test output, the Swift `snapshot` function will print out something like this
|
331
331
|
|
332
|
-
|
332
|
+
> snapshot: [some random text here]
|
333
333
|
|
334
334
|
`snapshot` finds all these entries using a regex. The number of `snapshot` outputs in the terminal and the number of `snapshot` events in the plist file should be the same. Knowing that, `snapshot` automatically matches these 2 lists to identify the name of each of these screenshots. They are then copied over to the output directory and separated by language and device.
|
335
335
|
|
@@ -346,7 +346,7 @@ Also, feel free to duplicate radar [23062925](https://openradar.appspot.com/rada
|
|
346
346
|
|
347
347
|
## [`fastlane`](https://fastlane.tools) Toolchain
|
348
348
|
|
349
|
-
- [`fastlane`](https://fastlane.tools):
|
349
|
+
- [`fastlane`](https://fastlane.tools): The easiest way to automate building and releasing your iOS and Android apps
|
350
350
|
- [`deliver`](https://github.com/fastlane/fastlane/tree/master/deliver): Upload screenshots, metadata and your app to the App Store
|
351
351
|
- [`frameit`](https://github.com/fastlane/fastlane/tree/master/frameit): Quickly put your screenshots into the right device frames
|
352
352
|
- [`PEM`](https://github.com/fastlane/fastlane/tree/master/pem): Automatically generate and renew your push notification profiles
|
@@ -25,9 +25,9 @@ func snapshot(name: String, waitForLoadingIndicator: Bool = true) {
|
|
25
25
|
Snapshot.snapshot(name, waitForLoadingIndicator: waitForLoadingIndicator)
|
26
26
|
}
|
27
27
|
|
28
|
-
class Snapshot: NSObject {
|
28
|
+
public class Snapshot: NSObject {
|
29
29
|
|
30
|
-
class func setupSnapshot(app: XCUIApplication) {
|
30
|
+
public class func setupSnapshot(app: XCUIApplication) {
|
31
31
|
setLanguage(app)
|
32
32
|
setLocale(app)
|
33
33
|
setLaunchArguments(app)
|
@@ -89,7 +89,7 @@ class Snapshot: NSObject {
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
92
|
-
class func snapshot(name: String, waitForLoadingIndicator: Bool = true) {
|
92
|
+
public class func snapshot(name: String, waitForLoadingIndicator: Bool = true) {
|
93
93
|
if waitForLoadingIndicator {
|
94
94
|
waitForLoadingIndicatorToDisappear()
|
95
95
|
}
|
@@ -5,8 +5,6 @@ module Snapshot
|
|
5
5
|
|
6
6
|
class HardwareKeyboardFix
|
7
7
|
def self.patch
|
8
|
-
Snapshot.kill_simulator # First we need to kill the simulator
|
9
|
-
|
10
8
|
UI.verbose "Patching simulator to work with secure text fields"
|
11
9
|
|
12
10
|
Helper.backticks("defaults write com.apple.iphonesimulator ConnectHardwareKeyboard 0", print: $verbose)
|
@@ -14,11 +14,11 @@ module Snapshot
|
|
14
14
|
|
15
15
|
matched = output.match(/iOS ([\d\.]+) \(.*/)
|
16
16
|
if matched.nil?
|
17
|
-
|
17
|
+
UI.user_error!("Could not determine installed iOS SDK version. Try running the _xcodebuild_ command manually to ensure it works.")
|
18
18
|
elsif matched.length > 1
|
19
19
|
return @version ||= matched[1]
|
20
20
|
else
|
21
|
-
|
21
|
+
UI.user_error!("Could not determine installed iOS SDK version. Please pass it via the environment variable 'SNAPSHOT_IOS_VERSION'")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
data/lib/snapshot/options.rb
CHANGED
@@ -14,9 +14,9 @@ module Snapshot
|
|
14
14
|
description: "Path the workspace file",
|
15
15
|
verify_block: proc do |value|
|
16
16
|
v = File.expand_path(value.to_s)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
UI.user_error!("Workspace file not found at path '#{v}'") unless File.exist?(v)
|
18
|
+
UI.user_error!("Workspace file invalid") unless File.directory?(v)
|
19
|
+
UI.user_error!("Workspace file is not a workspace, must end with .xcworkspace") unless v.include?(".xcworkspace")
|
20
20
|
end),
|
21
21
|
FastlaneCore::ConfigItem.new(key: :project,
|
22
22
|
short_option: "-p",
|
@@ -25,9 +25,9 @@ module Snapshot
|
|
25
25
|
description: "Path the project file",
|
26
26
|
verify_block: proc do |value|
|
27
27
|
v = File.expand_path(value.to_s)
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
UI.user_error!("Project file not found at path '#{v}'") unless File.exist?(v)
|
29
|
+
UI.user_error!("Project file invalid") unless File.directory?(v)
|
30
|
+
UI.user_error!("Project file is not a project file, must end with .xcodeproj") unless v.include?(".xcodeproj")
|
31
31
|
end),
|
32
32
|
FastlaneCore::ConfigItem.new(key: :devices,
|
33
33
|
description: "A list of devices you want to take the screenshots from",
|
@@ -38,7 +38,7 @@ module Snapshot
|
|
38
38
|
available = FastlaneCore::Simulator.all
|
39
39
|
value.each do |current|
|
40
40
|
unless available.any? { |d| d.name.strip == current.strip }
|
41
|
-
|
41
|
+
UI.user_error!("Device '#{current}' not in list of available simulators '#{available.join(', ')}'")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end),
|
@@ -82,6 +82,11 @@ module Snapshot
|
|
82
82
|
description: "Enabling this option will automatically erase the simulator before running the application",
|
83
83
|
default_value: false,
|
84
84
|
is_string: false),
|
85
|
+
FastlaneCore::ConfigItem.new(key: :localize_simulator,
|
86
|
+
env_name: 'SNAPSHOT_LOCALIZE_SIMULATOR',
|
87
|
+
description: "Enabling this option will configure the Simulator's system language",
|
88
|
+
default_value: false,
|
89
|
+
is_string: false),
|
85
90
|
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
86
91
|
env_name: 'SNAPSHOT_APP_IDENTIFIER',
|
87
92
|
short_option: "-a",
|
@@ -7,7 +7,7 @@ module Snapshot
|
|
7
7
|
|
8
8
|
sure = true if ENV["SNAPSHOT_FORCE_DELETE"]
|
9
9
|
sure = agree("Are you sure? All your simulators will be DELETED and new ones will be created! (y/n)".red, true) unless sure
|
10
|
-
|
10
|
+
UI.user_error!("User cancelled action") unless sure
|
11
11
|
|
12
12
|
devices.each do |device|
|
13
13
|
_, name, id = device
|
data/lib/snapshot/runner.rb
CHANGED
@@ -123,14 +123,19 @@ module Snapshot
|
|
123
123
|
File.write(File.join(prefix, "locale.txt"), locale || "")
|
124
124
|
File.write(File.join(prefix, "snapshot-launch_arguments.txt"), launch_arguments.last)
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
126
|
+
# Kill and shutdown all currently running simulators so that the following settings
|
127
|
+
# changes will be picked up when they are started again.
|
129
128
|
Snapshot.kill_simulator # because of https://github.com/fastlane/snapshot/issues/337
|
130
129
|
`xcrun simctl shutdown booted &> /dev/null`
|
131
130
|
|
132
|
-
|
131
|
+
Fixes::SimulatorZoomFix.patch
|
132
|
+
Fixes::HardwareKeyboardFix.patch
|
133
|
+
|
134
|
+
if Snapshot.config[:erase_simulator] || Snapshot.config[:localize_simulator]
|
133
135
|
erase_simulator(device_type)
|
136
|
+
if Snapshot.config[:localize_simulator]
|
137
|
+
localize_simulator(device_type, language, locale)
|
138
|
+
end
|
134
139
|
elsif Snapshot.config[:reinstall_app]
|
135
140
|
# no need to reinstall if device has been erased
|
136
141
|
uninstall_app(device_type)
|
@@ -139,6 +144,8 @@ module Snapshot
|
|
139
144
|
add_media(device_type, :photo, Snapshot.config[:add_photos]) if Snapshot.config[:add_photos]
|
140
145
|
add_media(device_type, :video, Snapshot.config[:add_videos]) if Snapshot.config[:add_videos]
|
141
146
|
|
147
|
+
open_simulator_for_device(device_type)
|
148
|
+
|
142
149
|
command = TestCommandGenerator.generate(device_type: device_type)
|
143
150
|
|
144
151
|
if locale
|
@@ -183,6 +190,13 @@ module Snapshot
|
|
183
190
|
return Collector.fetch_screenshots(raw_output, dir_name, device_type, launch_arguments.first)
|
184
191
|
end
|
185
192
|
|
193
|
+
def open_simulator_for_device(device)
|
194
|
+
return unless ENV['FASTLANE_EXPLICIT_OPEN_SIMULATOR']
|
195
|
+
|
196
|
+
UI.message("Explicitly opening simulator for device: #{device}")
|
197
|
+
`open -a Simulator --args -CurrentDeviceUDID #{TestCommandGenerator.device_udid(device)}`
|
198
|
+
end
|
199
|
+
|
186
200
|
def uninstall_app(device_type)
|
187
201
|
UI.verbose "Uninstalling app '#{Snapshot.config[:app_identifier]}' from #{device_type}..."
|
188
202
|
Snapshot.config[:app_identifier] ||= ask("App Identifier: ")
|
@@ -196,14 +210,28 @@ module Snapshot
|
|
196
210
|
end
|
197
211
|
|
198
212
|
def erase_simulator(device_type)
|
199
|
-
|
213
|
+
UI.verbose("Erasing #{device_type}...")
|
200
214
|
device_udid = TestCommandGenerator.device_udid(device_type)
|
201
215
|
|
202
|
-
|
216
|
+
UI.important("Erasing #{device_type}...")
|
203
217
|
|
204
218
|
`xcrun simctl erase #{device_udid} &> /dev/null`
|
205
219
|
end
|
206
220
|
|
221
|
+
def localize_simulator(device_type, language, locale)
|
222
|
+
device_udid = TestCommandGenerator.device_udid(device_type)
|
223
|
+
if device_udid
|
224
|
+
locale ||= language.sub("-", "_")
|
225
|
+
plist = {
|
226
|
+
AppleLocale: locale,
|
227
|
+
AppleLanguages: [language]
|
228
|
+
}
|
229
|
+
UI.message "Localizing #{device_type} (AppleLocale=#{locale} AppleLanguages=[#{language}])"
|
230
|
+
plist_path = "#{ENV['HOME']}/Library/Developer/CoreSimulator/Devices/#{device_udid}/data/Library/Preferences/.GlobalPreferences.plist"
|
231
|
+
File.write(plist_path, Plist::Emit.dump(plist))
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
207
235
|
def add_media(device_type, media_type, paths)
|
208
236
|
media_type = media_type.to_s
|
209
237
|
|
data/lib/snapshot/setup.rb
CHANGED
@@ -5,7 +5,7 @@ module Snapshot
|
|
5
5
|
snapfile_path = File.join(path, 'Snapfile')
|
6
6
|
|
7
7
|
if File.exist?(snapfile_path)
|
8
|
-
|
8
|
+
UI.user_error!("Snapfile already exists at path '#{snapfile_path}'. Run 'snapshot' to use snapshot.")
|
9
9
|
end
|
10
10
|
|
11
11
|
gem_path = Helper.gem_path("snapshot")
|
data/lib/snapshot/version.rb
CHANGED
data/lib/snapshot.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|