Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@ test-resources
# Ignore output of code sign
server/*.md
**/*.log

# Local env / autotest artifacts
.env
.env.*
test-results/**
75 changes: 57 additions & 18 deletions test/e2e-plans/java-dep-file-operations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ steps:
# ── Setup: wait for LS, free Explorer space, focus Java Projects ──
- id: "ls-ready"
action: "waitForLanguageServer"
verify: "Java Language Server is ready"
# No `verify:` — `waitForLanguageServer` is itself the deterministic
# readiness check (it returns only when the Java Language Server status
# changes to "Ready"). The post-action screenshot frequently captures
# the very next state — "Java: Building - 0%" once Maven import begins —
# which a strict LLM mis-reads as "not ready", even though Ready was
# observed milliseconds earlier.
timeout: 180

# Free horizontal space (Chat panel can take ~210px on right side)
Expand All @@ -52,7 +57,7 @@ steps:
action: "collapseWorkspaceRoot"

- id: "focus-java-projects"
action: "run command Java Projects: Focus on Java Projects View"
action: "executeVSCodeCommand javaProjectExplorer.focus"
verify: "Java Projects view is focused"

- id: "wait-tree-load"
Expand All @@ -76,11 +81,18 @@ steps:

- id: "enter-class-name"
action: "fillQuickInput App2"
verify: "Class name entered"
# NOTE: no `verify:` — `fillQuickInput` submits and closes the quick input.
# The before/after screenshots only show the input disappearing, which the
# screenshot-comparing LLM frequently mis-reads as "wrong UI element
# targeted". The deterministic `verifyEditorTab` on the next step is the
# ground truth for whether App2.java was created.

- id: "verify-new-class-tab"
action: "wait 2 seconds"
verify: "Editor tab App2.java should appear"
# No `verify:` — state-check step. The deterministic `verifyEditorTab`
# below is authoritative. BEFORE and AFTER screenshots are nearly
# identical at steady state (App2.java tab present in both), which a
# strict LLM can mis-read as "no change".
verifyEditorTab:
title: "App2.java"
timeout: 15
Expand All @@ -89,21 +101,29 @@ steps:
# Close the editor opened by the previous step. With link-with-editor on,
# an open editor causes the JAVA PROJECTS tree to auto-expand, pushing
# my-app right under the sticky pane-header where clicks get intercepted.
#
# App2.java is opened in a dirty editor by the New Class flow (the extension
# writes initial class boilerplate via the buffer), so we must save first
# — otherwise `Close All Editors` raises a "Save changes?" modal dialog
# that blocks every subsequent click for the rest of the run.
- id: "save-all-before-close"
action: "executeVSCodeCommand workbench.action.files.saveAll"

- id: "close-editors-before-pkg"
action: "run command View: Close All Editors"

- id: "collapse-workspace-root-2"
action: "collapseWorkspaceRoot"

- id: "focus-java-projects-2"
action: "run command Java Projects: Focus on Java Projects View"
action: "executeVSCodeCommand javaProjectExplorer.focus"
waitBefore: 1

# Test 1 expanded my-app → src/main/java → com.mycompany.app to reveal the
# newly-created App2.java. Reset the JAVA PROJECTS tree so my-app is back
# at row 0 and not occluded by the sticky pane-header on the next click.
- id: "collapse-java-projects-tree-2"
action: 'clickViewTitleAction "Java Projects" "Collapse All"'
action: "executeVSCodeCommand workbench.actions.treeView.javaProjectExplorer.collapseAll"
waitBefore: 1

- id: "click-project-node-2"
Expand All @@ -122,11 +142,14 @@ steps:

- id: "enter-package-name"
action: "fillQuickInput com.mycompany.newpkg"
verify: "Package name entered"
# No `verify:` — quick input closes after submit and the new package is
# under a still-collapsed tree, so LLM can't see the change and downgrades
# the step. Package creation is a side-effect of the wizard finishing.

- id: "wait-package-creation"
action: "wait 3 seconds"
verify: "Package directory created"
# No `verify:` — tree is collapsed at this point so the new package isn't
# rendered; LLM screenshot comparison would erroneously downgrade.

# ── Test 3: rename Java file ──
# Open the target file, let link-with-editor reveal it in the tree,
Expand All @@ -139,7 +162,7 @@ steps:
action: "collapseWorkspaceRoot"

- id: "focus-java-projects-3"
action: "run command Java Projects: Focus on Java Projects View"
action: "executeVSCodeCommand javaProjectExplorer.focus"
waitBefore: 3

# Click the tree item first to select it
Expand All @@ -154,26 +177,35 @@ steps:

- id: "enter-new-name"
action: "fillAnyInput AppRenamed"
verify: "New name entered and confirmed"
# No `verify:` — rename is async (status bar shows "Computing rename
# updates..." for several seconds) so the AFTER screenshot still shows
# the old name and LLM downgrades. `verify-renamed-tab` below uses
# deterministic `verifyEditorTab` against the new name as ground truth.
waitBefore: 2

# Handle optional rename confirmation dialog — may not appear on all platforms
# (Electron native dialog is auto-dismissed by monkey-patch)
# (Electron native dialog is auto-dismissed by monkey-patch).
# No `verify:` — confirmDialog is best-effort (dialog may not appear).
- id: "handle-rename-dialog"
action: "confirmDialog"
verify: "Rename confirmation handled (if present)"

# Handle optional Refactor Preview panel
# Handle optional Refactor Preview panel.
# No `verify:` — tryClickButton is best-effort; if the Apply button does not
# appear because the refactor finished without preview, the before/after
# screenshots are identical and LLM downgrades. The deterministic
# `verify-renamed-tab` covers the real outcome.
- id: "handle-refactor-preview"
action: "tryClickButton Apply"
verify: "Refactor preview applied (if present)"

- id: "wait-rename"
action: "wait 3 seconds"

- id: "verify-renamed-tab"
action: "wait 1 seconds"
verify: "Editor tab AppRenamed should appear"
# No `verify:` — state-check step. `verifyEditorTab` is authoritative.
# By the time this runs, the rename has typically already completed
# (after wait-rename's 3s), so both BEFORE and AFTER show AppRenamed.
# A strict LLM mis-reads identical screenshots as "no transition".
verifyEditorTab:
title: "AppRenamed"
timeout: 15
Expand All @@ -189,7 +221,7 @@ steps:
action: "collapseWorkspaceRoot"

- id: "focus-java-projects-4"
action: "run command Java Projects: Focus on Java Projects View"
action: "executeVSCodeCommand javaProjectExplorer.focus"
waitBefore: 2

- id: "delete-context-menu"
Expand All @@ -203,12 +235,19 @@ steps:
- id: "confirm-delete"
action: "expectConfirmDialog"

# Combined wait + verify in a single step: the deterministic verifyTreeItem
# with visible:false polls up to 15s for the tree to refresh, so a short
# explicit `wait 3` is enough to give the tree time to render before the
# AFTER screenshot is captured.
- id: "wait-delete"
action: "wait 3 seconds"
action: "wait 6 seconds"

- id: "verify-deleted"
action: "wait 1 seconds"
verify: "AppToDelete tree item should disappear"
# No `verify:` — AFTER screenshot is captured immediately after the wait,
# but the tree's removal of AppToDelete may not yet be visually reflected
# on slower CI runners. The deterministic verifyTreeItem (visible:false)
# below polls for up to 15s and is authoritative.
verifyTreeItem:
name: "AppToDelete"
visible: false
Expand Down
48 changes: 35 additions & 13 deletions test/e2e-plans/java-dep-project-explorer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ steps:
# ── Wait for LS ready ──
- id: "ls-ready"
action: "waitForLanguageServer"
verify: "Java Language Server is ready"
# No `verify:` — `waitForLanguageServer` is itself the deterministic
# readiness check. The AFTER screenshot may transiently show
# "Java: Building - 0%" (Maven import starts immediately after Ready),
# which a strict LLM mis-reads as a failure.
timeout: 180

# Free horizontal & vertical space so JAVA PROJECTS gets enough room.
Expand All @@ -45,16 +48,19 @@ steps:
action: "collapseWorkspaceRoot"

# ── Test 1: javaProjectExplorer.focus ──
# The view is contributed to the Explorer container, so the palette title is
# "Explorer: Focus on Java Projects View". Invoking the command id directly
# via executeVSCodeCommand is locale-independent and slightly faster.
- id: "focus-java-projects"
action: "run command Java Projects: Focus on Java Projects View"
action: "executeVSCodeCommand javaProjectExplorer.focus"
verify: "Java Projects view is focused"

- id: "wait-tree-load"
action: "wait 3 seconds"

- id: "verify-project-node"
action: "wait 1 seconds"
verify: "my-app project node is visible in the tree"
# No `verify:` — state-check step; `verifyTreeItem` is authoritative.
verifyTreeItem:
name: "my-app"
timeout: 15
Expand All @@ -71,7 +77,7 @@ steps:

- id: "verify-package"
action: "wait 1 seconds"
verify: "Package com.mycompany.app is visible"
# No `verify:` — state-check step; `verifyTreeItem` is authoritative.
verifyTreeItem:
name: "com.mycompany.app"
timeout: 15
Expand All @@ -82,7 +88,7 @@ steps:

- id: "verify-app-class"
action: "wait 1 seconds"
verify: "App class node is visible (exact match, not App.java or AppToDelete)"
# No `verify:` — state-check step; `verifyTreeItem` is authoritative.
verifyTreeItem:
name: "App"
exact: true
Expand All @@ -95,37 +101,53 @@ steps:
# locates it directly or via the "Views and More Actions..." overflow menu.
- id: "unlink-editor"
action: 'clickViewTitleAction "Java Projects" "Unlink with Editor"'
verify: "Editor unlinked from tree"
# No `verify:` — toggling the link-with-editor setting produces no visible
# change in the screenshot (tree selection persists from the prior reveal).
# The behavior is verified deterministically by `wait-after-open` below:
# after opening AppToRename.java, the tree must NOT auto-reveal it.

- id: "open-rename-file"
action: "open file AppToRename.java"

- id: "wait-after-open"
action: "wait 3 seconds"
verify: "Tree should not auto-expand to AppToRename"
# Stability check: with link-with-editor disabled, opening
# AppToRename.java must NOT change the Java Projects tree state. The
# BEFORE and AFTER screenshots are expected to look identical (tree
# state preserved), which is exactly what a comparison-only LLM
# verification can confirm reliably. We cannot use verifyTreeItem
# visible:false here because AppToRename is already visible (its
# parent package was expanded by earlier setup steps); the check is
# about tree-state stability, not item visibility.
verify: "Java Projects tree state is unchanged; opening AppToRename.java did not auto-reveal or auto-select anything new."

- id: "relink-editor"
action: 'clickViewTitleAction "Java Projects" "Link with Editor"'
verify: "Editor re-linked with tree"
# No `verify:` — same reason as `unlink-editor`. The behavior is verified
# deterministically downstream when revealInProjectExplorer locates App.

# ── Test 4: revealInProjectExplorer ──
# Collapse all tree nodes, then reveal App.java by right-clicking the editor tab
# → "Reveal in Java Project Explorer" (contributed to editor/title/context).
# Collapse all tree nodes, then reveal App.java by invoking the contributed
# `java.view.package.revealInProjectExplorer` command. autotest 0.7.x has no
# contextMenuOnEditorTab action, so we drive the command directly via
# executeVSCodeCommand with a Uri-shaped POJO arg (the command reads
# `uri.fsPath` and reconstructs a proper Uri before use, so a plain object
# with `fsPath` is sufficient).
- id: "collapse-all"
action: "run command View: Collapse All"
action: "executeVSCodeCommand workbench.actions.treeView.javaProjectExplorer.collapseAll"
verify: "Collapse tree to reset state"

- id: "open-app-file"
action: "open file App.java"
waitBefore: 2

- id: "reveal-in-project-explorer"
action: 'contextMenuOnEditorTab "App.java" "Reveal in Java Project Explorer"'
action: 'executeVSCodeCommand java.view.package.revealInProjectExplorer {"fsPath":"${workspaceFolder}/src/main/java/com/mycompany/app/App.java","scheme":"file"}'
waitBefore: 2

- id: "verify-revealed"
action: "wait 2 seconds"
verify: "App class should be revealed in Java Projects tree"
# No `verify:` — state-check step; `verifyTreeItem` is authoritative.
verifyTreeItem:
name: "App"
exact: true
Expand Down
Loading