Skip to content

Commit a854487

Browse files
committed
Address Project Navigator UI test review feedback
1 parent 98d9f5a commit a854487

3 files changed

Lines changed: 25 additions & 12 deletions

File tree

CodeEdit/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
8080
let url = baseURL.appending(path: id)
8181

8282
do {
83-
if FileManager.default.fileExists(atPath: baseURL.path(percentEncoded: false)) {
84-
try FileManager.default.removeItem(at: baseURL)
83+
if FileManager.default.fileExists(atPath: url.path(percentEncoded: false)) {
84+
try FileManager.default.removeItem(at: url)
8585
}
8686
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)
8787
} catch {

CodeEditUITests/ProjectPath.swift

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,28 @@ func appWritableTempProjectID() -> String {
4141
}
4242

4343
func cleanUpTempProjectPaths() throws {
44+
let fileManager = FileManager.default
4445
let baseDir = FileManager.default.temporaryDirectory.appending(path: "CodeEditUITests")
45-
try FileManager.default.removeItem(at: baseDir)
46-
tempProjectPathIds.removeAll()
46+
var cleanupError: Error?
47+
var remainingIDs = Set<String>()
48+
49+
for id in tempProjectPathIds {
50+
let path = baseDir.appending(path: id)
51+
guard fileManager.fileExists(atPath: path.path(percentEncoded: false)) else {
52+
continue
53+
}
54+
55+
do {
56+
try fileManager.removeItem(at: path)
57+
} catch {
58+
cleanupError = cleanupError ?? error
59+
remainingIDs.insert(id)
60+
}
61+
}
62+
63+
tempProjectPathIds = remainingIDs
64+
65+
if let cleanupError {
66+
throw cleanupError
67+
}
4768
}

CodeEditUITests/Query.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,6 @@ enum Query {
5757
}
5858

5959
static func getAddButton(_ window: XCUIElement) -> XCUIElement {
60-
if window.buttons["addButton"].exists {
61-
return window.buttons["addButton"]
62-
}
63-
64-
if window.popUpButtons["addButton"].exists {
65-
return window.popUpButtons["addButton"]
66-
}
67-
6860
return window.descendants(matching: .any).matching(identifier: "addButton").firstMatch
6961
}
7062

0 commit comments

Comments
 (0)