Skip to content

Commit faf9ac4

Browse files
wenytang-msCopilot
andcommitted
test: phase A coverage — newJavaRecord, clean.workspace, project.update
Adds three more vscode-java-dependency commands to the E2E plans, each exercised through its documented user-visible UI surface: * java-dep-new-types.yaml - Adds a 7th cycle for newJavaRecord between Annotation and Abstract Class. The Record option is filtered out for projects below Java 16 (see JavaType.getDisplayNames in src/explorerCommands/new.ts); the fixture pom.xml is Java 17 so the option renders. Plan goes from 64 → 75 steps. * java-dep-build-lifecycle.yaml - Adds Test 6: java.project.update via the Maven submenu on the project context menu (the command's only UI mount — no palette, no toolbar). Uses the new 'contextMenuSubmenu' autotest action that hovers a submenu trigger then clicks a leaf inside the nested menu. - Adds Test 7: java.project.clean.workspace via the view-title overflow menu. The command may or may not raise a confirmation dialog depending on JDT.LS state; we use the tolerant tryClickDialogButton variant so the step passes either way (cancelling the dialog if shown, avoiding the destructive VS Code reload). Plan goes from 18 → 26 steps. Requires @vscjava/vscode-autotest >= 0.7.11 (adds contextMenuSubmenu). Locally verified: java-dep-new-types.yaml 75/75 passing java-dep-build-lifecycle.yaml 26/26 passing Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8b89050 commit faf9ac4

2 files changed

Lines changed: 111 additions & 23 deletions

File tree

test/e2e-plans/java-dep-build-lifecycle.yaml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
# - java.project.build.project (Build Project — project context menu)
1313
# - java.project.rebuild (Rebuild Project — project context menu)
1414
# - java.project.reloadProjectFromActiveFile (Reload Project — pom.xml editor title)
15-
#
16-
# Note: java.project.clean.workspace is intentionally omitted from this plan
17-
# because the JDT.LS clean command triggers a VS Code window reload, which
18-
# tears down the autotest browser session.
15+
# - java.project.update (Reload Project — Maven submenu on project context menu)
16+
# - java.project.clean.workspace (Clean Workspace — view-title overflow; dialog cancelled to avoid VS Code reload)
1917
#
2018
# Verification strategy
2119
# ─────────────────────
@@ -165,3 +163,51 @@ steps:
165163
- id: "wait-reload-project"
166164
action: "waitForLanguageServer"
167165
timeout: 180
166+
167+
# ── Test 6: Reload Project (Maven submenu on project context menu) ──
168+
# `java.project.update` lives in the `javaProject.maven` submenu under the
169+
# project context menu's `9_configuration@10` group. Real users right-click
170+
# the Maven project node → hover the "Maven" submenu → click "Reload
171+
# Project". This is the only UI surface for this command (no command
172+
# palette entry, no toolbar button).
173+
- id: "close-pom-editors"
174+
action: "run command View: Close All Editors"
175+
176+
- id: "focus-java-projects-reload"
177+
action: "executeVSCodeCommand javaProjectExplorer.focus"
178+
waitBefore: 1
179+
180+
- id: "click-project-update"
181+
action: "click my-app tree item"
182+
waitBefore: 1
183+
184+
- id: "context-update-maven"
185+
action: 'contextMenuSubmenu my-app Maven "Reload Project"'
186+
187+
- id: "wait-update-project"
188+
action: "waitForLanguageServer"
189+
timeout: 180
190+
191+
# ── Test 7: Clean Workspace (overflow menu, dialog cancelled if shown) ──
192+
# `java.project.clean.workspace` is contributed to the Java Projects view
193+
# title-bar `overflow_20@10` group. When clicked it forwards to JDT.LS's
194+
# `java.clean.workspace`. Depending on the redhat.java / JDT.LS version
195+
# this may or may not raise a modal warning dialog ("…delete workspace
196+
# cache and restart?") before doing the work. We use a *tolerant* dialog
197+
# cancel (`tryClickDialogButton`) so the step passes whether or not the
198+
# dialog appears — when it does appear we cancel to avoid the destructive
199+
# VS Code reload; when it does not we proceed straight to the LS settle
200+
# check. The primary coverage signal is the overflow-menu mount + click,
201+
# which `trigger-clean-workspace` already exercises with a deterministic
202+
# `clickViewTitleAction`.
203+
- id: "trigger-clean-workspace"
204+
action: 'clickViewTitleAction "Java Projects" "Clean Workspace"'
205+
206+
- id: "cancel-clean-dialog"
207+
action: "tryClickDialogButton Cancel"
208+
# No `verify:` — tolerant action: clicks Cancel if dialog appears, else
209+
# silently no-ops. `trigger-clean-workspace` is the deterministic signal.
210+
211+
- id: "wait-clean-settle"
212+
action: "waitForLanguageServer"
213+
timeout: 60

test/e2e-plans/java-dep-new-types.yaml

Lines changed: 61 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Commands exercised (each invoked through the New... quick-pick on a node):
88
# - java.view.package.newJavaInterface (Interface)
99
# - java.view.package.newJavaEnum (Enum)
10+
# - java.view.package.newJavaRecord (Record — requires Java 16+)
1011
# - java.view.package.newJavaAnnotation (Annotation)
1112
# - java.view.package.newJavaAbstractClass (Abstract Class)
1213
# - java.view.package.newFile ("File" option)
@@ -31,7 +32,7 @@ name: "Java Dependency — New File Types"
3132
description: |
3233
Tests all the "New ..." quick-pick options in the Java Projects view that
3334
are not already covered by java-dep-file-operations.yaml:
34-
Interface / Enum / Annotation / Abstract Class / File / Folder.
35+
Interface / Enum / Record / Annotation / Abstract Class / File / Folder.
3536
3637
setup:
3738
extension: "redhat.java"
@@ -190,27 +191,29 @@ steps:
190191
action: "executeVSCodeCommand javaProjectExplorer.focus"
191192
waitBefore: 1
192193

193-
# ── Test 4: New Abstract Class ──
194+
# ── Test 4: New Record (Java 16+; fixture pom uses Java 17) ──
195+
# The Record option is only shown when the project source level is >= 16,
196+
# see JavaType.getDisplayNames(..., includeRecord) in src/explorerCommands/new.ts.
194197
- id: "click-project-4"
195198
action: "click my-app tree item"
196199
waitBefore: 1
197200

198201
- id: "trigger-new-4"
199202
action: "clickTreeItemAction my-app New..."
200203

201-
- id: "select-abstract-class"
202-
action: "select Abstract Class option"
204+
- id: "select-record"
205+
action: "select Record option"
203206

204207
- id: "select-source-folder-4"
205208
action: "select src/main/java option"
206209

207-
- id: "enter-abstract-name"
208-
action: "fillQuickInput MyAbstract"
210+
- id: "enter-record-name"
211+
action: "fillQuickInput MyRecord"
209212

210-
- id: "verify-abstract-tab"
213+
- id: "verify-record-tab"
211214
action: "wait 2 seconds"
212215
verifyEditorTab:
213-
title: "MyAbstract.java"
216+
title: "MyRecord.java"
214217
timeout: 20
215218

216219
- id: "save-4"
@@ -229,16 +232,55 @@ steps:
229232
action: "executeVSCodeCommand javaProjectExplorer.focus"
230233
waitBefore: 1
231234

232-
# ── Test 5: New File (plain non-Java file via "File" option) ──
233-
# The "File" entry routes to `java.view.package.newFile` and writes the
234-
# file under the project root (the node we triggered from).
235+
# ── Test 5: New Abstract Class ──
235236
- id: "click-project-5"
236237
action: "click my-app tree item"
237238
waitBefore: 1
238239

239240
- id: "trigger-new-5"
240241
action: "clickTreeItemAction my-app New..."
241242

243+
- id: "select-abstract-class"
244+
action: "select Abstract Class option"
245+
246+
- id: "select-source-folder-5"
247+
action: "select src/main/java option"
248+
249+
- id: "enter-abstract-name"
250+
action: "fillQuickInput MyAbstract"
251+
252+
- id: "verify-abstract-tab"
253+
action: "wait 2 seconds"
254+
verifyEditorTab:
255+
title: "MyAbstract.java"
256+
timeout: 20
257+
258+
- id: "save-5"
259+
action: "executeVSCodeCommand workbench.action.files.saveAll"
260+
261+
- id: "close-editors-5"
262+
action: "run command View: Close All Editors"
263+
264+
- id: "collapse-tree-5"
265+
action: 'clickViewTitleAction "Java Projects" "Collapse All"'
266+
267+
- id: "collapse-workspace-root-6"
268+
action: "collapseWorkspaceRoot"
269+
270+
- id: "focus-java-projects-6"
271+
action: "executeVSCodeCommand javaProjectExplorer.focus"
272+
waitBefore: 1
273+
274+
# ── Test 6: New File (plain non-Java file via "File" option) ──
275+
# The "File" entry routes to `java.view.package.newFile` and writes the
276+
# file under the project root (the node we triggered from).
277+
- id: "click-project-6"
278+
action: "click my-app tree item"
279+
waitBefore: 1
280+
281+
- id: "trigger-new-6"
282+
action: "clickTreeItemAction my-app New..."
283+
242284
- id: "select-file"
243285
action: "select File option"
244286

@@ -251,30 +293,30 @@ steps:
251293
title: "notes.txt"
252294
timeout: 20
253295

254-
- id: "save-5"
296+
- id: "save-6"
255297
action: "executeVSCodeCommand workbench.action.files.saveAll"
256298

257-
- id: "close-editors-5"
299+
- id: "close-editors-6"
258300
action: "run command View: Close All Editors"
259301

260-
- id: "collapse-tree-5"
302+
- id: "collapse-tree-6"
261303
action: 'clickViewTitleAction "Java Projects" "Collapse All"'
262304

263-
- id: "collapse-workspace-root-6"
305+
- id: "collapse-workspace-root-7"
264306
action: "collapseWorkspaceRoot"
265307

266-
- id: "focus-java-projects-6"
308+
- id: "focus-java-projects-7"
267309
action: "executeVSCodeCommand javaProjectExplorer.focus"
268310
waitBefore: 1
269311

270-
# ── Test 6: New Folder ──
312+
# ── Test 7: New Folder ──
271313
# Folder creation has no editor side-effect — verify by checking the new
272314
# folder exists on disk under the workspace root.
273-
- id: "click-project-6"
315+
- id: "click-project-7"
274316
action: "click my-app tree item"
275317
waitBefore: 1
276318

277-
- id: "trigger-new-6"
319+
- id: "trigger-new-7"
278320
action: "clickTreeItemAction my-app New..."
279321

280322
- id: "select-folder"

0 commit comments

Comments
 (0)