@@ -52,6 +52,29 @@ final class NativeFileWindowMenuUITests: PineUITestCase {
5252 ) == . completed
5353 }
5454
55+ /// Polls for the first hittable text field within `timeout`.
56+ ///
57+ /// `NSOpenPanel`'s "Go to Folder" sheet animates its path field in
58+ /// asynchronously, and `app.typeKey` can race the field's appearance on
59+ /// CI runners. Polling avoids `XCTUnwrap` failing fast before the sheet is
60+ /// fully interactive (stabilizes #1291, #1295).
61+ private func firstHittableTextField(
62+ timeout: TimeInterval
63+ ) -> XCUIElement ? {
64+ let deadline = Date ( ) . addingTimeInterval ( timeout)
65+ while Date ( ) < deadline {
66+ if let field = app. textFields. allElementsBoundByIndex. first (
67+ where: { $0. isHittable }
68+ ) {
69+ return field
70+ }
71+ Thread . sleep ( forTimeInterval: 0.2 )
72+ }
73+ return app. textFields. allElementsBoundByIndex. first {
74+ $0. isHittable
75+ }
76+ }
77+
5578 override func setUpWithError( ) throws {
5679 try super. setUpWithError ( )
5780 projectURL = try createTempProject (
@@ -264,11 +287,22 @@ final class NativeFileWindowMenuUITests: PineUITestCase {
264287 " Open Folder should present a directory picker "
265288 )
266289
267- app. typeKey ( " g " , modifierFlags: [ . command, . shift] )
290+ // Wait for the open panel to become interactive (it animates in),
291+ // then route Cmd+Shift+G to the sheet itself so the "Go to Folder"
292+ // path field reliably appears. Sending the shortcut to `app` can race
293+ // the panel gaining first-responder on CI (#1291, #1295).
294+ _ = XCTWaiter . wait (
295+ for: [
296+ XCTNSPredicateExpectation (
297+ predicate: NSPredicate ( format: " isHittable == true " ) ,
298+ object: openPanel
299+ )
300+ ] ,
301+ timeout: 5
302+ )
303+ openPanel. typeKey ( " g " , modifierFlags: [ . command, . shift] )
268304 let pathField = try XCTUnwrap (
269- app. textFields. allElementsBoundByIndex. first ( where: {
270- $0. isHittable
271- } ) ,
305+ firstHittableTextField ( timeout: 5 ) ,
272306 " Go to Folder should expose a hittable path field "
273307 )
274308 pathField. typeText ( secondProjectURL. path)
@@ -341,4 +375,19 @@ final class NativeFileWindowMenuUITests: PineUITestCase {
341375 " Clear Menu should disable an empty Open Recent submenu "
342376 )
343377 }
378+
379+ func testFileMenuContainsActionsNotEditorPreferences( ) throws {
380+ launchWithProject ( projectURL)
381+ XCTAssertTrue (
382+ waitForExistence ( app. scrollViews [ " sidebar " ] , timeout: 10 )
383+ )
384+
385+ clickMenuBarItem ( " File " )
386+
387+ XCTAssertFalse ( app. menuItems [ " Auto Save " ] . exists)
388+ XCTAssertFalse ( app. menuItems [ " Format on Save " ] . exists)
389+ XCTAssertFalse ( app. menuItems [ " Smart List Continuation " ] . exists)
390+ XCTAssertTrue ( app. menuItems [ " Save " ] . exists)
391+ XCTAssertTrue ( app. menuItems [ " Save As… " ] . exists)
392+ }
344393}
0 commit comments