Skip to content
Closed
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
8 changes: 6 additions & 2 deletions src/test/MavenTestServerXmlLCLS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('Liberty Config Language Server Tests for Maven Project', () => {
await VSBrowser.instance.openResources(serverXmlPath, async () => {
await wait.sleep(3000);
});


editor = await editorView.openEditor('server.xml') as TextEditor;
originalContent = await editor.getText();
Expand All @@ -47,6 +48,9 @@ describe('Liberty Config Language Server Tests for Maven Project', () => {
logger.error(`Test failed: ${this.currentTest?.title}`);
}

// Dismiss notification toasts before closing the panel — a toast covering
// the close button causes ElementClickInterceptedError on macOS CI
await utils.dismissNotifications();
// Close the bottom bar and re-focus the editor
await new BottomBarPanel().toggle(false);
editor = await editorView.openEditor('server.xml') as TextEditor;
Expand Down Expand Up @@ -79,12 +83,12 @@ describe('Liberty Config Language Server Tests for Maven Project', () => {
});

it('Liberty Language Server should initialize', async function() {
this.timeout(60000);
this.timeout(300000);
logger.testStart('Liberty Language Server should initialize');
await utils.waitForLanguageServerInit(
'Language Support for Liberty',
'Initialized Liberty Language server',
60
240
);
logger.testComplete('Liberty Language Server initialized successfully');
});
Expand Down
13 changes: 13 additions & 0 deletions src/test/pages/CodeAssistPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ export class CodeAssistPage {
await editor.getEditor().typeText(snippetTrigger);
const assist = await editor.getEditor().toggleContentAssist(true);
if (assist) {
// Wait until the target item is interactable before selecting.
// Newer VS Code virtualises the content-assist list — the item exists
// in the DOM immediately but is not scrolled into view/clickable until
// the list has fully rendered.
const deadline = Date.now() + 15000;
while (Date.now() < deadline) {
try {
await assist.getItem(fullSnippet);
break; // item is present and didn't throw
} catch {
await new Promise(res => setTimeout(res, 500));
}
}
await assist.select(fullSnippet);
await new Promise(res => setTimeout(res, 600)); // 300–800ms
}
Expand Down
10 changes: 9 additions & 1 deletion src/test/pages/EditorPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ export class EditorPage {
await VSBrowser.instance.openResources(filePath, async () => {
await utils.getWaitHelper().sleep(loadDelay);
});
this.editor = await this.editorView.openEditor(tabTitle) as TextEditor;
// openEditor can fail on slow CI if the tab hasn't rendered yet —
// retry for up to 30 s before giving up.
this.editor = await utils.waitForCondition(async () => {
try {
return await this.editorView.openEditor(tabTitle) as TextEditor;
} catch {
return undefined;
}
}, 30) as TextEditor;
return this;
}

Expand Down
1 change: 1 addition & 0 deletions src/test/resources/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"files.simpleDialog.enable": true,
"git.autoRepositoryDetection": false,
"github.copilot.enable": false,
"security.workspace.trust.enabled": false,
"terminal.integrated.sendKeybindingsToShell": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"window.dialogStyle": "custom",
Expand Down
9 changes: 5 additions & 4 deletions src/test/shared/configFileTestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function runConfigFileTestSuite(config: ConfigFileTestConfig): void {
let wait: any;

before(async function () {
this.timeout(60000);
this.timeout(120000);
logger.info(`Setting up Maven ${config.tabTitle} tests`);

await VSBrowser.instance.openResources(config.getProjectPath());
Expand All @@ -89,7 +89,7 @@ export function runConfigFileTestSuite(config: ConfigFileTestConfig): void {
});

after(async function () {
this.timeout(10000);
this.timeout(45000);
try {
if (editor) {
const currentText = await editor.getEditor().getText();
Expand All @@ -111,17 +111,18 @@ export function runConfigFileTestSuite(config: ConfigFileTestConfig): void {
} catch (error) {
logger.error('Failed to close editors in after hook', error);
}
await utils.closeWorkspace();
utils.copyScreenshotsToProjectFolder('maven');
});

it('Liberty Language Server should initialize', async function () {
this.timeout(60000);
this.timeout(300000);
logger.testStart('Liberty Language Server should initialize');
try {
await utils.waitForLanguageServerInit(
'Language Support for Liberty',
'Initialized Liberty Language server',
60
240
);
logger.testComplete('Liberty Language Server initialized successfully');
} catch (error) {
Expand Down
16 changes: 13 additions & 3 deletions src/test/shared/devModeTestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
describe(`Devmode action tests for ${config.buildTool} Project`, () => {

before(async function() {
this.timeout(30000);
this.timeout(60000);

await VSBrowser.instance.openResources(config.getProjectPath());
await VSBrowser.instance.waitForWorkbench();
Expand All @@ -33,7 +33,7 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
});

afterEach(async function() {
this.timeout(10000); // Increase timeout for cleanup operations
this.timeout(30000);
// Close any open editors after each test
if (this.currentTest?.state === 'failed') {
await VSBrowser.instance.driver.takeScreenshot();
Expand Down Expand Up @@ -295,7 +295,17 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
/**
* The following after hook copies the screenshot from the temporary folder in which it is saved to a known permanent location in the project folder.
*/
after(() => {
after(async function() {
this.timeout(30000);
// Restore the Explorer view in case the attach-debugger test left
// VS Code in the Debug perspective. On mac Previous this does not
// happen automatically and every subsequent sidebar call would query
// the wrong panel, causing ElementNotInteractableError forever.
try {
const { Workbench } = require('vscode-extension-tester');
await new Workbench().executeCommand('workbench.view.explorer');
await utils.getWaitHelper().sleep(1000);
} catch { /* non-fatal */ }
utils.copyScreenshotsToProjectFolder(config.buildTool);
});

Expand Down
15 changes: 7 additions & 8 deletions src/test/shared/hoverTestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function runHoverTestSuite(config: HoverConfig){
let serverXml: EditorPage;

before(async function() {
this.timeout(60000);
this.timeout(120000);

logger.info(`Setting up ${config.buildTool === 'maven' ? 'Maven' : 'Gradle'} LSP Hover tests`);

Expand Down Expand Up @@ -59,27 +59,26 @@ export function runHoverTestSuite(config: HoverConfig){
});

after(async function() {
this.timeout(10000); // Increase timeout for cleanup operations
// Close editor after all tests complete
this.timeout(45000);
try {
await new EditorView().closeAllEditors();
logger.info('Closed all editors after test suite');
} catch (error) {
logger.error('Failed to close editors in after hook', error);
}

await utils.closeWorkspace();
utils.copyScreenshotsToProjectFolder(config.buildTool);
});

it('Liberty Language Server should initialize', async function() {
this.timeout(60000);
this.timeout(300000);
logger.testStart('Liberty Language Server should initialize');

try {
await utils.waitForLanguageServerInit(
'Language Support for Liberty',
'Initialized Liberty Language server',
60
240
);
logger.testComplete('Liberty Language Server initialized successfully');
} catch (error) {
Expand Down Expand Up @@ -139,14 +138,14 @@ export function runHoverTestSuite(config: HoverConfig){
});

it('LSP4Jakarta Language Server should initialize', async function() {
this.timeout(60000);
this.timeout(300000);
logger.testStart('LSP4Jakarta Language Server should initialize');

try {
await utils.waitForLanguageServerInit(
'Language Support for Jakarta EE',
'Initializing Jakarta EE server',
60
240
);
logger.testComplete('LSP4Jakarta Language Server initialized successfully');
} catch (error) {
Expand Down
15 changes: 8 additions & 7 deletions src/test/shared/restSnippetSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export function runRestSnippetSuite(config: RestSnippetConfig) {
);

before(async function() {
this.timeout(60000);
this.timeout(120000);
logger.info('Setting up rest_class snippet test');

driver = VSBrowser.instance.driver;
wait = utils.getWaitHelper();
// Open folder, wait for workbench
wait = utils.getWaitHelper();
// Open folder, wait for workbench
await VSBrowser.instance.openResources(config.getProjectPath());
await VSBrowser.instance.waitForWorkbench();

Expand All @@ -58,7 +58,7 @@ export function runRestSnippetSuite(config: RestSnippetConfig) {
});

after(async function() {
this.timeout(15000);
this.timeout(60000);
try {
if (editorPage) {
// Select all text first, then clear
Expand All @@ -85,25 +85,26 @@ export function runRestSnippetSuite(config: RestSnippetConfig) {
logger.error('Failed to close editors in after hook', error);
}

await utils.closeWorkspace();
utils.copyScreenshotsToProjectFolder(config.buildTool);
});

it('LSP4Jakarta Language Server should initialize', async function() {
this.timeout(60000);
this.timeout(300000);
logger.testStart('LSP4Jakarta Language Server should initialize');

try {
await utils.waitForLanguageServerInit(
'Language Support for Jakarta EE',
'Initializing Jakarta EE server',
60
240
);
logger.testComplete('LSP4Jakarta Language Server initialized successfully');
} catch (error) {
logger.testFailed('LSP4Jakarta Language Server should initialize', error);
throw error;
}
});
});

it('rest_class snippet populates correct REST class', async function () {
this.timeout(275000);
Expand Down
Loading
Loading