@@ -69,19 +69,27 @@ test.describe("File Operations", () => {
6969 // Expand to AppToRename
7070 await JavaOperator . expandTreePath ( page , "my-app" , "src/main/java" , "com.mycompany.app" ) ;
7171
72- // Click AppToRename and open context menu
72+ // Select AppToRename and trigger rename via F2
7373 const appToRename = page . getByRole ( VSCode . TREE_ITEM_ROLE , { name : "AppToRename" } ) . first ( ) ;
7474 await appToRename . click ( ) ;
75- await appToRename . click ( { button : "right" } ) ;
7675 await page . waitForTimeout ( Timeout . CLICK ) ;
77-
78- // Click Rename in context menu
79- const renameItem = page . locator ( ".context-view .action-item a.action-label" , { hasText : "Rename" } ) ;
80- await renameItem . click ( ) ;
76+ await page . keyboard . press ( "F2" ) ;
8177 await page . waitForTimeout ( Timeout . CLICK ) ;
8278
83- // Fill in new name
84- await VscodeOperator . fillQuickInput ( page , "AppRenamed" ) ;
79+ // VS Code may show either a quick-input dialog or an inline rename editor.
80+ // Try the inline rename input first (common in modern VS Code).
81+ const inlineInput = page . locator ( ".monaco-inputbox input.rename-input" ) ;
82+ const quickInput = page . locator ( ".quick-input-widget input.input" ) ;
83+
84+ if ( await inlineInput . isVisible ( { timeout : 3_000 } ) . catch ( ( ) => false ) ) {
85+ await inlineInput . fill ( "AppRenamed" ) ;
86+ await inlineInput . press ( VSCode . ENTER ) ;
87+ } else if ( await quickInput . isVisible ( { timeout : 3_000 } ) . catch ( ( ) => false ) ) {
88+ await quickInput . fill ( "AppRenamed" ) ;
89+ await quickInput . press ( VSCode . ENTER ) ;
90+ }
91+
92+ await page . waitForTimeout ( Timeout . CLICK ) ;
8593
8694 // Handle confirmation dialog if it appears
8795 try {
@@ -93,33 +101,25 @@ test.describe("File Operations", () => {
93101 // Editor should open with renamed file
94102 const tabFound = await VscodeOperator . waitForEditorTab ( page , "AppRenamed.java" ) ;
95103 expect ( tabFound ) . toBeTruthy ( ) ;
96-
97- // Save via command to avoid focus issues
98- await VscodeOperator . saveActiveEditor ( page ) ;
99104 } ) ;
100105
101106 test ( "delete Java file" , async ( { page } ) => {
102107 await JavaOperator . collapseFileExplorer ( page ) ;
103108 await JavaOperator . expandTreePath ( page , "my-app" , "src/main/java" , "com.mycompany.app" ) ;
104109
110+ // Select AppToDelete and press Delete key
105111 const appToDelete = page . getByRole ( VSCode . TREE_ITEM_ROLE , { name : "AppToDelete" } ) . first ( ) ;
106112 await appToDelete . click ( ) ;
107- await appToDelete . click ( { button : "right" } ) ;
108113 await page . waitForTimeout ( Timeout . CLICK ) ;
109-
110- // Click Delete or "Delete Permanently"
111- const deleteItem = page . locator ( ".context-view .action-item a.action-label" )
112- . filter ( { hasText : / ^ D e l e t e / } ) ;
113- await deleteItem . first ( ) . click ( ) ;
114+ await page . keyboard . press ( "Delete" ) ;
114115 await page . waitForTimeout ( Timeout . CLICK ) ;
115116
116117 // Confirm deletion in dialog
117118 try {
118- // Try common button labels
119119 const dialog = page . locator ( ".monaco-dialog-box" ) ;
120120 await dialog . waitFor ( { state : "visible" , timeout : 5_000 } ) ;
121121 const confirmBtn = dialog . getByRole ( VSCode . BUTTON_ROLE )
122- . filter ( { hasText : / M o v e t o R e c y c l e B i n | D e l e t e | O K / } ) ;
122+ . filter ( { hasText : / M o v e t o T r a s h | M o v e t o R e c y c l e B i n | D e l e t e | O K / } ) ;
123123 await confirmBtn . first ( ) . click ( ) ;
124124 } catch {
125125 // Dialog may not appear
0 commit comments