snapshot 1.9.0 → 1.10.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 +1 -1
- data/bin/snapshot +2 -2
- data/lib/assets/SnapshotHelper.swift +27 -6
- data/lib/snapshot/options.rb +1 -1
- data/lib/snapshot/page.html.erb +1 -1
- data/lib/snapshot/runner.rb +18 -4
- data/lib/snapshot/test_command_generator.rb +1 -1
- data/lib/snapshot/version.rb +1 -1
- data/lib/snapshot.rb +3 -0
- 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: 1f423c7b8038df57343f37a6d205c3d7df858612
|
4
|
+
data.tar.gz: 10ff5a81421f1a3bad034c590297c812e69e7277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cc9ad37a6ff4e4fdf627866821784474fc471f2bfb8769805aee42d8540fe892aa71b0d690052a535631dd87b1d7e8554a5aebb95a9a931ed49d109da8f681a
|
7
|
+
data.tar.gz: 1c436151af68dfe77df868b95460ad6ad35c27821100a440aea6c72ffceb520e2502676b61a54f509dfa25f91accf5c4625989f97a424e398e2fef6aae1c180a
|
data/README.md
CHANGED
@@ -286,7 +286,7 @@ to update your `SnapshotHelper.swift` files. In case you modified your `Snapshot
|
|
286
286
|
|
287
287
|
## Launch Arguments
|
288
288
|
|
289
|
-
You can provide additional arguments to your app on launch. These strings will be available in your
|
289
|
+
You can provide additional arguments to your app on launch. These strings will be available in your app (eg. not in the testing target) through `NSProcessInfo.processInfo().arguments`. Alternatively use user-default syntax (`-key value`) and they will be available as key-value pairs in `NSUserDefaults.standardUserDefaults()`.
|
290
290
|
|
291
291
|
`snapshot` includes `-FASTLANE_SNAPSHOT YES`, which will set a temporary user default for the key `FASTLANE_SNAPSHOT`, you may use this to detect when the app is run by `snapshot`.
|
292
292
|
|
data/bin/snapshot
CHANGED
@@ -65,8 +65,8 @@ class SnapshotApplication
|
|
65
65
|
c.option '-i', '--ios String', String, 'The comma separated list of iOS Versions you want to use'
|
66
66
|
|
67
67
|
c.action do |args, options|
|
68
|
-
|
69
|
-
versions = options.
|
68
|
+
options.default ios_version: Snapshot::LatestIosVersion.version
|
69
|
+
versions = options.ios_version.split(',') if options.ios_version
|
70
70
|
require 'snapshot/reset_simulators'
|
71
71
|
|
72
72
|
Snapshot::ResetSimulators.clear_everything!(versions)
|
@@ -34,10 +34,15 @@ class Snapshot: NSObject {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
class func setLanguage(app: XCUIApplication) {
|
37
|
-
let
|
37
|
+
guard let prefix = pathPrefix() else {
|
38
|
+
return
|
39
|
+
}
|
40
|
+
|
41
|
+
let path = prefix.stringByAppendingPathComponent("language.txt")
|
38
42
|
|
39
43
|
do {
|
40
|
-
|
44
|
+
let trimCharacterSet = NSCharacterSet.whitespaceAndNewlineCharacterSet()
|
45
|
+
deviceLanguage = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding).stringByTrimmingCharactersInSet(trimCharacterSet) as String
|
41
46
|
app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"]
|
42
47
|
} catch {
|
43
48
|
print("Couldn't detect/set language...")
|
@@ -45,10 +50,15 @@ class Snapshot: NSObject {
|
|
45
50
|
}
|
46
51
|
|
47
52
|
class func setLocale(app: XCUIApplication) {
|
48
|
-
let
|
53
|
+
guard let prefix = pathPrefix() else {
|
54
|
+
return
|
55
|
+
}
|
56
|
+
|
57
|
+
let path = prefix.stringByAppendingPathComponent("locale.txt")
|
49
58
|
|
50
59
|
do {
|
51
|
-
|
60
|
+
let trimCharacterSet = NSCharacterSet.whitespaceAndNewlineCharacterSet()
|
61
|
+
locale = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding).stringByTrimmingCharactersInSet(trimCharacterSet) as String
|
52
62
|
} catch {
|
53
63
|
print("Couldn't detect/set locale...")
|
54
64
|
}
|
@@ -59,8 +69,11 @@ class Snapshot: NSObject {
|
|
59
69
|
}
|
60
70
|
|
61
71
|
class func setLaunchArguments(app: XCUIApplication) {
|
62
|
-
let
|
72
|
+
guard let prefix = pathPrefix() else {
|
73
|
+
return
|
74
|
+
}
|
63
75
|
|
76
|
+
let path = prefix.stringByAppendingPathComponent("snapshot-launch_arguments.txt")
|
64
77
|
app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"]
|
65
78
|
|
66
79
|
do {
|
@@ -95,6 +108,14 @@ class Snapshot: NSObject {
|
|
95
108
|
print("Waiting for loading indicator to disappear...")
|
96
109
|
}
|
97
110
|
}
|
111
|
+
|
112
|
+
class func pathPrefix() -> NSString? {
|
113
|
+
if let path = NSProcessInfo().environment["SIMULATOR_HOST_HOME"] as NSString? {
|
114
|
+
return path.stringByAppendingPathComponent("Library/Caches/tools.fastlane")
|
115
|
+
}
|
116
|
+
print("Couldn't find Snapshot configuration files at ~/Library/Caches/tools.fastlane")
|
117
|
+
return nil
|
118
|
+
}
|
98
119
|
}
|
99
120
|
|
100
121
|
extension XCUIElement {
|
@@ -105,4 +126,4 @@ extension XCUIElement {
|
|
105
126
|
|
106
127
|
// Please don't remove the lines below
|
107
128
|
// They are used to detect outdated configuration files
|
108
|
-
// SnapshotHelperVersion [1.
|
129
|
+
// SnapshotHelperVersion [1.2]
|
data/lib/snapshot/options.rb
CHANGED
@@ -6,7 +6,7 @@ module Snapshot
|
|
6
6
|
def self.available_options
|
7
7
|
output_directory = (File.directory?("fastlane") ? "fastlane/screenshots" : "screenshots")
|
8
8
|
|
9
|
-
|
9
|
+
@options ||= [
|
10
10
|
FastlaneCore::ConfigItem.new(key: :workspace,
|
11
11
|
short_option: "-w",
|
12
12
|
env_name: "SNAPSHOT_WORKSPACE",
|
data/lib/snapshot/page.html.erb
CHANGED
data/lib/snapshot/runner.rb
CHANGED
@@ -115,9 +115,11 @@ module Snapshot
|
|
115
115
|
FileUtils.rm_rf(screenshots_path) if Snapshot.config[:clean]
|
116
116
|
FileUtils.mkdir_p(screenshots_path)
|
117
117
|
|
118
|
-
File.
|
119
|
-
|
120
|
-
File.write("
|
118
|
+
prefix = File.join(Dir.home, "Library/Caches/tools.fastlane")
|
119
|
+
FileUtils.mkdir_p(prefix)
|
120
|
+
File.write(File.join(prefix, "language.txt"), language)
|
121
|
+
File.write(File.join(prefix, "locale.txt"), locale || "")
|
122
|
+
File.write(File.join(prefix, "snapshot-launch_arguments.txt"), launch_arguments.last)
|
121
123
|
|
122
124
|
Fixes::SimulatorZoomFix.patch
|
123
125
|
Fixes::HardwareKeyboardFix.patch
|
@@ -220,13 +222,25 @@ module Snapshot
|
|
220
222
|
end
|
221
223
|
end
|
222
224
|
|
225
|
+
def version_of_bundled_helper
|
226
|
+
runner_dir = File.dirname(__FILE__)
|
227
|
+
bundled_helper = File.read File.expand_path('../assets/SnapshotHelper.swift', runner_dir)
|
228
|
+
current_version = bundled_helper.match(/\n.*SnapshotHelperVersion \[.+\]/)[0]
|
229
|
+
|
230
|
+
## Something like "// SnapshotHelperVersion [1.2]", but be relaxed about whitespace
|
231
|
+
current_version.gsub(%r{^//\w*}, '').strip
|
232
|
+
end
|
233
|
+
|
223
234
|
# rubocop:disable Style/Next
|
224
235
|
def verify_helper_is_current
|
236
|
+
current_version = version_of_bundled_helper
|
237
|
+
UI.verbose "Checking that helper files contain #{current_version}"
|
238
|
+
|
225
239
|
helper_files = Update.find_helper
|
226
240
|
helper_files.each do |path|
|
227
241
|
content = File.read(path)
|
228
242
|
|
229
|
-
unless content.include?(
|
243
|
+
unless content.include?(current_version)
|
230
244
|
UI.error "Your '#{path}' is outdated, please run `snapshot update`"
|
231
245
|
UI.error "to update your Helper file"
|
232
246
|
UI.user_error!("Please update your Snapshot Helper file")
|
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.
|
4
|
+
version: 1.10.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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|