test(ios): cover context erasure and native capability restrictions

Add Apple-platform tests without presenting them as Linux results. Improve native dark-mode contrast and keep the portable policy suite separate from WebKit tests. Swift formatting and syntax checks pass; Xcode execution remains required.
This commit is contained in:
Yuvomi Mobile Contributors committed 2026-10-21 07:18:42 +02:00
1 parent 69c48169e2
commit f776c853c6
4 files changed
+36 -3

No files matched your search

+2 -1
View File
@@ -12,6 +12,7 @@ let package = Package(
"AuthenticationView.swift", "BrowserModel.swift", "ContentView.swift",
"ServerProbe.swift", "YuvomiApp.swift", "PrivacyInfo.xcprivacy", "Assets.xcassets",
], sources: ["ServerAddress.swift", "ServerMetadata.swift"]),
.testTarget(name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests"),
.testTarget(
name: "YuvomiPolicyTests", dependencies: ["Yuvomi"], path: "Tests", exclude: ["BrowserModelTests.swift"]),
]
)
+5 -1
View File
@@ -10,6 +10,7 @@ struct ContentView: View {
@State private var settings = false
@State private var erasing = false
@Environment(\.scenePhase) private var scenePhase
@Environment(\.colorScheme) private var colorScheme
var body: some View {
NavigationStack {
@@ -75,7 +76,10 @@ struct ContentView: View {
}
}
.navigationTitle("Yuvomi Mobile").navigationBarTitleDisplayMode(.inline)
.tint(Color(red: 108 / 255, green: 58 / 255, blue: 237 / 255))
.tint(
colorScheme == .dark
? Color(red: 167 / 255, green: 139 / 255, blue: 250 / 255)
: Color(red: 108 / 255, green: 58 / 255, blue: 237 / 255))
}
.task {
if server == nil, let existing = try? ServerAddress(input) {
+28
View File
@@ -0,0 +1,28 @@
import WebKit
import XCTest
@testable import Yuvomi
final class BrowserModelTests: XCTestCase {
@MainActor
func testMainViewHasNoNativeBridgeOrAutomaticPopupAccess() {
let model = BrowserModel()
XCTAssertFalse(model.web.configuration.preferences.javaScriptCanOpenWindowsAutomatically)
XCTAssertTrue(model.web.configuration.userContentController.userScripts.isEmpty)
XCTAssertTrue(model.web.configuration.websiteDataStore.isPersistent)
XCTAssertFalse(model.web.isInspectable)
}
@MainActor
func testServerErasureReplacesHistoryContext() async {
let model = BrowserModel()
let previousView = model.web
await withCheckedContinuation { continuation in
model.erase { continuation.resume() }
}
XCTAssertFalse(previousView === model.web)
XCTAssertNil(model.server)
XCTAssertFalse(model.canGoBack)
XCTAssertNil(model.error)
}
}
+1 -1
View File
@@ -26,7 +26,7 @@ targets:
NSCameraUsageDescription: Take a photo to upload to your Yuvomi server.
NSPhotoLibraryUsageDescription: Choose photos to upload to your Yuvomi server.
NSLocalNetworkUsageDescription: Connect to the private Yuvomi server you configure.
ITSAppUsesNonExemptEncryption: NO
ITSAppUsesNonExemptEncryption: false
UISupportedInterfaceOrientations:
- UIInterfaceOrientationPortrait
- UIInterfaceOrientationLandscapeLeft