Skip to content

test(e2e): cover classpath / referenced-libraries commands#1028

Merged
wenytang-ms merged 3 commits into
mainfrom
e2e/phase-b-classpath
Jun 8, 2026
Merged

test(e2e): cover classpath / referenced-libraries commands#1028
wenytang-ms merged 3 commits into
mainfrom
e2e/phase-b-classpath

Conversation

@wenytang-ms
Copy link
Copy Markdown
Contributor

Phase B: Classpath / Referenced Libraries coverage

Adds test/e2e-plans/java-dep-classpath.yaml exercising all four java.project.* referenced-library commands on an invisible (unmanaged-folder) project, plus the two distinct removeLibrary code paths.

Commands covered

Command UI affordance Plan cycle
java.project.refreshLibraries Refresh inline icon on Referenced Libraries 1
java.project.addLibraries + inline icon -> simpleFileDialog jar pick 2
java.project.removeLibrary (include-removal) command id (handler unchanged) 3
java.project.addLibraryFolders command id -> Select Library Folders button 4
java.project.removeLibrary (exclude-add) command id (handler unchanged) 5

Notable design decisions (documented inline in the YAML)

  • Invisible projects do not auto-activate redhat.java -- bootstrap with open file src/App.java before waitForLanguageServer.
  • Single-folder workspaces have no collapseWorkspaceRoot target -- use collapseSidebarSection invisible so the JAVA PROJECTS pane gets the vertical room virtualisation needs to render jar leaves.
  • Jar leaves carry the resolved path in their accessible name -- drop exact: true on jar verifyTreeItem blocks (project root keeps it).
  • Smoke-test driver swaps native showOpenDialog for simpleFileDialog -- drive the picker with fillQuickInput; folder pick additionally needs tryClickButton Select Library Folders because Enter on a folder navigates into it.
  • removeLibrary is invoked via executeVSCodeCommand -- the inline minus icon hit-target is narrower than the wrapping <li class="action-item"> whose centre clickTreeItemAction targets, so the click consistently misses on jar-leaf rows. The command id bypasses the hit-target gap and exercises the same handler.
  • Cycle 5 exercises the second removeLibrary branch -- after cycle 4 the folder glob re-attaches extra-a.jar; removing it again goes through the if (removedPaths.length === 0) path that appends to referencedLibraries.exclude.

Fixtures

  • test/invisible/extraJars/extra-a.jar and extra-b.jar (added in a prior commit on this branch) enable the add-then-remove cycles without polluting the baseline lib/simple.jar.

Local verification

33/33 passed

Auto-discovered by the existing matrix in .github/workflows/e2eUI.yml via the discover-plans job -- no CI wiring needed.

wenytang-ms and others added 2 commits June 5, 2026 15:25
Cover the four java.project.* classpath commands on an invisible
(unmanaged-folder) project:

- java.project.refreshLibraries     -> Refresh inline icon, idempotent
- java.project.addLibraries         -> + inline icon + simpleFileDialog
- java.project.removeLibrary        -> include-removal branch
- java.project.addLibraryFolders    -> command id + Select Library Folders
- java.project.removeLibrary (#2)   -> exclude-addition branch

Reuse the existing 	est/invisible fixture and the two new
�xtraJars/extra-{a,b}.jar files committed earlier so all 33 steps
run deterministically against the worktree workspace.

Auto-discovered by the existing matrix in .github/workflows/e2eUI.yml,
no CI wiring needed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The previous template

  file:///${workspaceFolder}/extraJars/extra-a.jar

happened to round-trip through vscode.Uri.parse(...).fsPath on Windows
(where ${workspaceFolder} is a C:\... path) but on Linux it produced
file:////home/runner/... (FOUR slashes). Uri.parse mapped that to a
//home/... path, so workspace.asRelativePath did not match the include
entry and removeLibrary silently did nothing -- both verify-extra-a-gone
and verify-extra-a-excluded then timed out on the Linux CI matrix.

Switch to the new ${workspaceFolderUri} placeholder (autotest 0.7.13),
which is backed by Node's url.pathToFileURL and produces a correctly
formed file:// URI on both Windows and POSIX.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new end-to-end UI test plan to exercise vscode-java-dependency’s referenced-library (classpath) management commands on an invisible/unmanaged Java project, including both removeLibrary handler branches.

Changes:

  • Introduces test/e2e-plans/java-dep-classpath.yaml covering java.project.refreshLibraries, addLibraries, addLibraryFolders, and removeLibrary.
  • Verifies referenced-library state via deterministic verifyTreeItem assertions across multiple cycles (add/remove, glob re-attach, exclude path).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e-plans/java-dep-classpath.yaml
Comment thread test/e2e-plans/java-dep-classpath.yaml
@wenytang-ms wenytang-ms merged commit 4db30ab into main Jun 8, 2026
26 checks passed
@wenytang-ms wenytang-ms deleted the e2e/phase-b-classpath branch June 8, 2026 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants