Skip to content

Commit 27368c8

Browse files
committed
test: update test case
1 parent b98c800 commit 27368c8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

test/e2e/tests/libraries.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test.describe("Libraries & Project Creation", () => {
7272
// Create a temp folder for the new project
7373
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "java-new-project-"));
7474

75-
await VscodeOperator.executeCommand(page, "java.project.create");
75+
await VscodeOperator.executeCommand(page, "Java: Create Java Project");
7676
await page.waitForTimeout(Timeout.CLICK);
7777

7878
// Select "No build tools"

test/e2e/tests/projectExplorer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ test.describe("Project Explorer", () => {
4747

4848
test("unlinkWithFolderExplorer stops auto-reveal", async ({ page }) => {
4949
// Use command to unlink
50-
await VscodeOperator.executeCommand(page, "java.view.package.unLinkWithFolderExplorer");
50+
await VscodeOperator.executeCommand(page, "Java: Unlink with Editor");
5151
await page.waitForTimeout(Timeout.CLICK);
5252

5353
// Open a different file — tree should NOT auto-expand
5454
await JavaOperator.openFile(page, "AppToRename.java");
5555
await page.waitForTimeout(Timeout.TREE_EXPAND);
5656

5757
// Re-link for cleanup
58-
await VscodeOperator.executeCommand(page, "java.view.package.linkWithFolderExplorer");
58+
await VscodeOperator.executeCommand(page, "Java: Link with Editor");
5959
});
6060
});

test/e2e/utils/javaOperator.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,18 @@ export default class JavaOperator {
6969

7070
/**
7171
* Expands tree items along a path (e.g. "my-app" → "src/main/java" → "com.mycompany.app").
72-
* Returns the last expanded tree item locator.
72+
*
73+
* Checks `aria-expanded` before clicking so that an already-expanded node
74+
* is not accidentally collapsed (VS Code auto-expands single-child trees).
7375
*/
7476
static async expandTreePath(page: Page, ...labels: string[]): Promise<void> {
7577
for (const label of labels) {
7678
const item = page.getByRole(VSCode.TREE_ITEM_ROLE, { name: label }).first();
7779
await item.waitFor({ state: "visible", timeout: 15_000 });
78-
await item.click();
80+
const expanded = await item.getAttribute("aria-expanded");
81+
if (expanded !== "true") {
82+
await item.click();
83+
}
7984
await page.waitForTimeout(Timeout.TREE_EXPAND);
8085
}
8186
}

0 commit comments

Comments
 (0)