SPB Git

Repository Public

MobileEngineTests.swift 24.5 KB 425 lines swift

1import Network2import WebKit3import XCTest4@testable import SPBrowser56/// A tiny HTTP server on localhost so that tests visit real http pages without touching the internet.7final class LocalSite: @unchecked Sendable {8    private let listener: NWListener9    let port: UInt161011    init() throws {12        listener = try NWListener(using: .tcp, on: .any)13        let ready = DispatchSemaphore(value: 0)14        listener.stateUpdateHandler = { state in if case .ready = state { ready.signal() } }15        listener.newConnectionHandler = { connection in16            connection.start(queue: .global())17            connection.receive(minimumIncompleteLength: 1, maximumLength: 65536) { data, _, _, _ in18                let request = String(decoding: data ?? Data(), as: UTF8.self)19                let path = request.split(separator: " ").dropFirst().first.map(String.init) ?? "/"20                // "/article…" serves a page with enough running text for the reader.21                let paragraph = "<p>" + String(repeating: "The quick brown fox jumps over the lazy dog near the quiet river bank. ", count: 6) + "</p>"22                let article = path.hasPrefix("/article") ? "<nav><p>Menu that the reader must skip</p></nav><article><h2>First part</h2>" + String(repeating: paragraph, count: 4) + "<blockquote>A quoted line.</blockquote></article>" : ""23                let body = "<!doctype html><html><head><title>Page \(path)</title></head><body><h1>\(path)</h1>\(article)<a id=\"s\" href=\"spsearch://results?q=injected\">x</a></body></html>"24                let response = "HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: \(body.utf8.count)\r\nConnection: close\r\n\r\n\(body)"25                connection.send(content: Data(response.utf8), completion: .contentProcessed { _ in connection.cancel() })26            }27        }28        listener.start(queue: .global())29        _ = ready.wait(timeout: .now() + 5)30        port = listener.port?.rawValue ?? 031    }3233    func url(_ path: String) -> URL { URL(string: "http://127.0.0.1:\(port)\(path)")! }34    deinit { listener.cancel() }35}3637@MainActor38final class MobileEngineTests: XCTestCase {39    private var environment: MobileEnvironment!40    private var model: BrowserModel!41    private var site: LocalSite!4243    override func setUp() async throws {44        // No search request may reach the real service from unit tests.45        UserDefaults.standard.set("http://127.0.0.1:9", forKey: "SPBBackendURL")46        environment = MobileEnvironment(root: FileManager.default.temporaryDirectory.appendingPathComponent("spb-mobile-tests-\(UUID().uuidString)"), testing: true)47        model = environment.makeModel()48        site = try LocalSite()49    }5051    override func tearDown() async throws {52        model.tabs.forEach { $0.tearDownWebView() }53        model = nil; environment = nil; site = nil54        UserDefaults.standard.removeObject(forKey: "SPBBackendURL")55    }5657    private func wait(_ what: String, timeout: TimeInterval = 15, until condition: @MainActor () -> Bool) async throws {58        let deadline = Date().addingTimeInterval(timeout)59        while !condition() {60            if Date() > deadline { XCTFail("timed out waiting for \(what)"); throw CancellationError() }61            try await Task.sleep(for: .milliseconds(40))62        }63    }6465    private func settled(_ tab: MobileTab, at url: URL) -> Bool { tab.webView?.url == url && tab.webView?.isLoading == false }6667    func testQueryOpensNativeSearchPageAndBackForwardReturnsToIt() async throws {68        let tab = try XCTUnwrap(model.selectedTab)69        XCTAssertTrue(tab.isBlank)70        model.navigate("best apple silicon for local ai")71        let searchURL = try XCTUnwrap(tab.url)72        XCTAssertEqual(searchURL.scheme, "spsearch")73        XCTAssertTrue(tab.isSearchPage)74        XCTAssertEqual(tab.searchPage?.query, "best apple silicon for local ai")75        XCTAssertEqual(tab.searchPage?.kind, .web)76        XCTAssertEqual(tab.addressText, "best apple silicon for local ai")77        try await wait("placeholder document") { self.settled(tab, at: searchURL) }78        XCTAssertFalse(environment.history.allURLs().contains(searchURL.absoluteString), "search pages are not browsing history")79        XCTAssertEqual(environment.services.library.recentSearches().map(\.query), ["best apple silicon for local ai"])8081        // Switching mode is a navigation to the same query in another mode.82        tab.search("best apple silicon for local ai", kind: .images)83        try await wait("images mode") { tab.searchPage?.kind == .images && tab.webView?.isLoading == false }8485        // Opening a result, then going back, lands on the native results again.86        model.searchActions(for: tab).open(site.url("/result"), .current)87        try await wait("result page") { self.settled(tab, at: self.site.url("/result")) }88        XCTAssertFalse(tab.isSearchPage)89        XCTAssertNil(tab.searchPage)90        XCTAssertTrue(tab.canGoBack)91        tab.goBack()92        try await wait("back to results") { tab.isSearchPage && tab.searchPage?.kind == .images && tab.webView?.isLoading == false }93        XCTAssertEqual(tab.searchPage?.query, "best apple silicon for local ai")94        tab.goBack()95        try await wait("back to web mode") { tab.searchPage?.kind == .web }96        tab.goForward(); 97        try await wait("forward to images") { tab.searchPage?.kind == .images }98        tab.goForward()99        try await wait("forward to result") { self.settled(tab, at: self.site.url("/result")) }100101        // An address is loaded, not searched.102        model.navigate("127.0.0.1:\(site.port)/typed")103        try await wait("typed address") { self.settled(tab, at: self.site.url("/typed")) }104        XCTAssertTrue(environment.history.allURLs().contains(site.url("/typed").absoluteString))105    }106107    func testWebContentCannotOpenASearchPage() async throws {108        let tab = try XCTUnwrap(model.selectedTab)109        tab.load(site.url("/attacker"))110        try await wait("page") { self.settled(tab, at: self.site.url("/attacker")) }111        _ = try? await tab.webView?.evaluateJavaScript("location.href = 'spsearch://results?q=injected'")112        _ = try? await tab.webView?.evaluateJavaScript("document.getElementById('s').click()")113        try await Task.sleep(for: .milliseconds(600))114        XCTAssertEqual(tab.webView?.url, site.url("/attacker"))115        XCTAssertFalse(tab.isSearchPage)116        XCTAssertTrue(environment.services.library.recentSearches().isEmpty)117    }118119    func testPrivateTabsLeaveNoTraceAndAreNeverPublished() async throws {120        let regular = try XCTUnwrap(model.selectedTab)121        regular.load(site.url("/regular"))122        try await wait("regular page") { self.settled(regular, at: self.site.url("/regular")) }123        XCTAssertEqual(environment.history.allURLs(), [site.url("/regular").absoluteString])124125        let privateTab = model.newTab(isPrivate: true)126        XCTAssertTrue(model.isPrivate)127        privateTab.load(site.url("/secret"))128        try await wait("private page") { self.settled(privateTab, at: self.site.url("/secret")) }129        XCTAssertEqual(environment.history.allURLs(), [site.url("/regular").absoluteString], "no history row for a private visit")130        XCTAssertEqual(model.privateHistory.allURLs(), [site.url("/secret").absoluteString], "private history lives in memory only")131        XCTAssertFalse(privateTab.webView!.configuration.websiteDataStore.isPersistent)132        XCTAssertTrue(regular.webView!.configuration.websiteDataStore !== privateTab.webView!.configuration.websiteDataStore)133134        // A private search is not added to the search history.135        privateTab.search("my private question")136        try await wait("private search") { privateTab.isSearchPage && privateTab.webView?.isLoading == false }137        XCTAssertEqual(privateTab.searchPage?.query, "my private question")138        XCTAssertTrue(environment.services.library.recentSearches().isEmpty)139        XCTAssertNil(privateTab.searchPage?.context.library)140141        // Not in what is published to other devices, not in the saved session, not reopenable.142        privateTab.load(site.url("/secret2"))143        try await wait("private page 2") { self.settled(privateTab, at: self.site.url("/secret2")) }144        let published = environment.publishedTabs()145        XCTAssertEqual(published.open.map(\.url), [site.url("/regular").absoluteString])146        XCTAssertEqual(model.snapshot().tabs.map(\.url), [site.url("/regular").absoluteString])147        let oldPrivateHistory = model.privateHistory148        model.close(privateTab)149        XCTAssertTrue(model.recentlyClosed.isEmpty)150        XCTAssertTrue(environment.publishedTabs().closed.isEmpty)151        XCTAssertFalse(model.isPrivate)152        XCTAssertTrue(model.privateHistory !== oldPrivateHistory, "closing the last private tab discards the private history")153        XCTAssertTrue(model.privateHistory.allURLs().isEmpty)154155        // The sync mirror never saw the private pages.156        environment.services.sync.captureLocalChanges?()157        let mirrored = environment.services.mirror.records(SyncCollection.history).map(\.key) + environment.services.mirror.records(SyncCollection.tabs).map { String(decoding: $0.json, as: UTF8.self) }158        XCTAssertFalse(mirrored.joined().contains("secret"))159    }160161    func testSessionSnapshotRoundTripRestoresTabsLazily() async throws {162        let first = try XCTUnwrap(model.selectedTab)163        first.load(site.url("/one"))164        try await wait("one") { self.settled(first, at: self.site.url("/one")) }165        let second = model.newTab(url: site.url("/two"))166        try await wait("two") { self.settled(second, at: self.site.url("/two")) }167        let search = model.newTab()168        search.search("restored query", kind: .videos)169        model.newTab(isPrivate: true).load(site.url("/private"))170        model.select(second)171172        let store = SessionStore(directory: environment.root.appendingPathComponent("RoundTrip"))173        try store.save(SessionSnapshot(windows: [model.snapshot()]))174        guard case .loaded(let loaded) = store.load() else { return XCTFail("session not loaded") }175176        let restored = BrowserModel(environment: environment)177        restored.restore(try XCTUnwrap(loaded.windows.first))178        XCTAssertEqual(restored.tabs.map { $0.url?.absoluteString }, [site.url("/one").absoluteString, site.url("/two").absoluteString, SPSearchURL.make(query: "restored query", kind: .videos)?.absoluteString])179        XCTAssertTrue(restored.tabs.allSatisfy { !$0.isPrivate })180        XCTAssertEqual(restored.selectedTab?.url, site.url("/two"))181        XCTAssertNotNil(restored.selectedTab?.webView, "the selected tab loads")182        XCTAssertNil(restored.tabs[0].webView, "the others wait until shown")183        XCTAssertEqual(restored.tabs[0].displayTitle, "Page /one")184        XCTAssertEqual(restored.tabs[2].displayTitle, "restored query")185        try await wait("restored page") { self.settled(restored.selectedTab!, at: self.site.url("/two")) }186        restored.select(restored.tabs[2])187        try await wait("restored search") { restored.tabs[2].searchPage?.kind == .videos }188        restored.tabs.forEach { $0.tearDownWebView() }189    }190191    func testClosingAndReopeningTabs() async throws {192        let first = try XCTUnwrap(model.selectedTab)193        first.load(site.url("/a"))194        try await wait("a") { self.settled(first, at: self.site.url("/a")) }195        let second = model.newTab(url: site.url("/b"))196        try await wait("b") { self.settled(second, at: self.site.url("/b")) }197        model.close(second)198        XCTAssertEqual(model.selectedTab?.id, first.id)199        XCTAssertEqual(model.recentlyClosed.map(\.url), [site.url("/b").absoluteString])200        XCTAssertEqual(environment.publishedTabs().closed.map(\.url), [site.url("/b").absoluteString])201        model.reopenClosedTab()202        XCTAssertEqual(model.selectedTab?.url, site.url("/b"))203        XCTAssertTrue(model.recentlyClosed.isEmpty)204        // Closing the last tab leaves a fresh one rather than an empty screen.205        model.tabs.forEach(model.close)206        XCTAssertEqual(model.tabs.count, 1)207        XCTAssertTrue(model.selectedTab?.isBlank ?? false)208    }209210    func testSuggestionsComeFromLocalDataAndRespectPrivateMode() throws {211        environment.history.record(url: URL(string: "https://www.apple.com/mac/")!, title: "Mac - Apple")212        environment.bookmarks.add(title: "Apple Developer", url: "https://developer.apple.com/")213        environment.services.library.recordSearch("apple silicon benchmarks")214        let kinds = SuggestionBuilder.suggestions(for: "apple", model: model, environment: environment).map(\.kind)215        XCTAssertEqual(kinds.first, .search)216        XCTAssertTrue(kinds.contains(.pastSearch) && kinds.contains(.bookmark) && kinds.contains(.history))217        XCTAssertEqual(SuggestionBuilder.suggestions(for: "", model: model, environment: environment).map(\.title), ["apple silicon benchmarks"])218        XCTAssertEqual(SuggestionBuilder.suggestions(for: "apple.com", model: model, environment: environment).first?.kind, .address)219        model.newTab(isPrivate: true)220        let privateKinds = SuggestionBuilder.suggestions(for: "apple", model: model, environment: environment).map(\.kind)221        XCTAssertFalse(privateKinds.contains(.pastSearch) || privateKinds.contains(.history), "history-based suggestions are not shown in private tabs")222        XCTAssertTrue(SuggestionBuilder.suggestions(for: "", model: model, environment: environment).isEmpty)223    }224225    // MARK: AURA (3.0)226227    /// A link followed by the page itself (not typed by the user).228    private func follow(_ path: String, in tab: MobileTab) async throws {229        _ = try? await tab.webView?.evaluateJavaScript("location.href = '\(path)'")230        try await wait("link to \(path)") { self.settled(tab, at: self.site.url(path)) && self.environment.flow.trail.nodes.contains { $0.url == self.site.url(path).absoluteString } }231    }232233    func testFlowRecordsTypedLinkBackAndABranch() async throws {234        let tab = try XCTUnwrap(model.selectedTab)235        tab.load(site.url("/a"))236        try await wait("a") { self.settled(tab, at: self.site.url("/a")) }237        try await follow("/b", in: tab)238        tab.goBack()239        try await wait("back to a") { self.settled(tab, at: self.site.url("/a")) && self.environment.flow.trail.node(self.environment.flow.trail.cursor[tab.id])?.url == self.site.url("/a").absoluteString }240        try await follow("/c", in: tab)241242        let trail = environment.flow.trail243        XCTAssertEqual(trail.nodes.map(\.url), ["/a", "/b", "/c"].map { site.url($0).absoluteString }, "back did not add a step")244        let a = trail.nodes[0], b = trail.nodes[1], c = trail.nodes[2]245        XCTAssertNil(a.parentID, "a typed address starts a journey")246        XCTAssertEqual(b.parentID, a.id)247        XCTAssertEqual(c.parentID, a.id, "the other link is a second branch of the same page")248        XCTAssertEqual(trail.branchPoints.map(\.id), [a.id])249        XCTAssertEqual(trail.cursor[tab.id], c.id)250        XCTAssertGreaterThanOrEqual(a.visits, 2, "going back revisits the step")251        XCTAssertEqual(a.title, "Page /a")252        XCTAssertEqual(trail.journeys.count, 1)253        // The trail is on disk, and the model exposes it to the Flow map.254        XCTAssertEqual(FlowStore(url: environment.root.appendingPathComponent("flow.json")).trail.nodes.map(\.url), trail.nodes.map(\.url))255        XCTAssertEqual(model.flowTrail.nodes.count, 3)256        XCTAssertEqual(model.flowCursor, c.id)257258        // Turning Flow off stops the recording.259        environment.settings.flowEnabled = false260        tab.load(site.url("/d"))261        try await wait("d") { self.settled(tab, at: self.site.url("/d")) }262        XCTAssertEqual(environment.flow.trail.nodes.count, 3)263264        // Closing the tab releases its cursor; clearing history forgets the path.265        environment.settings.flowEnabled = true266        model.close(tab)267        XCTAssertNil(environment.flow.trail.cursor[tab.id])268        environment.clearHistory(since: nil)269        XCTAssertTrue(environment.flow.trail.nodes.isEmpty)270    }271272    func testPrivateFlowNeverReachesTheProfileOrTheDisk() async throws {273        let privateTab = model.newTab(isPrivate: true)274        privateTab.load(site.url("/secret"))275        try await wait("private page") { self.settled(privateTab, at: self.site.url("/secret")) }276        _ = try? await privateTab.webView?.evaluateJavaScript("location.href = '/secret2'")277        try await wait("private link") { self.settled(privateTab, at: self.site.url("/secret2")) && self.model.privateFlow.trail.nodes.count == 2 }278279        XCTAssertTrue(environment.flow.trail.nodes.isEmpty, "a private visit is not on the profile's path")280        XCTAssertEqual(model.privateFlow.trail.nodes.map(\.url), [site.url("/secret").absoluteString, site.url("/secret2").absoluteString])281        XCTAssertEqual(model.flowTrail.nodes.count, 2, "the Flow map of a private tab shows the in-memory path")282        let file = environment.root.appendingPathComponent("flow.json")283        let onDisk = (try? String(contentsOf: file, encoding: .utf8)) ?? ""284        XCTAssertFalse(onDisk.contains("secret"))285        let everything = (FileManager.default.enumerator(at: environment.root, includingPropertiesForKeys: nil)?.allObjects as? [URL] ?? [])286            .filter { ["json"].contains($0.pathExtension) }.compactMap { try? String(contentsOf: $0, encoding: .utf8) }.joined()287        XCTAssertFalse(everything.contains("secret"), "no JSON file of the profile mentions the private pages")288289        // Nothing private is offered to Canvas captures, Portal or the reading list.290        XCTAssertNil(model.canvasHost.capture)291        XCTAssertFalse(model.portalHost.canSend)292        model.sendTabs(to: nil)293        XCTAssertTrue(environment.services.mirror.records(SyncCollection.handoff).isEmpty)294295        let old = model.privateFlow296        model.close(privateTab)297        XCTAssertTrue(model.privateFlow !== old, "the private path dies with the private session")298        XCTAssertTrue(model.privateFlow.trail.nodes.isEmpty)299    }300301    func testOpenerSurvivesASessionRoundTripAndLinksTheFlow() async throws {302        let parent = try XCTUnwrap(model.selectedTab)303        parent.load(site.url("/parent"))304        try await wait("parent") { self.settled(parent, at: self.site.url("/parent")) }305        let child = model.newTab(url: site.url("/child"), after: parent)306        XCTAssertEqual(child.openerID, parent.id)307        XCTAssertEqual(model.tabs.map(\.id), [parent.id, child.id])308        try await wait("child") { self.settled(child, at: self.site.url("/child")) && self.environment.flow.trail.cursor[child.id] != nil }309        let trail = environment.flow.trail310        XCTAssertEqual(trail.node(trail.cursor[child.id])?.parentID, trail.cursor[parent.id], "the first page of a tab opened from another continues that tab's path")311        XCTAssertEqual(model.constellationItems.first { $0.id == child.id }?.parentID, parent.id)312313        let store = SessionStore(directory: environment.root.appendingPathComponent("Opener"))314        try store.save(SessionSnapshot(windows: [model.snapshot()]))315        guard case .loaded(let loaded) = store.load() else { return XCTFail("session not loaded") }316        let restored = BrowserModel(environment: environment)317        restored.restore(try XCTUnwrap(loaded.windows.first))318        XCTAssertEqual(restored.tabs.map(\.openerID), [nil, parent.id])319        restored.tabs.forEach { $0.tearDownWebView() }320    }321322    func testCommandExecutorFocusCanvasAndPrivateGating() async throws {323        let tab = try XCTUnwrap(model.selectedTab)324        // Only the iOS subset of the catalog runs here.325        XCTAssertFalse(model.isEnabled(.newWindow))326        XCTAssertFalse(model.isEnabled(.toggleSplitView))327        model.perform(.toggleSplitView)328        XCTAssertFalse(model.isEnabled(.addToCanvas), "nothing to add from the start page")329        model.perform(.addToCanvas)330        XCTAssertTrue(environment.canvas.boards.allSatisfy { $0.cards.isEmpty })331332        // Focus Mode hides confirmations but never errors.333        XCTAssertFalse(model.focusMode)334        model.perform(.toggleFocusMode)335        XCTAssertTrue(model.focusMode)336        model.toast = "Link copied"337        XCTAssertNil(model.toast)338        model.toast = "The image could not be saved"339        XCTAssertEqual(model.toast, "The image could not be saved")340        environment.settings.focusHidesDistractions = false341        model.toast = "Link copied"342        XCTAssertEqual(model.toast, "Link copied")343        model.perform(.toggleFocusMode)344        XCTAssertFalse(model.focusMode)345        model.toast = nil346347        tab.load(site.url("/page"))348        try await wait("page") { self.settled(tab, at: self.site.url("/page")) && tab.title == "Page /page" }349        XCTAssertTrue(model.isEnabled(.addToCanvas))350        model.perform(.addToCanvas)351        let board = try XCTUnwrap(environment.canvas.boards.first)352        XCTAssertEqual(board.cards.map(\.url), [site.url("/page").absoluteString])353        XCTAssertEqual(board.cards.first?.title, "Page /page")354        XCTAssertEqual(board.cards.first?.kind, .tab)355        XCTAssertNotNil(model.toast)356        XCTAssertNotNil(CanvasStore(directory: environment.root.appendingPathComponent("Canvas")).board(board.id), "the board is saved in Canvas/")357358        // Surfaces open through commands.359        model.perform(.showFlow)360        XCTAssertEqual(model.auraSurface, .flow)361        model.perform(.showCanvas)362        XCTAssertEqual(model.auraSurface, .canvas)363        model.perform(.commandOrbit)364        XCTAssertTrue(model.showsOrbit)365        model.orbitHandOver("fl")366        XCTAssertTrue(model.showsPalette && !model.showsOrbit)367        model.dismissAura()368        XCTAssertNil(model.auraSurface)369        XCTAssertFalse(model.showsPalette)370        XCTAssertEqual(OrbitCatalog.ring(for: model.orbitContext).first, .openLocation)371        XCTAssertTrue(OrbitCatalog.ring(for: model.orbitContext).allSatisfy(OrbitCatalog.supported(on: model.platform).contains))372373        // Regular tab: Portal and the reading list are available. Private tab: neither.374        XCTAssertTrue(model.isEnabled(.showPortal))375        XCTAssertTrue(model.isEnabled(.addToReadingList))376        let privateTab = model.newTab(isPrivate: true)377        privateTab.load(site.url("/secret"))378        try await wait("private page") { self.settled(privateTab, at: self.site.url("/secret")) }379        XCTAssertFalse(model.isEnabled(.showPortal))380        XCTAssertFalse(model.isEnabled(.addToReadingList))381        XCTAssertFalse(model.isEnabled(.toggleFavorite))382        model.perform(.showPortal)383        XCTAssertNil(model.auraSurface)384        model.perform(.addToReadingList)385        XCTAssertTrue(environment.services.library.readingList().isEmpty)386    }387388    func testReaderExtractsAnArticleInTheIsolatedWorld() async throws {389        let tab = try XCTUnwrap(model.selectedTab)390        tab.load(site.url("/article/fox"))391        try await wait("article") { self.settled(tab, at: self.site.url("/article/fox")) }392        XCTAssertTrue(model.isEnabled(.toggleReader))393        let shown = await tab.toggleReader()394        XCTAssertTrue(shown)395        let article = try XCTUnwrap(tab.readerArticle)396        XCTAssertEqual(article.title, "Page /article/fox")397        XCTAssertEqual(article.blocks.filter { $0.kind == "p" }.count, 4)398        XCTAssertTrue(article.blocks.contains { $0.kind == "h2" && $0.text == "First part" })399        XCTAssertTrue(article.blocks.contains { $0.kind == "quote" })400        XCTAssertFalse(article.blocks.contains { $0.text.contains("Menu that the reader must skip") })401        XCTAssertTrue(article.isReadable)402        // The script ran in the browser's own world: the page's world has no trace of it.403        let leaked = try await tab.webView?.evaluateJavaScript("typeof candidates !== 'undefined' || typeof window.__spbAura !== 'undefined'") as? Bool404        XCTAssertEqual(leaked, false)405        let hidden = await tab.toggleReader()406        XCTAssertTrue(hidden)407        XCTAssertNil(tab.readerArticle)408409        // A page without an article has no reader, and navigating leaves it.410        tab.load(site.url("/short"))411        try await wait("short page") { self.settled(tab, at: self.site.url("/short")) }412        let none = await tab.toggleReader()413        XCTAssertFalse(none)414        XCTAssertNil(tab.readerArticle)415    }416417    func testDownloadDestinationsAreSafeAndUnique() throws {418        let downloads = environment.downloads419        let first = downloads.destination(for: "../../etc/passwd")420        XCTAssertEqual(first.deletingLastPathComponent().standardizedFileURL, downloads.directory.standardizedFileURL)421        try Data("x".utf8).write(to: downloads.destination(for: "report.pdf"))422        XCTAssertEqual(downloads.destination(for: "report.pdf").lastPathComponent, "report 2.pdf")423    }424}425
Files main
Menu

Theme