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
2 changes: 1 addition & 1 deletion src/test/Gradle9TestDevModeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('Gradle 9-specific devmode action tests', () => {
* Closing the workspace ensures the next test file starts with a clean slate.
*/
after(async function() {
this.timeout(10000);
this.timeout(45000);
await utils.closeWorkspace();
});
});
2 changes: 1 addition & 1 deletion src/test/GradleTestDevModeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('Gradle-specific devmode action tests', () => {
* Closing the workspace ensures the next test file starts with a clean slate.
*/
after(async function() {
this.timeout(10000);
this.timeout(60000);
await utils.closeWorkspace();
});
});
2 changes: 1 addition & 1 deletion src/test/MavenTestDevModeActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ describe('Maven-specific devmode action tests', () => {
* The following after hook closes the workspace so the next test file starts with a clean slate.
*/
after(async function() {
this.timeout(10000);
this.timeout(45000);
await utils.closeWorkspace();
});
});
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
47 changes: 38 additions & 9 deletions src/test/shared/devModeTestSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,33 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
describe(`Devmode action tests for ${config.buildTool} Project`, () => {

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

await VSBrowser.instance.openResources(config.getProjectPath());
await VSBrowser.instance.waitForWorkbench();


// Wait for the Liberty LS to initialize before any test runs.
// registerTreeDataProvider is only called after startLangServer
// resolves — without this, waitForDashboardToLoad polls an empty
// tree for minutes on cold mac-previous runners.
// Non-fatal: if the LS doesn't init in time we proceed anyway and
// let waitForDashboardToLoad handle the remaining wait — this avoids
// skipping the entire suite when the before() hook itself times out.
try {
await utils.waitForLanguageServerInit(
'Language Support for Liberty',
'Initialized Liberty Language server',
420
);
} catch {
logger.info('Liberty LS did not init within before() budget — proceeding anyway');
}

dashboard = new DashboardPage();
});

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 @@ -73,16 +90,20 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
logger.testStart('Liberty Tools shows items - Maven');
try {
logger.step(1, 'Getting dashboard section');
const section = await dashboard.getSection();
const section = await dashboard.getSection();
logger.stepSuccess(1, 'Dashboard section retrieved');

logger.step(2, 'Waiting for Liberty Tools to load');
await utils.waitForDashboardToLoad(section);
logger.stepSuccess(2, 'Liberty Tools loaded successfully');

// waitForDashboardToLoad already confirmed items exist on a fresh
// section reference. Re-fetch here so getVisibleItems() doesn't
// operate on the original stale reference from before the wait.
logger.step(3, 'Getting visible items from section');
const freshSection = await dashboard.getSection();
const menu = await utils.waitForCondition(async () => {
const items = await section.getVisibleItems();
const items = await freshSection.getVisibleItems();
if (items && items.length > 0) {
return items;
}
Expand All @@ -92,7 +113,7 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
expect(menu).not.empty;

logger.step(4, `Finding Maven project item: ${config.projectConstant}`);
const item = await dashboard.getProjectItem(config.projectConstant);
const item = await dashboard.getProjectItem(config.projectConstant);
logger.stepSuccess(4, 'Maven project item found');
expect(item).not.undefined;

Expand All @@ -101,7 +122,7 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
logger.testFailed(`Liberty Tools shows items - ${config.buildTool}`, error);
throw error;
}
}).timeout(275000);
}).timeout(480000);

it(`Start ${config.buildTool} project from Liberty Tools`, async () => {
logger.testStart('Start Maven project from Liberty Tools');
Expand Down Expand Up @@ -293,9 +314,17 @@ export function runDevModeTestSuite(config: DevModeConfig): void {
}).timeout(350000);

/**
* 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.
* The following after hook restores the Explorer view (in case the
* attach-debugger test left VS Code in the Debug perspective — on mac
* Previous this does not auto-restore) then copies screenshots.
*/
after(() => {
after(async function() {
this.timeout(30000);
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: 6 additions & 9 deletions src/test/shared/restSnippetSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ 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;
Expand All @@ -58,45 +58,42 @@ export function runRestSnippetSuite(config: RestSnippetConfig) {
});

after(async function() {
this.timeout(15000);
this.timeout(60000);
try {
if (editorPage) {
// Select all text first, then clear
const currentText = await editorPage.getEditor().getText();
try {
await editorPage.getEditor().selectText(currentText);
await wait.sleep(300);
} catch (selectError) {
// selectText may fail but setText still works
}

await editorUtils.clearEditor(editorPage.getEditor())
await editorUtils.clearEditor(editorPage.getEditor());
logger.info('Reset TestRest.java to empty after test');
}
} catch (error) {
logger.error('Failed to reset TestRest.java', error);
}

try {
await new EditorView().closeAllEditors();
await wait.sleep(500);
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('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
Loading
Loading