|
| 1 | +# Test Plan: Java Dependency — File Operations |
| 2 | +# |
| 3 | +# Covers fileOperations.test.ts scenarios: |
| 4 | +# - create new Java class |
| 5 | +# - create new package |
| 6 | +# - rename Java file |
| 7 | +# - delete Java file |
| 8 | +# |
| 9 | +# Note: The workspace is auto-copied to a temp directory by autotest, |
| 10 | +# so rename/delete operations don't pollute the source test fixtures. |
| 11 | +# |
| 12 | +# Usage: |
| 13 | +# npx autotest run test/e2e-plans/java-dep-file-operations.yaml --vsix <path-to-vsix> |
| 14 | + |
| 15 | +name: "Java Dependency — File Operations" |
| 16 | +description: | |
| 17 | + Tests file/resource operations in the Java Projects view: |
| 18 | + create class, create package, rename file, delete file. |
| 19 | + Replaces test/e2e/tests/fileOperations.test.ts. |
| 20 | +
|
| 21 | +setup: |
| 22 | + extension: "redhat.java" |
| 23 | + vscodeVersion: "stable" |
| 24 | + workspace: "../maven" |
| 25 | + timeout: 180 |
| 26 | + settings: |
| 27 | + java.configuration.checkProjectSettingsExclusions: false |
| 28 | + |
| 29 | +steps: |
| 30 | + # ── Setup: wait for LS, focus Java Projects ── |
| 31 | + - id: "ls-ready" |
| 32 | + action: "waitForLanguageServer" |
| 33 | + verify: "Java Language Server is ready" |
| 34 | + timeout: 180 |
| 35 | + |
| 36 | + - id: "focus-java-projects" |
| 37 | + action: "run command Java Projects: Focus on Java Projects View" |
| 38 | + verify: "Java Projects view is focused" |
| 39 | + |
| 40 | + - id: "wait-tree-load" |
| 41 | + action: "wait 3 seconds" |
| 42 | + |
| 43 | + # ── Test 1: create new Java class ── |
| 44 | + - id: "click-project-node" |
| 45 | + action: "click my-app tree item" |
| 46 | + |
| 47 | + - id: "trigger-new-resource" |
| 48 | + action: "clickTreeItemAction my-app New..." |
| 49 | + verify: "New resource quick pick opened" |
| 50 | + |
| 51 | + - id: "select-java-class" |
| 52 | + action: "selectOptionByIndex 0" |
| 53 | + verify: "Java Class selected" |
| 54 | + |
| 55 | + - id: "select-source-folder" |
| 56 | + action: "select src/main/java option" |
| 57 | + verify: "Source folder selected" |
| 58 | + |
| 59 | + - id: "enter-class-name" |
| 60 | + action: "fillQuickInput App2" |
| 61 | + verify: "Class name entered" |
| 62 | + |
| 63 | + - id: "verify-new-class-tab" |
| 64 | + action: "wait 2 seconds" |
| 65 | + verify: "Editor tab App2.java should appear" |
| 66 | + verifyEditorTab: |
| 67 | + title: "App2.java" |
| 68 | + timeout: 15 |
| 69 | + |
| 70 | + # ── Test 2: create new package ── |
| 71 | + - id: "focus-java-projects-2" |
| 72 | + action: "run command Java Projects: Focus on Java Projects View" |
| 73 | + |
| 74 | + - id: "click-project-node-2" |
| 75 | + action: "click my-app tree item" |
| 76 | + |
| 77 | + - id: "trigger-new-resource-2" |
| 78 | + action: "clickTreeItemAction my-app New..." |
| 79 | + |
| 80 | + - id: "select-package" |
| 81 | + action: "select Package option" |
| 82 | + verify: "Package selected" |
| 83 | + |
| 84 | + - id: "select-source-folder-2" |
| 85 | + action: "select src/main/java option" |
| 86 | + |
| 87 | + - id: "enter-package-name" |
| 88 | + action: "fillQuickInput com.mycompany.newpkg" |
| 89 | + verify: "Package name entered" |
| 90 | + |
| 91 | + - id: "wait-package-creation" |
| 92 | + action: "wait 3 seconds" |
| 93 | + verify: "Package directory created" |
| 94 | + |
| 95 | + # ── Test 3: rename Java file ── |
| 96 | + # Open the target file, let link-with-editor reveal it in the tree, |
| 97 | + # then click to select it and trigger rename via context menu. |
| 98 | + - id: "open-rename-target" |
| 99 | + action: "open file AppToRename.java" |
| 100 | + waitBefore: 3 |
| 101 | + |
| 102 | + - id: "focus-java-projects-3" |
| 103 | + action: "run command Java Projects: Focus on Java Projects View" |
| 104 | + waitBefore: 3 |
| 105 | + |
| 106 | + # Click the tree item first to select it |
| 107 | + - id: "select-rename-target" |
| 108 | + action: "click AppToRename tree item" |
| 109 | + waitBefore: 2 |
| 110 | + |
| 111 | + # Use context menu to trigger extension's rename (shows showInputBox) |
| 112 | + - id: "rename-context-menu" |
| 113 | + action: "contextMenu AppToRename Rename" |
| 114 | + verify: "Rename input box opened" |
| 115 | + |
| 116 | + - id: "enter-new-name" |
| 117 | + action: "fillAnyInput AppRenamed" |
| 118 | + verify: "New name entered and confirmed" |
| 119 | + waitBefore: 2 |
| 120 | + |
| 121 | + # Handle optional rename confirmation dialog — may not appear on all platforms |
| 122 | + # (Electron native dialog is auto-dismissed by monkey-patch) |
| 123 | + - id: "handle-rename-dialog" |
| 124 | + action: "confirmDialog" |
| 125 | + verify: "Rename confirmation handled (if present)" |
| 126 | + |
| 127 | + # Handle optional Refactor Preview panel |
| 128 | + - id: "handle-refactor-preview" |
| 129 | + action: "tryClickButton Apply" |
| 130 | + verify: "Refactor preview applied (if present)" |
| 131 | + |
| 132 | + - id: "wait-rename" |
| 133 | + action: "wait 3 seconds" |
| 134 | + |
| 135 | + - id: "verify-renamed-tab" |
| 136 | + action: "wait 1 seconds" |
| 137 | + verify: "Editor tab AppRenamed should appear" |
| 138 | + verifyEditorTab: |
| 139 | + title: "AppRenamed" |
| 140 | + timeout: 15 |
| 141 | + |
| 142 | + # ── Test 4: delete Java file ── |
| 143 | + # Instead of manually expanding the tree (which requires viewport space), |
| 144 | + # open the file and let link-with-editor reveal it in the tree. |
| 145 | + - id: "open-delete-target" |
| 146 | + action: "open file AppToDelete.java" |
| 147 | + waitBefore: 5 |
| 148 | + |
| 149 | + - id: "focus-java-projects-4" |
| 150 | + action: "run command Java Projects: Focus on Java Projects View" |
| 151 | + waitBefore: 2 |
| 152 | + |
| 153 | + - id: "delete-context-menu" |
| 154 | + action: "contextMenu AppToDelete Delete" |
| 155 | + verify: "Delete confirmation triggered" |
| 156 | + |
| 157 | + # VSCode shows a platform-specific confirmation dialog for delete |
| 158 | + - id: "confirm-delete" |
| 159 | + action: "confirmDialog" |
| 160 | + |
| 161 | + - id: "wait-delete" |
| 162 | + action: "wait 3 seconds" |
| 163 | + |
| 164 | + - id: "verify-deleted" |
| 165 | + action: "wait 1 seconds" |
| 166 | + verify: "AppToDelete tree item should disappear" |
| 167 | + verifyTreeItem: |
| 168 | + name: "AppToDelete" |
| 169 | + visible: false |
| 170 | + timeout: 15 |
0 commit comments