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
16 changes: 13 additions & 3 deletions .github/workflows/linuxUI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ jobs:
run: npm run build-server

- name: Build VSIX file
run: vsce package
run: vsce package -o vscode-java-dependency.vsix

- name: E2E Test (Playwright)
run: DISPLAY=:99 npm run test-e2e
- name: Setup autotest
run: npm install -g @vscjava/vscode-autotest

- name: E2E Test (autotest)
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
run: |
DISPLAY=:99 autotest run-all test/e2e-plans \
--vsix $(pwd)/vscode-java-dependency.vsix \
--output test-results

- name: Upload test results
if: ${{ always() }}
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/windowsUI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,18 @@ jobs:
run: npm run build-server

- name: Build VSIX file
run: vsce package
run: vsce package -o vscode-java-dependency.vsix

- name: E2E Test (Playwright)
run: npm run test-e2e
- name: Setup autotest
run: npm install -g @vscjava/vscode-autotest

- name: E2E Test (autotest)
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }}
AZURE_OPENAI_DEPLOYMENT: ${{ secrets.AZURE_OPENAI_DEPLOYMENT }}
run: |
autotest run-all test/e2e-plans --vsix "$((Get-Location).Path)\vscode-java-dependency.vsix" --output test-results

- name: Upload test results
if: ${{ always() }}
Expand Down
170 changes: 170 additions & 0 deletions test/e2e-plans/java-dep-file-operations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
# Test Plan: Java Dependency — File Operations
#
# Covers fileOperations.test.ts scenarios:
# - create new Java class
# - create new package
# - rename Java file
# - delete Java file
#
# Note: The workspace is auto-copied to a temp directory by autotest,
# so rename/delete operations don't pollute the source test fixtures.
#
# Usage:
# npx autotest run test/e2e-plans/java-dep-file-operations.yaml --vsix <path-to-vsix>

name: "Java Dependency — File Operations"
description: |
Tests file/resource operations in the Java Projects view:
create class, create package, rename file, delete file.
Replaces test/e2e/tests/fileOperations.test.ts.

setup:
extension: "redhat.java"
vscodeVersion: "stable"
workspace: "../maven"
timeout: 180
settings:
java.configuration.checkProjectSettingsExclusions: false

steps:
# ── Setup: wait for LS, focus Java Projects ──
- id: "ls-ready"
action: "waitForLanguageServer"
verify: "Java Language Server is ready"
timeout: 180

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

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

# ── Test 1: create new Java class ──
- id: "click-project-node"
action: "click my-app tree item"

- id: "trigger-new-resource"
action: "clickTreeItemAction my-app New..."
verify: "New resource quick pick opened"

- id: "select-java-class"
action: "selectOptionByIndex 0"
verify: "Java Class selected"

- id: "select-source-folder"
action: "select src/main/java option"
verify: "Source folder selected"

- id: "enter-class-name"
action: "fillQuickInput App2"
verify: "Class name entered"

- id: "verify-new-class-tab"
action: "wait 2 seconds"
verify: "Editor tab App2.java should appear"
verifyEditorTab:
title: "App2.java"
timeout: 15

# ── Test 2: create new package ──
- id: "focus-java-projects-2"
action: "run command Java Projects: Focus on Java Projects View"

- id: "click-project-node-2"
action: "click my-app tree item"

- id: "trigger-new-resource-2"
action: "clickTreeItemAction my-app New..."

- id: "select-package"
action: "select Package option"
verify: "Package selected"

- id: "select-source-folder-2"
action: "select src/main/java option"

- id: "enter-package-name"
action: "fillQuickInput com.mycompany.newpkg"
verify: "Package name entered"

- id: "wait-package-creation"
action: "wait 3 seconds"
verify: "Package directory created"

# ── Test 3: rename Java file ──
# Open the target file, let link-with-editor reveal it in the tree,
# then click to select it and trigger rename via context menu.
- id: "open-rename-target"
action: "open file AppToRename.java"
waitBefore: 3

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

# Click the tree item first to select it
- id: "select-rename-target"
action: "click AppToRename tree item"
waitBefore: 2

# Use context menu to trigger extension's rename (shows showInputBox)
- id: "rename-context-menu"
action: "contextMenu AppToRename Rename"
verify: "Rename input box opened"

- id: "enter-new-name"
action: "fillAnyInput AppRenamed"
verify: "New name entered and confirmed"
waitBefore: 2

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

# Handle optional Refactor Preview panel
- 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"
verifyEditorTab:
title: "AppRenamed"
timeout: 15

# ── Test 4: delete Java file ──
# Instead of manually expanding the tree (which requires viewport space),
# open the file and let link-with-editor reveal it in the tree.
- id: "open-delete-target"
action: "open file AppToDelete.java"
waitBefore: 5

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

- id: "delete-context-menu"
action: "contextMenu AppToDelete Delete"
verify: "Delete confirmation triggered"

# VSCode shows a platform-specific confirmation dialog for delete
- id: "confirm-delete"
action: "confirmDialog"

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

- id: "verify-deleted"
action: "wait 1 seconds"
verify: "AppToDelete tree item should disappear"
verifyTreeItem:
name: "AppToDelete"
visible: false
timeout: 15
87 changes: 87 additions & 0 deletions test/e2e-plans/java-dep-project-explorer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Test Plan: Java Dependency — Project Explorer
#
# Covers projectExplorer.test.ts scenarios:
# - javaProjectExplorer.focus shows Java Projects section
# - linkWithFolderExplorer reveals active file in tree
# - unlinkWithFolderExplorer stops auto-reveal
#
# Usage:
# npx autotest run test/e2e-plans/java-dep-project-explorer.yaml --vsix <path-to-vsix>

name: "Java Dependency — Project Explorer"
description: |
Tests the Java Projects explorer view: focus, link/unlink with editor.
Replaces test/e2e/tests/projectExplorer.test.ts.

setup:
extension: "redhat.java"
vscodeVersion: "stable"
workspace: "../maven"
timeout: 180
settings:
java.configuration.checkProjectSettingsExclusions: false

steps:
# ── Wait for LS ready ──
- id: "ls-ready"
action: "waitForLanguageServer"
verify: "Java Language Server is ready"
timeout: 180

# ── Test 1: javaProjectExplorer.focus ──
- id: "focus-java-projects"
action: "run command Java Projects: Focus on Java Projects View"
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"
verifyTreeItem:
name: "my-app"
timeout: 15

# ── Test 2: linkWithFolderExplorer ──
- id: "expand-project"
action: "expand my-app tree item"

- id: "expand-src"
action: "expand src/main/java tree item"
waitBefore: 2

- id: "verify-package"
action: "wait 1 seconds"
verify: "Package com.mycompany.app is visible"
verifyTreeItem:
name: "com.mycompany.app"
timeout: 15

- id: "expand-package"
action: "expand com.mycompany.app tree item"
waitBefore: 2

- id: "verify-app-class"
action: "wait 1 seconds"
verify: "App class node is visible (exact match, not App.java or AppToDelete)"
verifyTreeItem:
name: "App"
exact: true
timeout: 15

# ── Test 3: unlinkWithFolderExplorer ──
- id: "unlink-editor"
action: "run command Java: Unlink with Editor"
verify: "Editor unlinked from tree"

- 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"

- id: "relink-editor"
action: "run command Java: Link with Editor"
verify: "Editor re-linked with tree"
Loading