snapshot 1.3.0 → 1.4.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 +4 -4
- data/README.md +10 -0
- data/lib/snapshot/options.rb +11 -0
- data/lib/snapshot/runner.rb +14 -1
- data/lib/snapshot/test_command_generator.rb +6 -5
- 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: cf90b06f11837bb5e3d2c62b0a37aee3a7fac441
|
4
|
+
data.tar.gz: 6219c7deb8b82a89489e6c720dcfa89f99e8b06d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d7b0a83aa735a51534bdbf14fb09588344437066d681b4f7e040090287606d26b8949a353df51b340b5a73d23e08376465dc406aa51b51729942ca9cdd3afd4
|
7
|
+
data.tar.gz: 795038399e5f0da7638dd0cdfff85f1d145dd8a50f5b0b568ad4d64b11b3c7ee7342b2d93091ca5660892c0e1bb8672543be2394bf6a62d8d0cb78c72a4d886c
|
data/README.md
CHANGED
@@ -194,12 +194,22 @@ There are a lot of options available that define how to build your app, for exam
|
|
194
194
|
snapshot --scheme "UITests" --configuration "Release" --sdk "iphonesimulator"
|
195
195
|
```
|
196
196
|
|
197
|
+
Reinstall the app before running `snapshot`
|
198
|
+
|
199
|
+
```sh
|
200
|
+
snapshot --reinstall_app --app_identifier "tools.fastlane.app"
|
201
|
+
```
|
202
|
+
|
197
203
|
For a list for all available options run
|
198
204
|
|
199
205
|
```sh
|
200
206
|
snapshot --help
|
201
207
|
```
|
202
208
|
|
209
|
+
After running `snapshot` you will get a nice summary:
|
210
|
+
|
211
|
+
<img src="assets/testSummary.png" width="500">
|
212
|
+
|
203
213
|
## Snapfile
|
204
214
|
|
205
215
|
All of the available options can also be stored in a configuration file called the `Snapfile`. Since most values will not change often for your project, it is recommended to store them there:
|
data/lib/snapshot/options.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fastlane_core'
|
2
|
+
require 'credentials_manager'
|
2
3
|
|
3
4
|
module Snapshot
|
4
5
|
class Options
|
@@ -77,6 +78,16 @@ module Snapshot
|
|
77
78
|
description: "Enabling this option will automatically clear previously generated screenshots before running snapshot",
|
78
79
|
default_value: false,
|
79
80
|
is_string: false),
|
81
|
+
FastlaneCore::ConfigItem.new(key: :reinstall_app,
|
82
|
+
env_name: 'SNAPSHOT_REINSTALL_APP',
|
83
|
+
description: "Enabling this option will automatically uninstall the application before running it",
|
84
|
+
default_value: false,
|
85
|
+
is_string: false),
|
86
|
+
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
87
|
+
env_name: 'SNAPSHOT_APP_IDENTIFIER',
|
88
|
+
short_option: "-a",
|
89
|
+
description: "The bundle identifier of the app to uninstall (only needed when enabling reinstall_app)",
|
90
|
+
default_value: ENV["SNAPSHOT_APP_IDENTITIFER"] || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)),
|
80
91
|
|
81
92
|
# Everything around building
|
82
93
|
FastlaneCore::ConfigItem.new(key: :buildlog_path,
|
data/lib/snapshot/runner.rb
CHANGED
@@ -99,7 +99,9 @@ module Snapshot
|
|
99
99
|
Fixes::SimulatorZoomFix.patch
|
100
100
|
|
101
101
|
Snapshot.kill_simulator # because of https://github.com/fastlane/snapshot/issues/337
|
102
|
-
`xcrun simctl shutdown booted`
|
102
|
+
`xcrun simctl shutdown booted &> /dev/null`
|
103
|
+
|
104
|
+
uninstall_app(device_type) if Snapshot.config[:reinstall_app]
|
103
105
|
|
104
106
|
command = TestCommandGenerator.generate(device_type: device_type)
|
105
107
|
|
@@ -138,6 +140,17 @@ module Snapshot
|
|
138
140
|
Collector.fetch_screenshots(raw_output, language, device_type, launch_arguments.first)
|
139
141
|
end
|
140
142
|
|
143
|
+
def uninstall_app(device_type)
|
144
|
+
Helper.log.debug "Uninstalling app '#{Snapshot.config[:app_identifier]}' from #{device_type}..."
|
145
|
+
device_udid = TestCommandGenerator.device_udid(device_type)
|
146
|
+
|
147
|
+
Helper.log.info "Launch Simulator #{device_type}".yellow
|
148
|
+
`xcrun instruments -w #{device_udid} &> /dev/null`
|
149
|
+
|
150
|
+
Helper.log.info "Uninstall application #{Snapshot.config[:app_identifier]}".yellow
|
151
|
+
`xcrun simctl uninstall #{device_udid} #{Snapshot.config[:app_identifier]} &> /dev/null`
|
152
|
+
end
|
153
|
+
|
141
154
|
def clear_previous_screenshots
|
142
155
|
Helper.log.info "Clearing previously generated screenshots".yellow
|
143
156
|
path = File.join(".", Snapshot.config[:output_directory], "*", "*.png")
|
@@ -35,9 +35,6 @@ module Snapshot
|
|
35
35
|
options << "-configuration '#{config[:configuration]}'" if config[:configuration]
|
36
36
|
options << "-sdk '#{config[:sdk]}'" if config[:sdk]
|
37
37
|
options << "-derivedDataPath '#{derived_data_path}'"
|
38
|
-
# options << "-xcconfig '#{config[:xcconfig]}'" if config[:xcconfig]
|
39
|
-
# options << "-archivePath '#{archive_path}'"
|
40
|
-
# options << config[:xcargs] if config[:xcargs]
|
41
38
|
|
42
39
|
options
|
43
40
|
end
|
@@ -59,7 +56,7 @@ module Snapshot
|
|
59
56
|
["| tee '#{xcodebuild_log_path}' | xcpretty"]
|
60
57
|
end
|
61
58
|
|
62
|
-
def
|
59
|
+
def device_udid(device)
|
63
60
|
# we now fetch the device's udid. Why? Because we might get this error message
|
64
61
|
# > The requested device could not be found because multiple devices matched the request.
|
65
62
|
#
|
@@ -73,7 +70,11 @@ module Snapshot
|
|
73
70
|
device_udid = sim.udid if sim.name.strip == device.strip and sim.ios_version == Snapshot.config[:ios_version]
|
74
71
|
end
|
75
72
|
|
76
|
-
|
73
|
+
return device_udid
|
74
|
+
end
|
75
|
+
|
76
|
+
def destination(device)
|
77
|
+
value = "platform=iOS Simulator,id=#{device_udid(device)},OS=#{Snapshot.config[:ios_version]}"
|
77
78
|
|
78
79
|
return ["-destination '#{value}'"]
|
79
80
|
end
|
data/lib/snapshot/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
@@ -250,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
250
250
|
version: '0'
|
251
251
|
requirements: []
|
252
252
|
rubyforge_project:
|
253
|
-
rubygems_version: 2.4.
|
253
|
+
rubygems_version: 2.4.6
|
254
254
|
signing_key:
|
255
255
|
specification_version: 4
|
256
256
|
summary: Automate taking localized screenshots of your iOS app on every device
|