Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
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: 12 additions & 4 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 @@ -293,9 +293,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