Skip to content

Commit 7515ddc

Browse files
committed
Fix navigation color and improve snapshot testing
1 parent 440502f commit 7515ddc

File tree

8 files changed

+21
-16
lines changed

8 files changed

+21
-16
lines changed

ec3730.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@
13381338
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
13391339
CODE_SIGN_IDENTITY = "Apple Development";
13401340
CODE_SIGN_STYLE = Automatic;
1341-
CURRENT_PROJECT_VERSION = 8;
1341+
CURRENT_PROJECT_VERSION = 9;
13421342
DEVELOPMENT_TEAM = C6L3992RFB;
13431343
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
13441344
INFOPLIST_FILE = ec3730/Info.plist;
@@ -1366,7 +1366,7 @@
13661366
CODE_SIGN_ENTITLEMENTS = ec3730/ec3730.entitlements;
13671367
CODE_SIGN_IDENTITY = "Apple Development";
13681368
CODE_SIGN_STYLE = Automatic;
1369-
CURRENT_PROJECT_VERSION = 8;
1369+
CURRENT_PROJECT_VERSION = 9;
13701370
DEVELOPMENT_TEAM = C6L3992RFB;
13711371
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
13721372
INFOPLIST_FILE = ec3730/Info.plist;

ec3730/AppDelegate.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
2828
if ProcessInfo().arguments.contains("SKIP_ANIMATIONS") {
2929
UIView.setAnimationsEnabled(false)
3030
}
31+
32+
handleUITests()
3133
#endif
3234

3335
UIDevice.current.isBatteryMonitoringEnabled = true
@@ -80,6 +82,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
8082
return true
8183
}
8284

85+
func handleUITests() {
86+
if ProcessInfo.processInfo.arguments.contains("UI-Testing") {
87+
UserDefaults.standard.removePersistentDomain(forName: Bundle.main.bundleIdentifier!)
88+
UserDefaults.standard.dictionaryRepresentation().keys.forEach(UserDefaults.standard.removeObject(forKey:))
89+
UserDefaults.standard.synchronize()
90+
}
91+
}
92+
8393
public static var persistantStore: NSPersistentCloudKitContainer? = {
8494
let container = NSPersistentCloudKitContainer(name: "NetUtilsCoreData")
8595
container.loadPersistentStores { _, error in

ec3730/Controllers/PingViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ struct PingSwiftUIViewController: View {
364364
.onDisappear(perform: {
365365
self.pinger?.stopPinging()
366366
})
367+
.background(Color(UIColor.systemGroupedBackground))
367368
.navigationViewStyle(StackNavigationViewStyle())
368369
.environment(\.managedObjectContext, persistenceController.container.viewContext) // NavigationView
369370
}

ec3730/Views/Host/HostResult.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ struct HostResult: View {
3030
}
3131
}
3232
}
33-
.background(Color(UIColor.systemGroupedBackground))
3433
HostBarView(url: group.url, date: group.date)
35-
}.navigationTitle(self.group.url.host ?? "Unknown Host")
34+
}
35+
.background(Color(UIColor.systemGroupedBackground))
36+
.navigationTitle(self.group.url.host ?? "Unknown Host")
3637
}
3738
}

ec3730/Views/Host/HostView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ struct HostView: View {
3636
}
3737
.animation(.default, value: model.sections)
3838
}
39-
.background(Color(UIColor.systemGroupedBackground))
4039
// Fix for the content going above the navigation
4140
// See !92 for more information
4241
.padding(.top, 0.15)
@@ -61,6 +60,7 @@ struct HostView: View {
6160
cancel: cancel
6261
)
6362
}
63+
.background(Color(UIColor.systemGroupedBackground))
6464
.navigationBarTitle("Host Information", displayMode: .inline)
6565
.toolbar {
6666
ToolbarItem(placement: .navigationBarTrailing, content: {

ec3730/Views/Interface/InterfaceListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ struct InterfaceListView: View {
4444
})
4545
}
4646
}
47-
.background(Color(UIColor.systemGroupedBackground))
4847
.padding(.top, 0.15)
4948
.layoutPriority(1.0)
5049
InterfaceConnectionBarView(model: model)
5150
}
51+
.background(Color(UIColor.systemGroupedBackground))
5252
.onAppear {
5353
model.reload()
5454
}

ec3730/Views/Source/SourceCard.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ struct SourceCardView: View {
8282
Text("HTML")
8383
.bold()
8484
})
85+
.pickerStyle(.menu)
8586
Spacer()
8687
}
8788

@@ -112,6 +113,7 @@ struct SourceCardView: View {
112113
.navigationBarTitleDisplayMode(.inline)
113114
.navigationTitle("View Source")
114115
.padding(.top, 0.5)
116+
.background(Color(UIColor.systemGroupedBackground))
115117
.onChange(of: url) { _ in
116118
urlText = url.absoluteString
117119
}

ec3730UITests/ec3730UITests.swift

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class EC3730UITests: XCTestCase {
2020
continueAfterFailure = false
2121
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
2222
app = XCUIApplication()
23+
app.launchArguments += ["UI-Testing"]
2324
setupSnapshot(app)
2425
app.launch()
2526

@@ -35,11 +36,9 @@ class EC3730UITests: XCTestCase {
3536
openVC("Host")
3637
app.buttons["Lookup"].tap()
3738
sleep(1)
38-
expandFirstItem()
3939
snapshot("Host")
4040

4141
openVC("Device")
42-
expandFirstItem()
4342
snapshot("Device")
4443

4544
openVC("Ping")
@@ -55,14 +54,6 @@ class EC3730UITests: XCTestCase {
5554
snapshot("ViewSource")
5655
}
5756

58-
private func expandFirstItem() {
59-
app.scrollViews.otherElements.firstMatch.press(forDuration: 1.1)
60-
let expandButton = app.collectionViews/*@START_MENU_TOKEN@*/ .buttons["Expand"]/*[[".cells.buttons[\"Expand\"]",".buttons[\"Expand\"]"],[[[-1,1],[-1,0]]],[0]]@END_MENU_TOKEN@*/
61-
if expandButton.isHittable {
62-
expandButton.tap()
63-
}
64-
}
65-
6657
private func openVC(_ key: String) {
6758
// First we try the tab bar
6859
let scrollViewsQuery = app.scrollViews

0 commit comments

Comments
 (0)