Skip to content

Commit 8ed62cb

Browse files
committed
test: update
1 parent 167c836 commit 8ed62cb

File tree

2 files changed

+32
-39
lines changed

2 files changed

+32
-39
lines changed

test/e2e/utils/javaOperator.ts

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,20 @@ export default class JavaOperator {
1919
/**
2020
* Waits for the Java Language Server to finish indexing.
2121
*
22-
* Strategy: we click the language-status area in the status bar, which
23-
* opens a hover showing codicon-thumbsup / codicon-pass when the LS is
24-
* ready. We poll this until we see one of those icons.
25-
*
26-
* Falls back to checking for "Java" text + "Ready" if the icon approach
27-
* doesn't match (VS Code version variance).
22+
* Strategy: poll the status bar for a button whose accessible name
23+
* contains "Java: Ready" (e.g. "coffee Java: Ready, Show Java status menu").
24+
* This is more reliable than clicking a hover because it doesn't depend
25+
* on internal VS Code DOM IDs that vary across versions.
2826
*/
2927
static async waitForJavaLSReady(page: Page, timeoutMs = Timeout.JAVA_LS_READY): Promise<void> {
3028
// Give the extension a moment to register its status bar item
3129
await page.waitForTimeout(Timeout.EXTENSION_ACTIVATE);
3230

3331
await expect.poll(async () => {
3432
try {
35-
// Try clicking the language status area
36-
const langStatus = page.locator('[id="status.languageStatus"]');
37-
if (await langStatus.isVisible().catch(() => false)) {
38-
await langStatus.click();
39-
await page.waitForTimeout(500);
40-
41-
// Check for "ready" icons in the hover
42-
const readyIcon = page.locator(
43-
".context-view .hover-language-status .codicon-thumbsup, " +
44-
".context-view .hover-language-status .codicon-pass"
45-
);
46-
if (await readyIcon.first().isVisible().catch(() => false)) {
47-
// Dismiss the hover by pressing Escape
48-
await page.keyboard.press(VSCode.ESCAPE);
49-
return "ready";
50-
}
51-
52-
// Dismiss the hover
53-
await page.keyboard.press(VSCode.ESCAPE);
33+
const javaReadyButton = page.getByRole(VSCode.BUTTON_ROLE, { name: /Java:\s*Ready/i });
34+
if (await javaReadyButton.isVisible().catch(() => false)) {
35+
return "ready";
5436
}
5537
return "not-ready";
5638
} catch {

test/simple/.project

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<projectDescription>
3-
<name>1.helloworld</name>
4-
<comment></comment>
5-
<projects>
6-
</projects>
7-
<buildSpec>
8-
<buildCommand>
9-
<name>org.eclipse.jdt.core.javabuilder</name>
10-
<arguments>
11-
</arguments>
12-
</buildCommand>
13-
</buildSpec>
14-
<natures>
15-
<nature>org.eclipse.jdt.core.javanature</nature>
16-
</natures>
3+
<name>1.helloworld</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1774876132513</id>
20+
<name></name>
21+
<type>30</type>
22+
<matcher>
23+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
24+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25+
</matcher>
26+
</filter>
27+
</filteredResources>
1728
</projectDescription>

0 commit comments

Comments
 (0)