@@ -39,6 +39,27 @@ final class ProjectNavigatorUITests: XCTestCase {
3939 XCTAssertTrue ( readmeEditor . exists )
4040 XCTAssertNotNil ( readmeEditor . value as? String )
4141
42+ let cursorPositionLabel = window . staticTexts [ " CursorPositionLabel " ]
43+ XCTAssertTrue ( cursorPositionLabel . waitForExistence ( timeout : 2.0 ) , " Cursor position label not found " )
44+ assertResolvedCursorPosition ( cursorPositionLabel )
45+
46+ let licenseRow = Query . Navigator . getProjectNavigatorRow ( fileTitle : " LICENSE.md " , navigator )
47+ XCTAssertFalse ( Query . Navigator . rowContainsDisclosureIndicator ( licenseRow ) , " File has disclosure indicator " )
48+ licenseRow . click ( )
49+
50+ let licenseTab = Query . TabBar . getTab ( labeled : " LICENSE.md " , tabBar )
51+ XCTAssertTrue ( licenseTab . exists )
52+
53+ let licenseEditor = Query . Window . getFirstEditor ( window )
54+ let licenseContent = NSPredicate ( format : " value CONTAINS %@ " , " MIT License " )
55+ expectation ( for : licenseContent , evaluatedWith : licenseEditor )
56+ waitForExpectations ( timeout : 2.0 )
57+
58+ assertResolvedCursorPosition ( cursorPositionLabel )
59+ assertCursorPositionChanges ( cursorPositionLabel ) {
60+ licenseEditor . coordinate ( withNormalizedOffset : CGVector ( dx : 0.75 , dy : 0.75 ) ) . click ( )
61+ }
62+
4263 let rowCount = navigator . descendants ( matching : . outlineRow ) . count
4364
4465 // Open a folder
@@ -59,4 +80,32 @@ final class ProjectNavigatorUITests: XCTestCase {
5980 XCTAssertTrue ( newRowCount > finalRowCount , " Rows were not hidden after closing a folder " )
6081 XCTAssertEqual ( rowCount , finalRowCount , " Different Number of rows loaded " )
6182 }
83+
84+ private func assertResolvedCursorPosition ( _ cursorPositionLabel : XCUIElement ) {
85+ let resolvedCursorPosition = NSPredicate (
86+ format : " value CONTAINS %@ AND NOT value CONTAINS %@ " ,
87+ " Line: " ,
88+ " -1 "
89+ )
90+ expectation ( for : resolvedCursorPosition , evaluatedWith : cursorPositionLabel )
91+ waitForExpectations ( timeout : 2.0 )
92+ }
93+
94+ private func assertCursorPositionChanges ( _ cursorPositionLabel : XCUIElement , after action : ( ) -> Void ) {
95+ guard let originalValue = cursorPositionLabel . value as? String else {
96+ XCTFail ( " Cursor position label value not found " )
97+ return
98+ }
99+
100+ action ( )
101+
102+ let updatedCursorPosition = NSPredicate (
103+ format : " value CONTAINS %@ AND NOT value CONTAINS %@ AND value != %@ " ,
104+ " Line: " ,
105+ " -1 " ,
106+ originalValue
107+ )
108+ expectation ( for : updatedCursorPosition , evaluatedWith : cursorPositionLabel )
109+ waitForExpectations ( timeout : 2.0 )
110+ }
62111}
0 commit comments