Skip to content

Commit 8461d29

Browse files
authored
Merge pull request #308 from mattrubin/fastlane
Fastlane updates
2 parents d130ae2 + 57bb160 commit 8461d29

9 files changed

+48
-30
lines changed

Gemfile.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
CFPropertyList (3.0.0)
5-
addressable (2.5.2)
5+
addressable (2.6.0)
66
public_suffix (>= 2.0.2, < 4.0)
77
atomos (0.1.3)
88
babosa (1.0.2)
@@ -16,26 +16,26 @@ GEM
1616
digest-crc (0.4.1)
1717
domain_name (0.5.20180417)
1818
unf (>= 0.0.5, < 1.0.0)
19-
dotenv (2.5.0)
20-
emoji_regex (0.1.1)
21-
excon (0.62.0)
19+
dotenv (2.7.2)
20+
emoji_regex (1.0.1)
21+
excon (0.63.0)
2222
faraday (0.15.4)
2323
multipart-post (>= 1.2, < 3)
2424
faraday-cookie_jar (0.0.6)
2525
faraday (>= 0.7.4)
2626
http-cookie (~> 1.0.0)
27-
faraday_middleware (0.12.2)
27+
faraday_middleware (0.13.1)
2828
faraday (>= 0.7.4, < 1.0)
2929
fastimage (2.1.5)
30-
fastlane (2.112.0)
30+
fastlane (2.120.0)
3131
CFPropertyList (>= 2.3, < 4.0.0)
3232
addressable (>= 2.3, < 3.0.0)
3333
babosa (>= 1.0.2, < 2.0.0)
34-
bundler (>= 1.12.0, < 2.0.0)
34+
bundler (>= 1.12.0, < 3.0.0)
3535
colored
3636
commander-fastlane (>= 4.4.6, < 5.0.0)
3737
dotenv (>= 2.1.1, < 3.0.0)
38-
emoji_regex (~> 0.1)
38+
emoji_regex (>= 0.1, < 2.0)
3939
excon (>= 0.45.0, < 1.0.0)
4040
faraday (~> 0.9)
4141
faraday-cookie_jar (~> 0.0.6)
@@ -56,12 +56,12 @@ GEM
5656
security (= 0.1.3)
5757
simctl (~> 1.6.3)
5858
slack-notifier (>= 2.0.0, < 3.0.0)
59-
terminal-notifier (>= 1.6.2, < 2.0.0)
59+
terminal-notifier (>= 2.0.0, < 3.0.0)
6060
terminal-table (>= 1.4.5, < 2.0.0)
6161
tty-screen (>= 0.6.3, < 1.0.0)
6262
tty-spinner (>= 0.8.0, < 1.0.0)
6363
word_wrap (~> 1.0.0)
64-
xcodeproj (>= 1.6.0, < 2.0.0)
64+
xcodeproj (>= 1.8.1, < 2.0.0)
6565
xcpretty (~> 0.3.0)
6666
xcpretty-travis-formatter (>= 0.0.3)
6767
gh_inspector (1.1.3)
@@ -73,15 +73,15 @@ GEM
7373
representable (~> 3.0)
7474
retriable (>= 2.0, < 4.0)
7575
signet (~> 0.9)
76-
google-cloud-core (1.2.7)
76+
google-cloud-core (1.3.0)
7777
google-cloud-env (~> 1.0)
7878
google-cloud-env (1.0.5)
7979
faraday (~> 0.11)
80-
google-cloud-storage (1.15.0)
80+
google-cloud-storage (1.16.0)
8181
digest-crc (~> 0.4)
8282
google-api-client (~> 0.23)
8383
google-cloud-core (~> 1.2)
84-
googleauth (~> 0.6.2)
84+
googleauth (>= 0.6.2, < 0.10.0)
8585
googleauth (0.6.7)
8686
faraday (~> 0.12)
8787
jwt (>= 1.4, < 3.0)
@@ -93,12 +93,12 @@ GEM
9393
http-cookie (1.0.3)
9494
domain_name (~> 0.5)
9595
httpclient (2.8.3)
96-
json (2.1.0)
96+
json (2.2.0)
9797
jwt (2.1.0)
9898
memoist (0.16.0)
9999
mime-types (3.2.2)
100100
mime-types-data (~> 3.2015)
101-
mime-types-data (3.2018.0812)
101+
mime-types-data (3.2019.0331)
102102
mini_magick (4.5.1)
103103
multi_json (1.13.1)
104104
multi_xml (0.6.0)
@@ -125,20 +125,20 @@ GEM
125125
CFPropertyList
126126
naturally
127127
slack-notifier (2.3.2)
128-
terminal-notifier (1.8.0)
128+
terminal-notifier (2.0.0)
129129
terminal-table (1.8.0)
130130
unicode-display_width (~> 1.1, >= 1.1.1)
131-
tty-cursor (0.6.0)
131+
tty-cursor (0.6.1)
132132
tty-screen (0.6.5)
133133
tty-spinner (0.9.0)
134134
tty-cursor (~> 0.6.0)
135135
uber (0.1.0)
136136
unf (0.1.4)
137137
unf_ext
138138
unf_ext (0.0.7.5)
139-
unicode-display_width (1.4.1)
139+
unicode-display_width (1.5.0)
140140
word_wrap (1.0.0)
141-
xcodeproj (1.7.0)
141+
xcodeproj (1.8.2)
142142
CFPropertyList (>= 2.3.3, < 4.0)
143143
atomos (~> 0.1.3)
144144
claide (>= 1.0.2, < 2.0)

