snapshot 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/snapshot/options.rb +17 -0
- data/lib/snapshot/runner.rb +35 -1
- data/lib/snapshot/version.rb +1 -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: 0c1cb159338beb8967f7503b11f5a681521b40fd
|
4
|
+
data.tar.gz: 37d155a06363fe901d234027b6407b3a18eda291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccee926d0e221f8499e2fd7ea0b7a966fc8fd5386927f7ba08125495b7e0ff3e464e2222882f7dde62fe4ee468c6d558804eb4d2505d23e1369000d6b915d0c2
|
7
|
+
data.tar.gz: fc7df18a95b939451ecea39cffaf7805f8403b0e0807b0425cc50381edafd2e90fc88b48ed15952d12fad4da759038219e8228b68b225970396cd84bfeededeb
|
data/README.md
CHANGED
@@ -207,6 +207,12 @@ By default `snapshot` automatically retries running UI Tests if they fail. This
|
|
207
207
|
snapshot --number_of_retries 3
|
208
208
|
```
|
209
209
|
|
210
|
+
Add photos and/or videos to the simulator before running `snapshot`
|
211
|
+
|
212
|
+
```sh
|
213
|
+
snapshot --add_photos MyTestApp/Assets/demo.jpg --add_videos MyTestApp/Assets/demo.mp4
|
214
|
+
```
|
215
|
+
|
210
216
|
For a list for all available options run
|
211
217
|
|
212
218
|
```sh
|
@@ -248,6 +254,9 @@ launch_arguments("-username Felix")
|
|
248
254
|
output_directory './screenshots'
|
249
255
|
|
250
256
|
clear_previous_screenshots true
|
257
|
+
|
258
|
+
add_photos ["MyTestApp/Assets/demo.jpg"]
|
259
|
+
|
251
260
|
```
|
252
261
|
|
253
262
|
### Completely reset all simulators
|
data/lib/snapshot/options.rb
CHANGED
@@ -77,12 +77,29 @@ module Snapshot
|
|
77
77
|
description: "Enabling this option will automatically uninstall the application before running it",
|
78
78
|
default_value: false,
|
79
79
|
is_string: false),
|
80
|
+
FastlaneCore::ConfigItem.new(key: :erase_simulator,
|
81
|
+
env_name: 'SNAPSHOT_ERASE_SIMULATOR',
|
82
|
+
description: "Enabling this option will automatically erase the simulator before running the application",
|
83
|
+
default_value: false,
|
84
|
+
is_string: false),
|
80
85
|
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
81
86
|
env_name: 'SNAPSHOT_APP_IDENTIFIER',
|
82
87
|
short_option: "-a",
|
83
88
|
optional: true,
|
84
89
|
description: "The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)",
|
85
90
|
default_value: ENV["SNAPSHOT_APP_IDENTITIFER"] || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)),
|
91
|
+
FastlaneCore::ConfigItem.new(key: :add_photos,
|
92
|
+
env_name: 'SNAPSHOT_PHOTOS',
|
93
|
+
short_option: "-j",
|
94
|
+
description: "A list of photos that should be added to the simulator before running the application",
|
95
|
+
type: Array,
|
96
|
+
optional: true),
|
97
|
+
FastlaneCore::ConfigItem.new(key: :add_videos,
|
98
|
+
env_name: 'SNAPSHOT_VIDEOS',
|
99
|
+
short_option: "-u",
|
100
|
+
description: "A list of videos that should be added to the simulator before running the application",
|
101
|
+
type: Array,
|
102
|
+
optional: true),
|
86
103
|
|
87
104
|
# Everything around building
|
88
105
|
FastlaneCore::ConfigItem.new(key: :buildlog_path,
|
data/lib/snapshot/runner.rb
CHANGED
@@ -18,6 +18,8 @@ module Snapshot
|
|
18
18
|
sleep 3 # to be sure the user sees this, as compiling clears the screen
|
19
19
|
end
|
20
20
|
|
21
|
+
Snapshot.config[:output_directory] = File.expand_path(Snapshot.config[:output_directory])
|
22
|
+
|
21
23
|
verify_helper_is_current
|
22
24
|
|
23
25
|
FastlaneCore::PrintTable.print_values(config: Snapshot.config, hide_keys: [], title: "Summary for snapshot #{Snapshot::VERSION}")
|
@@ -116,7 +118,15 @@ module Snapshot
|
|
116
118
|
Snapshot.kill_simulator # because of https://github.com/fastlane/snapshot/issues/337
|
117
119
|
`xcrun simctl shutdown booted &> /dev/null`
|
118
120
|
|
119
|
-
|
121
|
+
if Snapshot.config[:erase_simulator]
|
122
|
+
erase_simulator(device_type)
|
123
|
+
elsif Snapshot.config[:reinstall_app]
|
124
|
+
# no need to reinstall if device has been erased
|
125
|
+
uninstall_app(device_type)
|
126
|
+
end
|
127
|
+
|
128
|
+
add_media(device_type, :photo, Snapshot.config[:add_photos]) if Snapshot.config[:add_photos]
|
129
|
+
add_media(device_type, :video, Snapshot.config[:add_videos]) if Snapshot.config[:add_videos]
|
120
130
|
|
121
131
|
command = TestCommandGenerator.generate(device_type: device_type)
|
122
132
|
|
@@ -167,6 +177,30 @@ module Snapshot
|
|
167
177
|
Helper.backticks("xcrun simctl uninstall #{device_udid} #{Snapshot.config[:app_identifier]} &> /dev/null")
|
168
178
|
end
|
169
179
|
|
180
|
+
def erase_simulator(device_type)
|
181
|
+
Helper.log.debug "Erasing #{device_type}..."
|
182
|
+
device_udid = TestCommandGenerator.device_udid(device_type)
|
183
|
+
|
184
|
+
Helper.log.info "Erasing #{device_type}...".yellow
|
185
|
+
|
186
|
+
`xcrun simctl erase #{device_udid} &> /dev/null`
|
187
|
+
end
|
188
|
+
|
189
|
+
def add_media(device_type, media_type, paths)
|
190
|
+
media_type = media_type.to_s
|
191
|
+
|
192
|
+
UI.verbose "Adding #{media_type}s to #{device_type}..."
|
193
|
+
device_udid = TestCommandGenerator.device_udid(device_type)
|
194
|
+
|
195
|
+
UI.message "Launch Simulator #{device_type}"
|
196
|
+
Helper.backticks("xcrun instruments -w #{device_udid} &> /dev/null")
|
197
|
+
|
198
|
+
paths.each do |path|
|
199
|
+
UI.message "Adding '#{path}'"
|
200
|
+
Helper.backticks("xcrun simctl add#{media_type} #{device_udid} #{path.shellescape} &> /dev/null")
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
170
204
|
def clear_previous_screenshots
|
171
205
|
UI.important "Clearing previously generated screenshots"
|
172
206
|
path = File.join(".", Snapshot.config[:output_directory], "*", "*.png")
|
data/lib/snapshot/version.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.
|
4
|
+
version: 1.8.0
|
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-02-
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|