snapshot 1.2.1 → 1.2.2
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 +1 -1
- data/lib/assets/SnapshotHelper.swift +12 -19
- data/lib/snapshot/collector.rb +0 -1
- data/lib/snapshot/fixes/simulator_zoom_fix.rb +1 -1
- data/lib/snapshot/reports_generator.rb +6 -4
- data/lib/snapshot/runner.rb +5 -1
- data/lib/snapshot/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32db1081d69cbad7c990081eb4c4f99a85363077
|
4
|
+
data.tar.gz: 0b11785e5ed0fbb90c1bfbef0f43631d84e8fa39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e22d665e9898bcbd52b8ef87e869e94ae4ba177578707f8bbc85c29e2faf5f0abea21cfdf2bee005dc464d37286dab1eb88bd11e48246643bd46583ab589ea
|
7
|
+
data.tar.gz: cf8379a5515e44c4db7ac5690fd74023bc70649df9f24db9b135c208633066de82fb10b928b157ea3f45ecdc88fd090e6e69cf3f7d3f9bbf6ab78117535ca948
|
data/README.md
CHANGED
@@ -261,7 +261,7 @@ The easiest solution would be to just render the UIWindow into a file. That's no
|
|
261
261
|
|
262
262
|
When you run unit tests in Xcode, the reporter generates a plist file, documenting all events that occured during the tests ([More Information](http://michele.io/test-logs-in-xcode)). Additionally, Xcode generates screenshots before, during and after each of these events. There is no way to manually trigger a screenshot event. The screenshots and the plist files are stored in the DerivedData directory, which `snapshot` stores in a temporary folder.
|
263
263
|
|
264
|
-
When the user calls `snapshot(...)` in the UI Tests (Swift or Objective C) the script actually does a rotation to `.
|
264
|
+
When the user calls `snapshot(...)` in the UI Tests (Swift or Objective C) the script actually does a rotation to `.Unknown` which doesn't have any effect on the actual app, but is enough to trigger a screenshot. It has no effect to the application and is not something you would do in your tests. The goal was to find *some* event that a user would never trigger, so that we know it's from `snapshot`.
|
265
265
|
|
266
266
|
`snapshot` then iterates through all test events and check where we did this weird rotation. Once `snapshot` has all events triggered by `snapshot` it collects a ordered list of all the file names of the actual screenshots of the application.
|
267
267
|
|
@@ -11,50 +11,43 @@ import XCTest
|
|
11
11
|
|
12
12
|
var deviceLanguage = ""
|
13
13
|
|
14
|
-
func setLanguage(app: XCUIApplication)
|
15
|
-
{
|
14
|
+
func setLanguage(app: XCUIApplication) {
|
16
15
|
Snapshot.setLanguage(app)
|
17
16
|
}
|
18
17
|
|
19
|
-
func snapshot(name: String, waitForLoadingIndicator: Bool = false)
|
20
|
-
{
|
18
|
+
func snapshot(name: String, waitForLoadingIndicator: Bool = false) {
|
21
19
|
Snapshot.snapshot(name, waitForLoadingIndicator: waitForLoadingIndicator)
|
22
20
|
}
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
{
|
28
|
-
class func setLanguage(app: XCUIApplication)
|
29
|
-
{
|
22
|
+
class Snapshot: NSObject {
|
23
|
+
|
24
|
+
class func setLanguage(app: XCUIApplication) {
|
30
25
|
let path = "/tmp/language.txt"
|
31
|
-
|
26
|
+
|
32
27
|
do {
|
33
28
|
let locale = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String
|
34
29
|
deviceLanguage = locale.substringToIndex(locale.startIndex.advancedBy(2, limit:locale.endIndex))
|
35
|
-
app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))", "-AppleLocale", "\"\(locale)\"","-ui_testing"]
|
30
|
+
app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))", "-AppleLocale", "\"\(locale)\"", "-ui_testing"]
|
36
31
|
} catch {
|
37
32
|
print("Couldn't detect/set language...")
|
38
33
|
}
|
39
34
|
}
|
40
35
|
|
41
|
-
class func snapshot(name: String, waitForLoadingIndicator: Bool = false)
|
42
|
-
|
43
|
-
if (waitForLoadingIndicator)
|
44
|
-
{
|
36
|
+
class func snapshot(name: String, waitForLoadingIndicator: Bool = false) {
|
37
|
+
if waitForLoadingIndicator {
|
45
38
|
waitForLoadingIndicatorToDisappear()
|
46
39
|
}
|
40
|
+
|
47
41
|
print("snapshot: \(name)") // more information about this, check out https://github.com/krausefx/snapshot
|
48
42
|
|
49
43
|
sleep(1) // Waiting for the animation to be finished (kind of)
|
50
44
|
XCUIDevice.sharedDevice().orientation = .Unknown
|
51
45
|
}
|
52
46
|
|
53
|
-
class func waitForLoadingIndicatorToDisappear()
|
54
|
-
{
|
47
|
+
class func waitForLoadingIndicatorToDisappear() {
|
55
48
|
let query = XCUIApplication().statusBars.childrenMatchingType(.Other).elementBoundByIndex(1).childrenMatchingType(.Other)
|
56
49
|
|
57
|
-
while
|
50
|
+
while query.count > 4 {
|
58
51
|
sleep(1)
|
59
52
|
print("Number of Elements in Status Bar: \(query.count)... waiting for status bar to disappear")
|
60
53
|
}
|
data/lib/snapshot/collector.rb
CHANGED
@@ -60,7 +60,6 @@ module Snapshot
|
|
60
60
|
|
61
61
|
to_store = [] # contains the names of all the attachments we want to use
|
62
62
|
activities.each do |activity|
|
63
|
-
# We do care about this, all "Long press Target" events mean screenshots
|
64
63
|
attachment_entry = activity
|
65
64
|
to_store << attachment_entry["Attachments"].last["FileName"]
|
66
65
|
end
|
@@ -13,7 +13,7 @@ module Snapshot
|
|
13
13
|
Helper.log.debug "Patching '#{config_path}' to scale simulator to 100%"
|
14
14
|
|
15
15
|
FastlaneCore::Simulator.all.each do |simulator|
|
16
|
-
simulator_name = simulator.name.tr("
|
16
|
+
simulator_name = simulator.name.tr("\s", "-")
|
17
17
|
key = "SimulatorWindowLastScale-com.apple.CoreSimulator.SimDeviceType.#{simulator_name}"
|
18
18
|
|
19
19
|
command = "defaults write '#{config_path}' '#{key}' '1.0'"
|
@@ -52,10 +52,12 @@ module Snapshot
|
|
52
52
|
# The order IS important, since those names are used to check for include?
|
53
53
|
# and the iPhone 6 is inlucded in the iPhone 6 Plus
|
54
54
|
{
|
55
|
-
'
|
56
|
-
'
|
57
|
-
'
|
58
|
-
'
|
55
|
+
'iPhone6sPlus' => "5.5-Inch",
|
56
|
+
'iPhone6Plus' => "5.5-Inch",
|
57
|
+
'iPhone6s' => "4.7-Inch",
|
58
|
+
'iPhone6' => "4.7-Inch",
|
59
|
+
'iPhone5' => "4-Inch",
|
60
|
+
'iPhone4' => "3.5-Inch",
|
59
61
|
'iPadPro' => "iPad Pro",
|
60
62
|
'iPad' => "iPad",
|
61
63
|
'Mac' => "Mac"
|
data/lib/snapshot/runner.rb
CHANGED
@@ -41,11 +41,15 @@ module Snapshot
|
|
41
41
|
|
42
42
|
# Generate HTML report
|
43
43
|
ReportsGenerator.new.generate
|
44
|
+
|
45
|
+
# Clear the Derived Data
|
46
|
+
FileUtils.rm_rf(TestCommandGenerator.derived_data_path)
|
44
47
|
end
|
45
48
|
|
46
49
|
def launch(language, device_type)
|
47
50
|
screenshots_path = TestCommandGenerator.derived_data_path
|
48
|
-
FileUtils.rm_rf(screenshots_path)
|
51
|
+
FileUtils.rm_rf(File.join(screenshots_path, "Logs"))
|
52
|
+
FileUtils.rm_rf(screenshots_path) if Snapshot.config[:clean]
|
49
53
|
FileUtils.mkdir_p(screenshots_path)
|
50
54
|
|
51
55
|
File.write("/tmp/language.txt", language)
|
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.2.
|
4
|
+
version: 1.2.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: 2015-
|
11
|
+
date: 2015-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|
@@ -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.0
|
254
254
|
signing_key:
|
255
255
|
specification_version: 4
|
256
256
|
summary: Automate taking localized screenshots of your iOS app on every device
|