fastlane/Snapfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ devices([
77
"iPhone SE",
88
"iPhone 8",
99
"iPhone 8 Plus",
10-
"iPhone XS",
11-
"iPhone XS Max",
10+
"iPhone Xs",
11+
"iPhone Xs Max",
1212
])
1313

1414
languages([

fastlane/SnapshotHelper.swift

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import XCTest
1818
var deviceLanguage = ""
1919
var locale = ""
2020

21-
func setupSnapshot(_ app: XCUIApplication) {
22-
Snapshot.setupSnapshot(app)
21+
func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
22+
Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations)
2323
}
2424

2525
func snapshot(_ name: String, waitForLoadingIndicator: Bool) {
@@ -63,14 +63,16 @@ enum SnapshotError: Error, CustomDebugStringConvertible {
6363
@objcMembers
6464
open class Snapshot: NSObject {
6565
static var app: XCUIApplication?
66+
static var waitForAnimations = true
6667
static var cacheDirectory: URL?
6768
static var screenshotsDirectory: URL? {
6869
return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true)
6970
}
7071

71-
open class func setupSnapshot(_ app: XCUIApplication) {
72+
open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) {
7273

7374
Snapshot.app = app
75+
Snapshot.waitForAnimations = waitForAnimations
7476

7577
do {
7678
let cacheDir = try pathPrefix()
@@ -115,7 +117,7 @@ open class Snapshot: NSObject {
115117
print("Couldn't detect/set locale...")
116118
}
117119

118-
if locale.isEmpty {
120+
if locale.isEmpty && !deviceLanguage.isEmpty {
119121
locale = Locale(identifier: deviceLanguage).identifier
120122
}
121123

@@ -153,10 +155,17 @@ open class Snapshot: NSObject {
153155

154156
print("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work
155157

156-
sleep(1) // Waiting for the animation to be finished (kind of)
158+
if Snapshot.waitForAnimations {
159+
sleep(1) // Waiting for the animation to be finished (kind of)
160+
}
157161

158162
#if os(OSX)
159-
XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: [])
163+
guard let app = self.app else {
164+
print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
165+
return
166+
}
167+
168+
app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: [])
160169
#else
161170

162171
guard let app = self.app else {
@@ -182,7 +191,12 @@ open class Snapshot: NSObject {
182191
return
183192
#endif
184193

185-
let networkLoadingIndicator = XCUIApplication().otherElements.deviceStatusBars.networkLoadingIndicators.element
194+
guard let app = self.app else {
195+
print("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
196+
return
197+
}
198+
199+
let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element
186200
let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator)
187201
_ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout)
188202
}
@@ -257,7 +271,11 @@ private extension XCUIElementQuery {
257271
}
258272

259273
var deviceStatusBars: XCUIElementQuery {
260-
let deviceWidth = XCUIApplication().windows.firstMatch.frame.width
274+
guard let app = Snapshot.app else {
275+
fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().")
276+
}
277+
278+
let deviceWidth = app.windows.firstMatch.frame.width
261279

262280
let isStatusBar = NSPredicate { (evaluatedObject, _) in
263281
guard let element = evaluatedObject as? XCUIElementAttributes else { return false }
@@ -277,4 +295,4 @@ private extension CGFloat {
277295

278296
// Please don't remove the lines below
279297
// They are used to detect outdated configuration files
280-
// SnapshotHelperVersion [1.13]
298+
// SnapshotHelperVersion [1.15]

0 commit comments

Comments
 (0)