Skip to content

Commit f97aff6

Browse files
author
Siddharth Saladi
committed
better waits
1 parent 917f815 commit f97aff6

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

src/test/MavenTestServerXmlLCLS.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ describe('Liberty Config Language Server Tests for Maven Project', function () {
5959
// making subsequent editor operations unreliable.
6060
await new BottomBarPanel().toggle(false);
6161
editor = await editorView.openEditor('server.xml') as TextEditor;
62+
// Wait until the editor is truly focused — getText() returning non-empty content
63+
// confirms the inputArea has keyboard focus and Ctrl+A will land correctly
64+
await utils.waitForCondition(async () => {
65+
const text = await editor.getText();
66+
return text.length > 0 ? true : undefined;
67+
}, 10);
6268

6369
// Restore original content so each test starts from a clean slate
6470
if (originalContent) {
@@ -186,8 +192,14 @@ describe('Liberty Config Language Server Tests for Maven Project', function () {
186192
pollInterval: 2000,
187193
message: 'Diagnostic did not appear before attempting quick fix'
188194
});
189-
// Close the bottom bar so the editor is focused for the quick-fix shortcut
195+
// Close the bottom bar and re-acquire the editor — the Problems panel
196+
// interaction in step 2 shifts focus off the editor tab
190197
await new BottomBarPanel().toggle(false);
198+
editor = await editorView.openEditor('server.xml') as TextEditor;
199+
await utils.waitForCondition(async () => {
200+
const text = await editor.getText();
201+
return text.length > 0 ? true : undefined;
202+
}, 10);
191203
logger.stepSuccess(2, 'Diagnostic confirmed');
192204

193205
logger.step(3, 'Selecting invalid feature text');
@@ -323,6 +335,15 @@ describe('Liberty Config Language Server Tests for Maven Project', function () {
323335
const assist = await utils.waitForCondition(async () => {
324336
return await editor.toggleContentAssist(true) ?? undefined;
325337
}, 10);
338+
// Wait until the target item is present and interactable in the list
339+
await utils.waitForCondition(async () => {
340+
try {
341+
const item = await assist.getItem('dataSource');
342+
return item ? true : undefined;
343+
} catch {
344+
return undefined;
345+
}
346+
}, 10);
326347
logger.stepSuccess(3, 'Content assist opened');
327348

328349
logger.step(4, 'Selecting "dataSource" from the completion list');
@@ -362,6 +383,15 @@ describe('Liberty Config Language Server Tests for Maven Project', function () {
362383
const assist = await utils.waitForCondition(async () => {
363384
return await editor.toggleContentAssist(true) ?? undefined;
364385
}, 10);
386+
// Wait until the target item is present and interactable in the list
387+
await utils.waitForCondition(async () => {
388+
try {
389+
const item = await assist.getItem('application');
390+
return item ? true : undefined;
391+
} catch {
392+
return undefined;
393+
}
394+
}, 10);
365395
logger.stepSuccess(3, 'Content assist opened');
366396

367397
logger.step(4, 'Selecting "application" from the completion list');

0 commit comments

Comments
 (0)