Skip to content

Commit b8dd2b3

Browse files
authored
Merge branch 'main' into experiment/lsp-tool-selection-tuning
2 parents e0e8d14 + 8b89050 commit b8dd2b3

3 files changed

Lines changed: 685 additions & 0 deletions

File tree

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
# Test Plan: Java Dependency — Build Lifecycle
2+
#
3+
# Covers the project build / rebuild / reload commands contributed by
4+
# vscode-java-dependency. Each command is invoked through the documented
5+
# entry point (view title-bar action, overflow menu, project context menu,
6+
# or editor title-bar action) and verified by waiting for the Java Language
7+
# Server to return to the Ready state.
8+
#
9+
# Commands exercised:
10+
# - java.project.build.workspace (Build All — title-bar tools icon)
11+
# - java.project.rebuild.workspace (Rebuild All — overflow menu)
12+
# - java.project.build.project (Build Project — project context menu)
13+
# - java.project.rebuild (Rebuild Project — project context menu)
14+
# - 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.
19+
#
20+
# Verification strategy
21+
# ─────────────────────
22+
# Build commands have no visible editor side-effect — they trigger a
23+
# background compilation whose progress is reflected only in the status bar
24+
# (and briefly in the Java Language Server progress notifications). For each
25+
# build / rebuild, we run the command and then call `waitForLanguageServer`,
26+
# which polls the status bar until it returns to "Java: Ready" and the
27+
# post-Ready "Building - X%" phase has settled. A non-fatal command is
28+
# enough for the step to pass — the test asserts that the command does not
29+
# leave the LS hung or in an error state.
30+
#
31+
# Usage:
32+
# npx autotest run test/e2e-plans/java-dep-build-lifecycle.yaml --vsix <path-to-vsix>
33+
34+
name: "Java Dependency — Build Lifecycle"
35+
description: |
36+
Tests the build / rebuild / reload commands contributed by the Java
37+
Project Manager. Each command is verified by waiting for the Java
38+
Language Server to return to the Ready state after the command runs.
39+
40+
setup:
41+
extension: "redhat.java"
42+
vscodeVersion: "stable"
43+
workspace: "../maven"
44+
timeout: 240
45+
settings:
46+
java.configuration.checkProjectSettingsExclusions: false
47+
workbench.startupEditor: "none"
48+
49+
steps:
50+
# ── Setup ──
51+
- id: "ls-ready"
52+
action: "waitForLanguageServer"
53+
timeout: 180
54+
55+
- id: "close-aux-bar"
56+
action: "executeVSCodeCommand workbench.action.closeAuxiliaryBar"
57+
verify: "Auxiliary bar (Chat) closed"
58+
59+
# Collapse the MAVEN workspace-folder pane so JAVA PROJECTS gets the full
60+
# vertical space. OUTLINE and TIMELINE are collapsed by default in fresh
61+
# sessions, so no explicit step is needed.
62+
- id: "collapse-maven-pane"
63+
action: "collapseSidebarSection maven"
64+
65+
- id: "focus-java-projects"
66+
action: "executeVSCodeCommand javaProjectExplorer.focus"
67+
verify: "Java Projects view is focused"
68+
69+
- id: "wait-tree-load"
70+
action: "wait 3 seconds"
71+
72+
# ── Test 1: Build All (incremental) — Java Projects view title-bar button ──
73+
# The "Build All" toolbar action ($(tools) icon) is contributed under
74+
# view/title group navigation@30 in package.json. Clicking it through the
75+
# UI exercises the full button-rendering + when-clause + command-dispatch
76+
# chain — unlike executeVSCodeCommand, which would only hit the command
77+
# bus directly.
78+
- id: "trigger-build-all"
79+
action: 'clickViewTitleAction "Java Projects" "Build All"'
80+
81+
- id: "wait-build-all"
82+
action: "waitForLanguageServer"
83+
timeout: 120
84+
85+
# ── Test 2: Rebuild All (full compile) — Java Projects overflow menu ──
86+
# "Rebuild All" lives in view/title group overflow_20@5, so it is reached
87+
# via the "Views and More Actions..." (...) overflow menu. The
88+
# clickViewTitleAction helper automatically falls through from the direct
89+
# button path to the overflow menu when the action is not present in the
90+
# toolbar's navigation group.
91+
- id: "trigger-rebuild-all"
92+
action: 'clickViewTitleAction "Java Projects" "Rebuild All"'
93+
94+
- id: "wait-rebuild-all"
95+
action: "waitForLanguageServer"
96+
timeout: 180
97+
98+
# ── Test 3: Build Project (per-project, via context menu) ──
99+
# The `java.project.build.project` command requires a project URI, so it
100+
# is gated behind the project context-menu in package.json (8_execution@5
101+
# when viewItem matches /java:project.*\+java.*\+uri/). Invoke it via the
102+
# project node context menu — the menu surface that real users hit.
103+
- id: "click-project-build"
104+
action: "click my-app tree item"
105+
waitBefore: 1
106+
107+
- id: "context-build-project"
108+
action: "contextMenu my-app Build Project"
109+
# No `verify:` — context-menu click has no immediate visible effect
110+
# beyond closing the menu; waitForLanguageServer below is the ground
111+
# truth that the build executed and the LS settled.
112+
113+
- id: "wait-build-project"
114+
action: "waitForLanguageServer"
115+
timeout: 120
116+
117+
# ── Test 4: Rebuild Project (per-project, via context menu) ──
118+
- id: "click-project-rebuild"
119+
action: "click my-app tree item"
120+
waitBefore: 1
121+
122+
- id: "context-rebuild-project"
123+
action: "contextMenu my-app Rebuild Project"
124+
125+
- id: "wait-rebuild-project"
126+
action: "waitForLanguageServer"
127+
timeout: 180
128+
129+
# ── Test 5: Reload Project (editor title-bar action on pom.xml) ──
130+
# `java.project.reloadProjectFromActiveFile` is contributed in editor/title
131+
# group navigation when both `java:reloadProjectActive` and `javaLSReady`
132+
# are true. The `java:reloadProjectActive` key is only set after the
133+
# project file (pom.xml / build.gradle) has been modified — opening an
134+
# unchanged pom.xml is NOT enough to make the $(sync) button appear.
135+
#
136+
# To exercise the real UI flow:
137+
# 1. Open pom.xml.
138+
# 2. Type a space at the cursor → file becomes dirty.
139+
# 3. Save → JDT.LS detects the build file change and sets
140+
# `java:reloadProjectActive`, which renders the $(sync) "Reload
141+
# Java Project" button in the editor title bar.
142+
# 4. Click the title-bar button → reload kicks off.
143+
# 5. waitForLanguageServer confirms the reload completed.
144+
# 6. Undo + save restores pom.xml to its original content so the
145+
# fixture is left clean for subsequent runs.
146+
# ── Test 5: Reload Project From Active File ──
147+
# `java.project.reloadProjectFromActiveFile` is contributed to editor/title
148+
# group navigation only when `java:reloadProjectActive && javaLSReady` are
149+
# both true. The `java:reloadProjectActive` key is set by redhat.java when
150+
# JDT.LS detects an out-of-date project descriptor — but that signal is
151+
# racy and inconsistent for synthetic changes (trivial whitespace edits
152+
# often get absorbed without flipping the key, and a substantive edit
153+
# would risk corrupting the fixture pom.xml). For deterministic CI
154+
# behaviour this step therefore invokes the command id directly through
155+
# the keybinding-bridge path. The fact that the command exists and runs
156+
# without breaking the language server is still meaningful coverage,
157+
# complementing the UI-driven tests above.
158+
- id: "open-pom"
159+
action: "open file pom.xml"
160+
waitBefore: 3
161+
162+
- id: "trigger-reload-project"
163+
action: "executeVSCodeCommand java.project.reloadProjectFromActiveFile"
164+
165+
- id: "wait-reload-project"
166+
action: "waitForLanguageServer"
167+
timeout: 180

0 commit comments

Comments
 (0)