Skip to content

Commit b4998be

Browse files
committed
Added auto screenshot generation with fastlane
1 parent 7ead0b3 commit b4998be

File tree

14 files changed

+793
-4
lines changed

14 files changed

+793
-4
lines changed

Client/Main.storyboard

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
</constraints>
9797
<edgeInsets key="layoutMargins" top="8" left="15" bottom="8" right="8"/>
9898
</tableViewCellContentView>
99+
<accessibility key="accessibilityConfiguration" identifier="PostCell"/>
99100
<gestureRecognizers/>
100101
<inset key="separatorInset" minX="88" minY="0.0" maxX="0.0" maxY="0.0"/>
101102
<connections>
@@ -205,7 +206,7 @@
205206
<navigationController id="2FT-kg-cd5" customClass="AppNavigationController" customModule="Hackers" customModuleProvider="target" sceneMemberID="viewController">
206207
<tabBarItem key="tabBarItem" title="Item" id="aiG-Km-7Il"/>
207208
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="o2Y-R6-LxE">
208-
<rect key="frame" x="0.0" y="0.0" width="375" height="96"/>
209+
<rect key="frame" x="0.0" y="20" width="375" height="96"/>
209210
<autoresizingMask key="autoresizingMask"/>
210211
</navigationBar>
211212
<connections>
@@ -430,6 +431,7 @@
430431
</constraints>
431432
</tableViewCellContentView>
432433
<color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
434+
<accessibility key="accessibilityConfiguration" identifier="CommentCell"/>
433435
<gestureRecognizers/>
434436
<connections>
435437
<outlet property="authorLabel" destination="I5X-8d-Ibl" id="aoB-OE-zh0"/>

