-
Notifications
You must be signed in to change notification settings - Fork 230
/
Copy pathAppStoreSnapshotTests.swift
107 lines (97 loc) · 2.81 KB
/
AppStoreSnapshotTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import ActiveGamesFeature
import ClientModels
import ComposableArchitecture
import ComposableGameCenter
import CubeCore
import DailyChallengeFeature
import GameKit
import Gen
import HomeFeature
import LeaderboardFeature
import Overture
import PuzzleGen
import SharedModels
import SnapshotTesting
import Styleguide
import SwiftUI
import XCTest
struct SnapshotConfig {
let adaptiveSize: AdaptiveSize
let deviceState: DeviceState
let viewImageConfig: ViewImageConfig
}
let appStoreViewConfigs: [String: SnapshotConfig] = [
"iPhone_5_5": .init(adaptiveSize: .medium, deviceState: .phone, viewImageConfig: .iPhone8Plus),
"iPhone_6_5": .init(adaptiveSize: .large, deviceState: .phone, viewImageConfig: .iPhoneXsMax),
"iPad_12_9": .init(
adaptiveSize: .large, deviceState: .pad, viewImageConfig: .iPadPro12_9(.portrait)),
]
class AppStoreSnapshotTests: XCTestCase {
static override func setUp() {
super.setUp()
SnapshotTesting.diffTool = "ksdiff"
}
override func setUpWithError() throws {
try super.setUpWithError()
try XCTSkipIf(!Styleguide.registerFonts())
// isRecording = true
}
override func tearDown() {
isRecording = false
super.tearDown()
}
func test_1_SoloGame() {
assertAppStoreSnapshots(
for: gameplayAppStoreView,
description: {
Text("Find as many words as you can ").foregroundColor(Color.black.opacity(0.4))
+ Text("on a vanishing cube").foregroundColor(Color.black)
},
backgroundColor: .isowordsYellow,
colorScheme: .dark
)
}
func test_2_TurnBasedGame() {
assertAppStoreSnapshots(
for: turnBasedAppStoreView,
description: {
Text("You can play\nsolo or ").foregroundColor(Color.black.opacity(0.4))
+ Text("against\na friend").foregroundColor(Color.black)
},
backgroundColor: .hex(0xEDBC8A),
colorScheme: .light
)
}
func test_3_DailyChallengeResults() {
assertAppStoreSnapshots(
for: dailyChallengeAppStoreView,
description: {
Text("Or compete in the\n").foregroundColor(Color.black.opacity(0.4))
+ Text("daily challenge").foregroundColor(Color.black)
},
backgroundColor: .hex(0xE79273),
colorScheme: .dark
)
}
func test_4_Leaderboards() {
assertAppStoreSnapshots(
for: leaderboardAppStoreView,
description: {
Text("Longer words score higher. ").foregroundColor(Color.black.opacity(0.4))
+ Text("Show off your achievements!").foregroundColor(Color.black)
},
backgroundColor: .isowordsRed,
colorScheme: .light
)
}
func test_5_Home() {
assertAppStoreSnapshots(
for: homeAppStoreView,
description: {
Text("The cult classic is back and waiting for you!")
},
backgroundColor: .isowordsBlack,
colorScheme: .dark
)
}
}