Client/Supporting Files/AppDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
class AppDelegate: UIResponder, UIApplicationDelegate {
1111
var window: UIWindow?
1212

13-
func applicationDidFinishLaunching(_ application: UIApplication) {
13+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
1414
ReviewController.incrementLaunchCounter()
1515
ReviewController.requestReview()
1616
setAppTheme()
17+
return true
1718
}
1819

1920
private func setAppTheme() {

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source "https://rubygems.org"
2+
3+
gem "fastlane"

Hackers.xcodeproj/project.pbxproj

Lines changed: 223 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1010"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "24F39F8418AFB1150055F8DC"
18+
BuildableName = "Hackers.app"
19+
BlueprintName = "Hackers"
20+
ReferencedContainer = "container:Hackers.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "245345EB22466EA8001AF1CE"
36+
BuildableName = "HackersUITests.xctest"
37+
BlueprintName = "HackersUITests"
38+
ReferencedContainer = "container:Hackers.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
41+
</Testables>
42+
<MacroExpansion>
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "24F39F8418AFB1150055F8DC"
46+
BuildableName = "Hackers.app"
47+
BlueprintName = "Hackers"
48+
ReferencedContainer = "container:Hackers.xcodeproj">
49+
</BuildableReference>
50+
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
53+
</TestAction>
54+
<LaunchAction
55+
buildConfiguration = "Debug"
56+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58+
launchStyle = "0"
59+
useCustomWorkingDirectory = "NO"
60+
ignoresPersistentStateOnLaunch = "NO"
61+
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
63+
allowLocationSimulation = "YES">
64+
<BuildableProductRunnable
65+
runnableDebuggingMode = "0">
66+
<BuildableReference
67+
BuildableIdentifier = "primary"
68+
BlueprintIdentifier = "24F39F8418AFB1150055F8DC"
69+
BuildableName = "Hackers.app"
70+
BlueprintName = "Hackers"
71+
ReferencedContainer = "container:Hackers.xcodeproj">
72+
</BuildableReference>
73+
</BuildableProductRunnable>
74+
<AdditionalOptions>
75+
</AdditionalOptions>
76+
</LaunchAction>
77+
<ProfileAction
78+
buildConfiguration = "Release"
79+
shouldUseLaunchSchemeArgsEnv = "YES"
80+
savedToolIdentifier = ""
81+
useCustomWorkingDirectory = "NO"
82+
debugDocumentVersioning = "YES">
83+
<BuildableProductRunnable
84+
runnableDebuggingMode = "0">
85+
<BuildableReference
86+
BuildableIdentifier = "primary"
87+
BlueprintIdentifier = "24F39F8418AFB1150055F8DC"
88+
BuildableName = "Hackers.app"
89+
BlueprintName = "Hackers"
90+
ReferencedContainer = "container:Hackers.xcodeproj">
91+
</BuildableReference>
92+
</BuildableProductRunnable>
93+
</ProfileAction>
94+
<AnalyzeAction
95+
buildConfiguration = "Debug">
96+
</AnalyzeAction>
97+
<ArchiveAction
98+
buildConfiguration = "Release"
99+
revealArchiveInOrganizer = "YES">
100+
</ArchiveAction>
101+
</Scheme>

Hackers.xcodeproj/xcshareddata/xcschemes/Hackers.xcscheme

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
31+
<TestableReference
32+
skipped = "NO">
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "245345EB22466EA8001AF1CE"
36+
BuildableName = "HackersUITests.xctest"
37+
BlueprintName = "HackersUITests"
38+
ReferencedContainer = "container:Hackers.xcodeproj">
39+
</BuildableReference>
40+
</TestableReference>
3141
</Testables>
3242
<MacroExpansion>
3343
<BuildableReference

HackersUITests/HackersUITests.swift

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//
2+
// HackersUITests.swift
3+
// HackersUITests
4+
//
5+
// Created by Weiran Zhang on 23/03/2019.
6+
// Copyright © 2019 Glass Umbrella. All rights reserved.
7+
//
8+
9+
import XCTest
10+
import DeviceKit
11+
12+
class HackersUITests: XCTestCase {
13+
let device = Device()
14+
15+
override func setUp() {
16+
let app = XCUIApplication()
17+
setupSnapshot(app)
18+
app.launchArguments = ["-Theme", "light"]
19+
app.launch()
20+
}
21+
22+
func screenshotUltimate() {
23+
let tablesQuery = XCUIApplication().tables
24+
XCTAssertTrue(waitForElementToAppear(tablesQuery.cells.matching(identifier: "PostCell").element))
25+
26+
if self.device.isPad {
27+
tablesQuery.cells.firstMatch.tap()
28+
XCTAssertTrue(waitForElementToAppear(tablesQuery.cells.matching(identifier: "CommentCell").element))
29+
tablesQuery.cells.element(boundBy: 1).tap()
30+
}
31+
32+
snapshot("Ultimate")
33+
}
34+
35+
func screenshotComments() {
36+
if self.device.isPad {
37+
return
38+
}
39+
40+
let tablesQuery = XCUIApplication().tables
41+
XCTAssertTrue(waitForElementToAppear(tablesQuery.cells.matching(identifier: "PostCell").element))
42+
tablesQuery.cells.firstMatch.tap()
43+
44+
XCTAssertTrue(waitForElementToAppear(tablesQuery.cells.matching(identifier: "CommentCell").element))
45+
tablesQuery.cells.element(boundBy: 1).tap()
46+
47+
snapshot("Comments")
48+
}
49+
50+
func waitForElementToAppear(_ element: XCUIElement) -> Bool {
51+
let predicate = NSPredicate(format: "exists == true")
52+
let expectation = XCTNSPredicateExpectation(predicate: predicate, object: element)
53+
let result = XCTWaiter().wait(for: [expectation], timeout: 5)
54+
return result == .completed
55+
}
56+
}

HackersUITests/Info.plist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>BNDL</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>

Podfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ target 'Hackers' do
1010
pod 'Kingfisher'
1111
pod 'Loaf'
1212
end
13+
14+
target 'HackersUITests' do
15+
pod 'DeviceKit'
16+
end

Podfile.lock

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PODS:
2+
- DeviceKit (1.11.0)
23
- DZNEmptyDataSet (1.8.1)
34
- HNScraper (0.2.2)
45
- Kingfisher (5.1.1)
@@ -7,6 +8,7 @@ PODS:
78
- SkeletonView (1.4.1)
89

910
DEPENDENCIES:
11+
- DeviceKit
1012
- DZNEmptyDataSet
1113
- HNScraper (from `https://github.com/weiran/HNScraper.git`)
1214
- Kingfisher
@@ -16,6 +18,7 @@ DEPENDENCIES:
1618

1719
SPEC REPOS:
1820
https://github.com/cocoapods/specs.git:
21+
- DeviceKit
1922
- DZNEmptyDataSet
2023
- Kingfisher
2124
- Loaf
@@ -32,13 +35,14 @@ CHECKOUT OPTIONS:
3235
:git: https://github.com/weiran/HNScraper.git
3336

3437
SPEC CHECKSUMS:
38+
DeviceKit: a3a86f8dddbe1317a9a243cdf9646858bf135dce
3539
DZNEmptyDataSet: 9525833b9e68ac21c30253e1d3d7076cc828eaa7
3640
HNScraper: 89d135811bc8b9088adbb677c0bbc6cf8ed85cc0
3741
Kingfisher: 2558186963e5be42d98c5b110ccb3130148b77e4
3842
Loaf: 081b392fbe142da036377ebd988831596b89cf98
3943
PromiseKit: 94c6e781838c5bf4717677d0d882b0e7250c80fc
4044
SkeletonView: 60d6ce7edb0cb4c7758db33c74add50392b3c475
4145

42-
PODFILE CHECKSUM: 811b5917d51ca0ca801a5d52951ba192892403ee
46+
PODFILE CHECKSUM: f77bd47fbd830b492a149e21ec84822b9a074027
4347

4448
COCOAPODS: 1.6.1

0 commit comments

Comments
 (0)