From 2fe17aa130441fbb31840cc381cd10bda2be591c Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Wed, 8 Jan 2025 18:51:19 +0530 Subject: [PATCH 01/22] commented code for test --- src/test/GradleTestDevModeActions.ts | 322 +++++++++++++-------------- 1 file changed, 157 insertions(+), 165 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 55994e41..643ac39e 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -66,194 +66,186 @@ it('Start gradle project from liberty dashboard', async () => { }).timeout(350000); -it('Run tests for gradle project', async () => { +// it('Run tests for gradle project', async () => { - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - console.log("after checkTerminalforServerState"); - if(!serverStartStatus) - console.log("Server started message not found in the terminal"); - else - { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); - const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); - if(!serverStopStatus) - console.error("Server stopped message not found in the terminal"); - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; - expect (testStatus).to.be.true; -} - expect (serverStartStatus).to.be.true; +// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); +// await utils.delay(30000); +// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); +// console.log("after checkTerminalforServerState"); +// if(!serverStartStatus) +// console.log("Server started message not found in the terminal"); +// else +// { +// console.log("Server succuessfully started"); +// await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); +// const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); +// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); +// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); +// if(!serverStopStatus) +// console.error("Server stopped message not found in the terminal"); +// else +// console.log("Server stopped successfully"); +// expect (serverStopStatus).to.be.true; +// expect (testStatus).to.be.true; +// } +// expect (serverStartStatus).to.be.true; -}).timeout(350000); +// }).timeout(350000); -it('start gradle with options from liberty dashboard', async () => { +// it('start gradle with options from liberty dashboard', async () => { - const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); - expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("--hotTests"); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if(!serverStartStatus) - console.log("Server started with params message not found in terminal "); - else - { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - console.log("after dashboard action"); - const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); - if(!serverStopStatus) - console.error("Server stopped message not found in ther terminal"); - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; - expect (checkFile).to.be.true; -} - expect (serverStartStatus).to.be.true; +// const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); +// const deleteReport = await utils.deleteReports(reportPath); +// expect (deleteReport).to.be.true; +// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); +// await utils.setCustomParameter("--hotTests"); +// await utils.delay(30000); +// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); +// if(!serverStartStatus) +// console.log("Server started with params message not found in terminal "); +// else +// { +// console.log("Server succuessfully started"); +// let checkFile = await utils.checkIfTestReportExists(reportPath); +// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); +// console.log("after dashboard action"); +// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); +// if(!serverStopStatus) +// console.error("Server stopped message not found in ther terminal"); +// else +// console.log("Server stopped successfully"); +// expect (serverStopStatus).to.be.true; +// expect (checkFile).to.be.true; +// } +// expect (serverStartStatus).to.be.true; -}).timeout(550000); - -it('start gradle with history from liberty dashboard', async () => { - - const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); - expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); - console.log("foundcmd:" + foundCommand); - expect (foundCommand).to.be.true; - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if(!serverStartStatus) - console.log("Server started with params message not found in the terminal "); - else - { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); - if(!serverStopStatus) - console.error("Server stopped message not found in terminal"); - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; - expect (checkFile).to.be.true; -} - expect (serverStartStatus).to.be.true; +// }).timeout(550000); + +// it('start gradle with history from liberty dashboard', async () => { + +// const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); +// const deleteReport = await utils.deleteReports(reportPath); +// expect (deleteReport).to.be.true; +// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); +// const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); +// console.log("foundcmd:" + foundCommand); +// expect (foundCommand).to.be.true; +// await utils.delay(30000); +// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); +// if(!serverStartStatus) +// console.log("Server started with params message not found in the terminal "); +// else +// { +// console.log("Server succuessfully started"); +// let checkFile = await utils.checkIfTestReportExists(reportPath); +// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); +// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); +// if(!serverStopStatus) +// console.error("Server stopped message not found in terminal"); +// else +// console.log("Server stopped successfully"); +// expect (serverStopStatus).to.be.true; +// expect (checkFile).to.be.true; +// } +// expect (serverStartStatus).to.be.true; -}).timeout(350000); - - - - +// }).timeout(350000); - - - - - - - - - - -it('attach debugger for gradle with custom parameter event', async () => { - console.log("start attach debugger"); - let isServerRunning: Boolean = true; - let attachStatus: Boolean = false; - try { - await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("-DdebugPort=7777"); - await utils.delay(30000); +// it('attach debugger for gradle with custom parameter event', async () => { +// console.log("start attach debugger"); +// let isServerRunning: Boolean = true; +// let attachStatus: Boolean = false; +// try { +// await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); +// await utils.setCustomParameter("-DdebugPort=7777"); +// await utils.delay(30000); - isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if (!isServerRunning) - console.log("Server started with params message not found in terminal"); - else { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); - console.log("Attach Debugger action done"); - await utils.delay(8000); - const contentPart = debugView.getContent(); - //console.log("Get Content"); +// isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); +// if (!isServerRunning) +// console.log("Server started with params message not found in terminal"); +// else { +// console.log("Server succuessfully started"); +// await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); +// console.log("Attach Debugger action done"); +// await utils.delay(8000); +// const contentPart = debugView.getContent(); +// //console.log("Get Content"); - let mysecarry: Promise = contentPart.getSections(); - let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); - for (const [key, value] of (mysecmap)) { - if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { - //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); - console.log("Found Breakpoints"); - attachStatus = true; - break; - } - } - - await utils.stopLibertyserver(); - isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning - if (!isServerRunning) - console.log("Server stopped successfully "); - } - } catch (e) { - console.error("error - ", e) - } finally { - console.log("finally block: is server running - ", isServerRunning); - if (isServerRunning) { - utils.stopLibertyserver(); - } - else - console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); - } - expect(attachStatus).to.be.true; -}).timeout(550000); - -it('start gradle with docker from liberty dashboard', async () => { +// let mysecarry: Promise = contentPart.getSections(); +// let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); +// for (const [key, value] of (mysecmap)) { +// if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { +// //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); +// console.log("Found Breakpoints"); +// attachStatus = true; +// break; +// } +// } + +// await utils.stopLibertyserver(); +// isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning +// if (!isServerRunning) +// console.log("Server stopped successfully "); +// } +// } catch (e) { +// console.error("error - ", e) +// } finally { +// console.log("finally block: is server running - ", isServerRunning); +// if (isServerRunning) { +// utils.stopLibertyserver(); +// } +// else +// console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); +// } +// expect(attachStatus).to.be.true; +// }).timeout(550000); + +// it('start gradle with docker from liberty dashboard', async () => { - if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) - { - //skip running for platforms , enable them for linux after resolving docker setup in GHA - return true; - } +// if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) +// { +// //skip running for platforms , enable them for linux after resolving docker setup in GHA +// return true; +// } - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); - await utils.delay(60000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if(!serverStartStatus) - console.log("Server started message not found in the terminal"); - else - { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); - if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; -} - expect (serverStartStatus).to.be.true; +// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); +// await utils.delay(60000); +// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); +// if(!serverStartStatus) +// console.log("Server started message not found in the terminal"); +// else +// { +// console.log("Server succuessfully started"); +// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); +// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); +// if(!serverStopStatus){ +// console.error("Server stopped message not found in the terminal"); +// } +// else +// console.log("Server stopped successfully"); +// expect (serverStopStatus).to.be.true; +// } +// expect (serverStartStatus).to.be.true; -}).timeout(350000); +// }).timeout(350000); it('View test report for gradle project', async () => { if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) { - //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved + // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved return true; + + // section = await contentPart.getSection('Liberty Dashboard'); + // console.log("Found Liberty Dashboard...."); + // const focusTargtElemnt = findElement(By.xpath("//*[contains(text(), 'wrong')]")); + + } await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); From 8dc481ce41f84cff2b766c95c465eee8f8ec664a Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Wed, 8 Jan 2025 19:43:34 +0530 Subject: [PATCH 02/22] test for integration test --- src/test/GradleTestDevModeActions.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 643ac39e..efa84be4 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -236,17 +236,17 @@ it('Start gradle project from liberty dashboard', async () => { it('View test report for gradle project', async () => { - if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) - { - // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved - return true; + // if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) + // { + // // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved + // return true; - // section = await contentPart.getSection('Liberty Dashboard'); - // console.log("Found Liberty Dashboard...."); - // const focusTargtElemnt = findElement(By.xpath("//*[contains(text(), 'wrong')]")); + // // section = await contentPart.getSection('Liberty Dashboard'); + // // console.log("Found Liberty Dashboard...."); + // // const focusTargtElemnt = findElement(By.xpath("//*[contains(text(), 'wrong')]")); - } + // } await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); From 39bcdd53284009e6342ebd090ce4acd4c0990e5b Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Wed, 8 Jan 2025 20:04:11 +0530 Subject: [PATCH 03/22] removed unwanted code --- src/test/GradleTestDevModeActions.ts | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index efa84be4..749bb613 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -236,17 +236,11 @@ it('Start gradle project from liberty dashboard', async () => { it('View test report for gradle project', async () => { - // if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) - // { - // // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved - // return true; - - // // section = await contentPart.getSection('Liberty Dashboard'); - // // console.log("Found Liberty Dashboard...."); - // // const focusTargtElemnt = findElement(By.xpath("//*[contains(text(), 'wrong')]")); - - - // } + if((process.platform === 'darwin' )) + { + // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved + return true; + } await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); From e14f49820b847a66dc5c76c185a1b069dae24e5c Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 22:51:39 +0530 Subject: [PATCH 04/22] Automated test debug entries added --- .vscode/launch.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1736de24..f27c1143 100755 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,6 +5,12 @@ { "version": "0.2.0", "configurations": [ + { + "command": "npm run test-mac-gradle", + "name": "Run npm start", + "request": "launch", + "type": "node-terminal" + }, { "name": "Run Extension", "type": "extensionHost", From 0087a6488774cc9db84e616b3d15b00d95e38803 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 22:52:56 +0530 Subject: [PATCH 05/22] print for debug added - devCommands --- src/liberty/devCommands.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/liberty/devCommands.ts b/src/liberty/devCommands.ts index ad222aea..0189eeaf 100644 --- a/src/liberty/devCommands.ts +++ b/src/liberty/devCommands.ts @@ -39,6 +39,8 @@ class LibertyProjectQuickPickItem implements QuickPickItem { // eslint-disable-next-line @typescript-eslint/ban-types function showProjects(command: string, callback: Function, reportType?: string): void { + console.log("Inside showProjects else if command"+ command); + console.log("Inside showProjects else if reportType"+ reportType); const projectProvider: ProjectProvider = ProjectProvider.getInstance(); // Find a list of projects that can be started const projects: LibertyProject[] = filterProjects(Array.from(projectProvider.getProjects().values()), @@ -478,6 +480,7 @@ export async function runTests(libProject?: LibertyProject | undefined): Promise // open surefire, failsafe, or gradle test report export async function openReport(reportType: string, libProject?: LibertyProject | undefined): Promise { + console.log("Inside openProject"); if (libProject !== undefined) { const path = Path.dirname(libProject.getPath()); if (path !== undefined) { @@ -505,6 +508,7 @@ export async function openReport(reportType: string, libProject?: LibertyProject } } } else if (ProjectProvider.getInstance() && reportType) { + console.log("Inside openProject else if"); showProjects(reportType, openReport, reportType); } else { const message = localize("cannot.open.test.reports.on.undefined.project"); From 184597731eda0930988de61257da73f29e7da3c2 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 22:53:29 +0530 Subject: [PATCH 06/22] print for debug added --- src/util/helperUtil.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/helperUtil.ts b/src/util/helperUtil.ts index 277ed455..fde35651 100644 --- a/src/util/helperUtil.ts +++ b/src/util/helperUtil.ts @@ -42,6 +42,7 @@ export function getConfiguration(section: string, resourceOrFilepath?: vscode * @returns a list of projects that the given command can be excuted on. */ export function filterProjects(projects: LibertyProject[], command: string): LibertyProject[] { + console.log("inside filterProjects printing command"+ command); const resultProjects: LibertyProject[] = []; for ( const project of projects) { const applicableTypes = COMMAND_AND_PROJECT_TYPE_MAP[command]; From 7b7a7979a82c52b66434ef975a6eb57f811a34ca Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 22:54:12 +0530 Subject: [PATCH 07/22] fix for test report issue --- src/test/GradleTestDevModeActions.ts | 29 ++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 749bb613..d3a741cf 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -1,8 +1,9 @@ import { expect } from 'chai'; -import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem, DebugView } from 'vscode-extension-tester'; +import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem, DebugView, By } from 'vscode-extension-tester'; import * as utils from './utils/testUtils'; import * as constants from './definitions/constants'; import path = require('path'); +import { setInputBox } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { let sidebar: SideBarView; @@ -239,19 +240,35 @@ it('View test report for gradle project', async () => { if((process.platform === 'darwin' )) { // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved - return true; - } + // return true; + const workbench = new Workbench(); + await workbench.openCommandPrompt(); + // await utils.delay(30000); + await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + await utils.delay(3000); + // await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + setInputBox(constants.GRADLE_PROJECT); + await utils.delay(2500); - await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + tabs = await new EditorView().getOpenEditorTitles(); + console.log("Printing tabs: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); + await utils.delay(5000); + // expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); + }else{ + await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); - // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); - expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); + // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); + expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); + } + + }).timeout(30000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests. it('Clear Command Palatte', async () => { + await utils.delay(3000); await utils.clearCommandPalette(); }).timeout(100000); From a1e688f4313d17aba3a85e7a4f6fa1961132b5b4 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 22:56:52 +0530 Subject: [PATCH 08/22] delay added for command palette --- src/test/GradleTestDevModeActions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index d3a741cf..bacc791f 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -243,7 +243,7 @@ it('View test report for gradle project', async () => { // return true; const workbench = new Workbench(); await workbench.openCommandPrompt(); - // await utils.delay(30000); + await utils.delay(30000); await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); await utils.delay(3000); // await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); From 088928281082e884d770f3e2c4e0c8cd6e531cea Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Mon, 13 Jan 2025 23:10:46 +0530 Subject: [PATCH 09/22] time delay increased --- src/test/GradleTestDevModeActions.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index bacc791f..e8068ab6 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -252,8 +252,8 @@ it('View test report for gradle project', async () => { tabs = await new EditorView().getOpenEditorTitles(); console.log("Printing tabs: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); - await utils.delay(5000); - // expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); + await utils.delay(1000); + expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); }else{ await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); @@ -263,7 +263,7 @@ it('View test report for gradle project', async () => { -}).timeout(30000); +}).timeout(50000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests. From 4a2f01fd0450abaf36f938fc0e546faba1e69278 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 10:14:53 +0530 Subject: [PATCH 10/22] Removed unwanted lines --- src/test/GradleTestDevModeActions.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index e8068ab6..e426380f 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -239,19 +239,17 @@ it('View test report for gradle project', async () => { if((process.platform === 'darwin' )) { - // //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved - // return true; const workbench = new Workbench(); await workbench.openCommandPrompt(); await utils.delay(30000); await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); await utils.delay(3000); - // await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + setInputBox(constants.GRADLE_PROJECT); await utils.delay(2500); - + tabs = await new EditorView().getOpenEditorTitles(); - console.log("Printing tabs: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); + console.log("Tabs opened: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); await utils.delay(1000); expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); }else{ @@ -259,10 +257,7 @@ it('View test report for gradle project', async () => { tabs = await new EditorView().getOpenEditorTitles(); // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); - } - - - + } }).timeout(50000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. From c843c2941f4e7449a63f4d8e37fe765ea6609d79 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 10:23:57 +0530 Subject: [PATCH 11/22] code modified --- src/test/GradleTestDevModeActions.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index e426380f..844ba4e5 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -241,23 +241,21 @@ it('View test report for gradle project', async () => { { const workbench = new Workbench(); await workbench.openCommandPrompt(); - await utils.delay(30000); + await utils.delay(3000); await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); await utils.delay(3000); setInputBox(constants.GRADLE_PROJECT); await utils.delay(2500); - - tabs = await new EditorView().getOpenEditorTitles(); - console.log("Tabs opened: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); - await utils.delay(1000); - expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); }else{ await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); - expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); } + tabs = await new EditorView().getOpenEditorTitles(); + await utils.delay(1000); + console.log("Tabs opened: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); + expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); }).timeout(50000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. From 4bc0e4187a2dae700179aa947093c93e1ea54a99 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 11:23:50 +0530 Subject: [PATCH 12/22] enabled commented test cases --- src/test/GradleTestDevModeActions.ts | 340 +++++++++++++-------------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 844ba4e5..bc4ee54f 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -67,203 +67,203 @@ it('Start gradle project from liberty dashboard', async () => { }).timeout(350000); -// it('Run tests for gradle project', async () => { +it('Run tests for gradle project', async () => { -// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); -// await utils.delay(30000); -// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); -// console.log("after checkTerminalforServerState"); -// if(!serverStartStatus) -// console.log("Server started message not found in the terminal"); -// else -// { -// console.log("Server succuessfully started"); -// await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); -// const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); -// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); -// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); -// if(!serverStopStatus) -// console.error("Server stopped message not found in the terminal"); -// else -// console.log("Server stopped successfully"); -// expect (serverStopStatus).to.be.true; -// expect (testStatus).to.be.true; -// } -// expect (serverStartStatus).to.be.true; + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + console.log("after checkTerminalforServerState"); + if(!serverStartStatus) + console.log("Server started message not found in the terminal"); + else + { + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); + const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); + if(!serverStopStatus) + console.error("Server stopped message not found in the terminal"); + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; + expect (testStatus).to.be.true; +} + expect (serverStartStatus).to.be.true; -// }).timeout(350000); +}).timeout(350000); -// it('start gradle with options from liberty dashboard', async () => { +it('start gradle with options from liberty dashboard', async () => { -// const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); -// const deleteReport = await utils.deleteReports(reportPath); -// expect (deleteReport).to.be.true; -// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); -// await utils.setCustomParameter("--hotTests"); -// await utils.delay(30000); -// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); -// if(!serverStartStatus) -// console.log("Server started with params message not found in terminal "); -// else -// { -// console.log("Server succuessfully started"); -// let checkFile = await utils.checkIfTestReportExists(reportPath); -// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); -// console.log("after dashboard action"); -// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); -// if(!serverStopStatus) -// console.error("Server stopped message not found in ther terminal"); -// else -// console.log("Server stopped successfully"); -// expect (serverStopStatus).to.be.true; -// expect (checkFile).to.be.true; -// } -// expect (serverStartStatus).to.be.true; + const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); + const deleteReport = await utils.deleteReports(reportPath); + expect (deleteReport).to.be.true; + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + await utils.setCustomParameter("--hotTests"); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if(!serverStartStatus) + console.log("Server started with params message not found in terminal "); + else + { + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("after dashboard action"); + const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); + if(!serverStopStatus) + console.error("Server stopped message not found in ther terminal"); + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; + expect (checkFile).to.be.true; +} + expect (serverStartStatus).to.be.true; -// }).timeout(550000); +}).timeout(550000); -// it('start gradle with history from liberty dashboard', async () => { +it('start gradle with history from liberty dashboard', async () => { -// const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); -// const deleteReport = await utils.deleteReports(reportPath); -// expect (deleteReport).to.be.true; -// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); -// const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); -// console.log("foundcmd:" + foundCommand); -// expect (foundCommand).to.be.true; -// await utils.delay(30000); -// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); -// if(!serverStartStatus) -// console.log("Server started with params message not found in the terminal "); -// else -// { -// console.log("Server succuessfully started"); -// let checkFile = await utils.checkIfTestReportExists(reportPath); -// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); -// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); -// if(!serverStopStatus) -// console.error("Server stopped message not found in terminal"); -// else -// console.log("Server stopped successfully"); -// expect (serverStopStatus).to.be.true; -// expect (checkFile).to.be.true; -// } -// expect (serverStartStatus).to.be.true; + const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); + const deleteReport = await utils.deleteReports(reportPath); + expect (deleteReport).to.be.true; + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); + console.log("foundcmd:" + foundCommand); + expect (foundCommand).to.be.true; + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if(!serverStartStatus) + console.log("Server started with params message not found in the terminal "); + else + { + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); + if(!serverStopStatus) + console.error("Server stopped message not found in terminal"); + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; + expect (checkFile).to.be.true; +} + expect (serverStartStatus).to.be.true; -// }).timeout(350000); +}).timeout(350000); -// it('attach debugger for gradle with custom parameter event', async () => { -// console.log("start attach debugger"); -// let isServerRunning: Boolean = true; -// let attachStatus: Boolean = false; -// try { -// await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); -// await utils.setCustomParameter("-DdebugPort=7777"); -// await utils.delay(30000); +it('attach debugger for gradle with custom parameter event', async () => { + console.log("start attach debugger"); + let isServerRunning: Boolean = true; + let attachStatus: Boolean = false; + try { + await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + await utils.setCustomParameter("-DdebugPort=7777"); + await utils.delay(30000); -// isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); -// if (!isServerRunning) -// console.log("Server started with params message not found in terminal"); -// else { -// console.log("Server succuessfully started"); -// await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); -// console.log("Attach Debugger action done"); -// await utils.delay(8000); -// const contentPart = debugView.getContent(); -// //console.log("Get Content"); + isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if (!isServerRunning) + console.log("Server started with params message not found in terminal"); + else { + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); + console.log("Attach Debugger action done"); + await utils.delay(8000); + const contentPart = debugView.getContent(); + //console.log("Get Content"); -// let mysecarry: Promise = contentPart.getSections(); -// let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); -// for (const [key, value] of (mysecmap)) { -// if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { -// //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); -// console.log("Found Breakpoints"); -// attachStatus = true; -// break; -// } -// } + let mysecarry: Promise = contentPart.getSections(); + let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); + for (const [key, value] of (mysecmap)) { + if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { + //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); + console.log("Found Breakpoints"); + attachStatus = true; + break; + } + } -// await utils.stopLibertyserver(); -// isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning -// if (!isServerRunning) -// console.log("Server stopped successfully "); -// } -// } catch (e) { -// console.error("error - ", e) -// } finally { -// console.log("finally block: is server running - ", isServerRunning); -// if (isServerRunning) { -// utils.stopLibertyserver(); -// } -// else -// console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); -// } -// expect(attachStatus).to.be.true; -// }).timeout(550000); + await utils.stopLibertyserver(); + isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning + if (!isServerRunning) + console.log("Server stopped successfully "); + } + } catch (e) { + console.error("error - ", e) + } finally { + console.log("finally block: is server running - ", isServerRunning); + if (isServerRunning) { + utils.stopLibertyserver(); + } + else + console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); + } + expect(attachStatus).to.be.true; +}).timeout(550000); -// it('start gradle with docker from liberty dashboard', async () => { +it('start gradle with docker from liberty dashboard', async () => { -// if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) -// { -// //skip running for platforms , enable them for linux after resolving docker setup in GHA -// return true; -// } + if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) + { + //skip running for platforms , enable them for linux after resolving docker setup in GHA + return true; + } -// await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); -// await utils.delay(60000); -// const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); -// if(!serverStartStatus) -// console.log("Server started message not found in the terminal"); -// else -// { -// console.log("Server succuessfully started"); -// await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); -// const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); -// if(!serverStopStatus){ -// console.error("Server stopped message not found in the terminal"); -// } -// else -// console.log("Server stopped successfully"); -// expect (serverStopStatus).to.be.true; -// } -// expect (serverStartStatus).to.be.true; + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); + await utils.delay(60000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if(!serverStartStatus) + console.log("Server started message not found in the terminal"); + else + { + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); + if(!serverStopStatus){ + console.error("Server stopped message not found in the terminal"); + } + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; +} + expect (serverStartStatus).to.be.true; -// }).timeout(350000); +}).timeout(350000); -it('View test report for gradle project', async () => { + it('View test report for gradle project', async () => { - if((process.platform === 'darwin' )) - { - const workbench = new Workbench(); - await workbench.openCommandPrompt(); - await utils.delay(3000); - await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); - await utils.delay(3000); + if ((process.platform === 'darwin')) { + const workbench = new Workbench(); + await workbench.openCommandPrompt(); + await utils.delay(3000); + await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + await utils.delay(3000); - setInputBox(constants.GRADLE_PROJECT); - await utils.delay(2500); - }else{ - await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); - tabs = await new EditorView().getOpenEditorTitles(); - // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); - } - tabs = await new EditorView().getOpenEditorTitles(); - await utils.delay(1000); - console.log("Tabs opened: "+tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); - expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); -}).timeout(50000); + setInputBox(constants.GRADLE_PROJECT); + await utils.delay(2500); + } else { + await utils.launchDashboardAction(item, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + tabs = await new EditorView().getOpenEditorTitles(); + // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); + } + tabs = await new EditorView().getOpenEditorTitles(); + await utils.delay(1000); + console.log("Tabs opened: " + tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); + + expect(tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE) > -1, "Gradle test report not found").to.equal(true); + }).timeout(60000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests. -it('Clear Command Palatte', async () => { - await utils.delay(3000); - await utils.clearCommandPalette(); -}).timeout(100000); + it('Clear Command Palatte', async () => { + await utils.delay(3000); + await utils.clearCommandPalette(); + }).timeout(100000); }); From 975ce88268e39ae578f0a38ea9e57028d5bf470a Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 18:38:57 +0530 Subject: [PATCH 13/22] code modified to display test report --- src/test/GradleTestDevModeActions.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index bc4ee54f..4639bf44 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -3,7 +3,7 @@ import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem import * as utils from './utils/testUtils'; import * as constants from './definitions/constants'; import path = require('path'); -import { setInputBox } from './utils/macUtils'; +import { viewTestReportForMac } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { let sidebar: SideBarView; @@ -238,14 +238,7 @@ it('start gradle with docker from liberty dashboard', async () => { it('View test report for gradle project', async () => { if ((process.platform === 'darwin')) { - const workbench = new Workbench(); - await workbench.openCommandPrompt(); - await utils.delay(3000); - await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); - await utils.delay(3000); - - setInputBox(constants.GRADLE_PROJECT); - await utils.delay(2500); + await viewTestReportForMac(); } else { await utils.launchDashboardAction(item, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); tabs = await new EditorView().getOpenEditorTitles(); From d5719ed5f2bd91073c28047f39502be379f1730e Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 18:39:34 +0530 Subject: [PATCH 14/22] code added in macUtils --- src/test/utils/macUtils.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/utils/macUtils.ts b/src/test/utils/macUtils.ts index 288844b0..abfa2537 100755 --- a/src/test/utils/macUtils.ts +++ b/src/test/utils/macUtils.ts @@ -4,7 +4,8 @@ import { DefaultTreeItem, Workbench, InputBox, } from "vscode-extension-tester"; - +import * as utils from './testUtils'; +import * as constants from '../definitions/constants'; // NOTE: For MAC OS, Open issue with vscode-extension-tester for ContextMenu Click -> https://github.com/redhat-developer/vscode-extension-tester/issues/444 // So workaround using InputBOx to Map the contextmenu input to its corresponding Action for MAC till the issue is resolved in tool @@ -24,4 +25,15 @@ export async function setInputBox(MapActionString: string): Promise { } else { return false; } +} + +export async function viewTestReportForMac() { + const workbench = new Workbench(); + await workbench.openCommandPrompt(); + await utils.delay(3000); + await workbench.executeCommand(constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + await utils.delay(3000); + + setInputBox(constants.GRADLE_PROJECT); + await utils.delay(2500); } \ No newline at end of file From 522e3069e7e3987bf94efd1f103cd8775cb34adb Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 18:45:16 +0530 Subject: [PATCH 15/22] Documentation added Documentation added --- src/test/GradleTestDevModeActions.ts | 1 + src/test/utils/macUtils.ts | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 4639bf44..15f9a4a9 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -238,6 +238,7 @@ it('start gradle with docker from liberty dashboard', async () => { it('View test report for gradle project', async () => { if ((process.platform === 'darwin')) { + //Function call to enter corresponding command in the command prompt to display test report for gradle project in mac await viewTestReportForMac(); } else { await utils.launchDashboardAction(item, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); diff --git a/src/test/utils/macUtils.ts b/src/test/utils/macUtils.ts index abfa2537..7b6b26c3 100755 --- a/src/test/utils/macUtils.ts +++ b/src/test/utils/macUtils.ts @@ -27,6 +27,9 @@ export async function setInputBox(MapActionString: string): Promise { } } +/** + * Function to enter corresponding command in the command prompt to display test report for gradle project + */ export async function viewTestReportForMac() { const workbench = new Workbench(); await workbench.openCommandPrompt(); From 3e03b214ab18dc2dacfe0b36daad6ee4e44945f2 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 18:53:24 +0530 Subject: [PATCH 16/22] removed print statements from helperUtils --- src/util/helperUtil.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/helperUtil.ts b/src/util/helperUtil.ts index fde35651..277ed455 100644 --- a/src/util/helperUtil.ts +++ b/src/util/helperUtil.ts @@ -42,7 +42,6 @@ export function getConfiguration(section: string, resourceOrFilepath?: vscode * @returns a list of projects that the given command can be excuted on. */ export function filterProjects(projects: LibertyProject[], command: string): LibertyProject[] { - console.log("inside filterProjects printing command"+ command); const resultProjects: LibertyProject[] = []; for ( const project of projects) { const applicableTypes = COMMAND_AND_PROJECT_TYPE_MAP[command]; From c9d101ba4a05976809234786551f5354586e08db Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 18:55:34 +0530 Subject: [PATCH 17/22] Print statements removed from devCommands --- src/liberty/devCommands.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/liberty/devCommands.ts b/src/liberty/devCommands.ts index 0189eeaf..ad222aea 100644 --- a/src/liberty/devCommands.ts +++ b/src/liberty/devCommands.ts @@ -39,8 +39,6 @@ class LibertyProjectQuickPickItem implements QuickPickItem { // eslint-disable-next-line @typescript-eslint/ban-types function showProjects(command: string, callback: Function, reportType?: string): void { - console.log("Inside showProjects else if command"+ command); - console.log("Inside showProjects else if reportType"+ reportType); const projectProvider: ProjectProvider = ProjectProvider.getInstance(); // Find a list of projects that can be started const projects: LibertyProject[] = filterProjects(Array.from(projectProvider.getProjects().values()), @@ -480,7 +478,6 @@ export async function runTests(libProject?: LibertyProject | undefined): Promise // open surefire, failsafe, or gradle test report export async function openReport(reportType: string, libProject?: LibertyProject | undefined): Promise { - console.log("Inside openProject"); if (libProject !== undefined) { const path = Path.dirname(libProject.getPath()); if (path !== undefined) { @@ -508,7 +505,6 @@ export async function openReport(reportType: string, libProject?: LibertyProject } } } else if (ProjectProvider.getInstance() && reportType) { - console.log("Inside openProject else if"); showProjects(reportType, openReport, reportType); } else { const message = localize("cannot.open.test.reports.on.undefined.project"); From 7d85a4fbefed7e1e6d43e86b6ffd180690b93cba Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 19:00:36 +0530 Subject: [PATCH 18/22] removed unwanted imports --- src/test/GradleTestDevModeActions.ts | 324 +++++++++++++-------------- 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 15f9a4a9..82faa743 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -1,239 +1,239 @@ import { expect } from 'chai'; -import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem, DebugView, By } from 'vscode-extension-tester'; +import { SideBarView, ViewSection, EditorView, DefaultTreeItem, DebugView } from 'vscode-extension-tester'; import * as utils from './utils/testUtils'; import * as constants from './definitions/constants'; import path = require('path'); import { viewTestReportForMac } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { - let sidebar: SideBarView; - let debugView: DebugView; - let section: ViewSection; - let item: DefaultTreeItem; - let tabs: string[]; + let sidebar: SideBarView; + let debugView: DebugView; + let section: ViewSection; + let item: DefaultTreeItem; + let tabs: string[]; - before(() => { - sidebar = new SideBarView(); - debugView = new DebugView(); - }); + before(() => { + sidebar = new SideBarView(); + debugView = new DebugView(); + }); it('getViewControl works with the correct label', async() => { - - const contentPart = sidebar.getContent(); - section = await contentPart.getSection('Liberty Dashboard'); - console.log("Found Liberty Dashboard...."); - expect(section).not.undefined; - -}).timeout(10000); + const contentPart = sidebar.getContent(); + section = await contentPart.getSection('Liberty Dashboard'); + console.log("Found Liberty Dashboard...."); + expect(section).not.undefined; -it('Open dasboard shows items - Gradle', async () => { + }).timeout(10000); + + + it('Open dasboard shows items - Gradle', async () => { // Wait for the Liberty Dashboard to load and expand. The dashboard only expands after using the 'expand()' method. await utils.delay(65000); - await section.expand(); + await section.expand(); await utils.delay(6000); - const menu = await section.getVisibleItems(); - expect(menu).not.empty; - item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem; - expect(item).not.undefined; - - -}).timeout(300000); - - -it('Start gradle project from liberty dashboard', async () => { - - + const menu = await section.getVisibleItems(); + expect(menu).not.empty; + item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem; + expect(item).not.undefined; + + + }).timeout(300000); + + + it('Start gradle project from liberty dashboard', async () => { + + await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION,constants.START_DASHBOARD_MAC_ACTION); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in the terminal"); + } + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; -} + } expect (serverStartStatus).to.be.true; - - -}).timeout(350000); - -it('Run tests for gradle project', async () => { - - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - console.log("after checkTerminalforServerState"); + + + }).timeout(350000); + + it('Run tests for gradle project', async () => { + + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + console.log("after checkTerminalforServerState"); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); + console.log("Server succuessfully started"); await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); - const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in the terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in the terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (testStatus).to.be.true; -} + } expect (serverStartStatus).to.be.true; - - -}).timeout(350000); -it('start gradle with options from liberty dashboard', async () => { - + }).timeout(350000); + + + it('start gradle with options from liberty dashboard', async () => { + const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); + const deleteReport = await utils.deleteReports(reportPath); expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("--hotTests"); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + await utils.setCustomParameter("--hotTests"); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started with params message not found in terminal "); + console.log("Server started with params message not found in terminal "); else { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - console.log("after dashboard action"); + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("after dashboard action"); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in ther terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in ther terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (checkFile).to.be.true; -} + } expect (serverStartStatus).to.be.true; - -}).timeout(550000); -it('start gradle with history from liberty dashboard', async () => { + }).timeout(550000); + + it('start gradle with history from liberty dashboard', async () => { const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); + const deleteReport = await utils.deleteReports(reportPath); expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); - console.log("foundcmd:" + foundCommand); + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); + console.log("foundcmd:" + foundCommand); expect (foundCommand).to.be.true; - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started with params message not found in the terminal "); + console.log("Server started with params message not found in the terminal "); else { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (checkFile).to.be.true; -} + } expect (serverStartStatus).to.be.true; - -}).timeout(350000); + }).timeout(350000); -it('attach debugger for gradle with custom parameter event', async () => { - console.log("start attach debugger"); - let isServerRunning: Boolean = true; - let attachStatus: Boolean = false; - try { + + it('attach debugger for gradle with custom parameter event', async () => { + console.log("start attach debugger"); + let isServerRunning: Boolean = true; + let attachStatus: Boolean = false; + try { await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("-DdebugPort=7777"); - await utils.delay(30000); - - isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if (!isServerRunning) - console.log("Server started with params message not found in terminal"); - else { - console.log("Server succuessfully started"); + await utils.setCustomParameter("-DdebugPort=7777"); + await utils.delay(30000); + + isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if (!isServerRunning) + console.log("Server started with params message not found in terminal"); + else { + console.log("Server succuessfully started"); await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); - console.log("Attach Debugger action done"); - await utils.delay(8000); - const contentPart = debugView.getContent(); - //console.log("Get Content"); - - let mysecarry: Promise = contentPart.getSections(); - let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); - for (const [key, value] of (mysecmap)) { - if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { - //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); - console.log("Found Breakpoints"); - attachStatus = true; - break; + console.log("Attach Debugger action done"); + await utils.delay(8000); + const contentPart = debugView.getContent(); + //console.log("Get Content"); + + let mysecarry: Promise = contentPart.getSections(); + let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); + for (const [key, value] of (mysecmap)) { + if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { + //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); + console.log("Found Breakpoints"); + attachStatus = true; + break; + } + } + + await utils.stopLibertyserver(); + isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning + if (!isServerRunning) + console.log("Server stopped successfully "); } + } catch (e) { + console.error("error - ", e) + } finally { + console.log("finally block: is server running - ", isServerRunning); + if (isServerRunning) { + utils.stopLibertyserver(); + } + else + console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); } + expect(attachStatus).to.be.true; + }).timeout(550000); + + it('start gradle with docker from liberty dashboard', async () => { - await utils.stopLibertyserver(); - isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning - if (!isServerRunning) - console.log("Server stopped successfully "); - } - } catch (e) { - console.error("error - ", e) - } finally { - console.log("finally block: is server running - ", isServerRunning); - if (isServerRunning) { - utils.stopLibertyserver(); - } - else - console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); - } - expect(attachStatus).to.be.true; -}).timeout(550000); - -it('start gradle with docker from liberty dashboard', async () => { - if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) { - //skip running for platforms , enable them for linux after resolving docker setup in GHA - return true; - } - - - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); - await utils.delay(60000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + //skip running for platforms , enable them for linux after resolving docker setup in GHA + return true; + } + + + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); + await utils.delay(60000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in the terminal"); + } + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; -} + } expect (serverStartStatus).to.be.true; - - -}).timeout(350000); + + + }).timeout(350000); it('View test report for gradle project', async () => { From 8e8a5caa0ce6a8f8072f0ef815b13fe3bb4d36f9 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 22:05:55 +0530 Subject: [PATCH 19/22] Reverted the aligment related changes for the code --- src/test/GradleTestDevModeActions.ts | 325 +++++++++++++-------------- 1 file changed, 162 insertions(+), 163 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 82faa743..6e2b881d 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -6,234 +6,234 @@ import path = require('path'); import { viewTestReportForMac } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { - let sidebar: SideBarView; - let debugView: DebugView; - let section: ViewSection; - let item: DefaultTreeItem; - let tabs: string[]; + let sidebar: SideBarView; + let debugView: DebugView; + let section: ViewSection; + let item: DefaultTreeItem; + let tabs: string[]; - before(() => { - sidebar = new SideBarView(); - debugView = new DebugView(); - }); + before(() => { + sidebar = new SideBarView(); + debugView = new DebugView(); + }); it('getViewControl works with the correct label', async() => { + + const contentPart = sidebar.getContent(); + section = await contentPart.getSection('Liberty Dashboard'); + console.log("Found Liberty Dashboard...."); + expect(section).not.undefined; + +}).timeout(10000); - const contentPart = sidebar.getContent(); - section = await contentPart.getSection('Liberty Dashboard'); - console.log("Found Liberty Dashboard...."); - expect(section).not.undefined; - }).timeout(10000); - - - it('Open dasboard shows items - Gradle', async () => { +it('Open dasboard shows items - Gradle', async () => { // Wait for the Liberty Dashboard to load and expand. The dashboard only expands after using the 'expand()' method. await utils.delay(65000); - await section.expand(); + await section.expand(); await utils.delay(6000); - const menu = await section.getVisibleItems(); - expect(menu).not.empty; - item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem; - expect(item).not.undefined; - - - }).timeout(300000); - - - it('Start gradle project from liberty dashboard', async () => { - - + const menu = await section.getVisibleItems(); + expect(menu).not.empty; + item = await section.findItem(constants.GRADLE_PROJECT) as DefaultTreeItem; + expect(item).not.undefined; + + +}).timeout(300000); + + +it('Start gradle project from liberty dashboard', async () => { + + await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION,constants.START_DASHBOARD_MAC_ACTION); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; + console.error("Server stopped message not found in the terminal"); } + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; +} expect (serverStartStatus).to.be.true; - - - }).timeout(350000); - - it('Run tests for gradle project', async () => { - - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - console.log("after checkTerminalforServerState"); + + +}).timeout(350000); + +it('Run tests for gradle project', async () => { + + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION, constants.START_DASHBOARD_MAC_ACTION); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + console.log("after checkTerminalforServerState"); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); + console.log("Server succuessfully started"); await utils.launchDashboardAction(item,constants.RUNTEST_DASHBOARD_ACTION,constants.RUNTEST_DASHBOARD_MAC_ACTION); - const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const testStatus = await utils.checkTestStatus(constants.GRADLE_TEST_RUN_STRING); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in the terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in the terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (testStatus).to.be.true; - } +} expect (serverStartStatus).to.be.true; + + +}).timeout(350000); - }).timeout(350000); - - - it('start gradle with options from liberty dashboard', async () => { - +it('start gradle with options from liberty dashboard', async () => { + const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); + const deleteReport = await utils.deleteReports(reportPath); expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("--hotTests"); - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + await utils.setCustomParameter("--hotTests"); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started with params message not found in terminal "); + console.log("Server started with params message not found in terminal "); else { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - console.log("after dashboard action"); + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("after dashboard action"); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in ther terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in ther terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (checkFile).to.be.true; - } +} expect (serverStartStatus).to.be.true; + +}).timeout(550000); - }).timeout(550000); - - it('start gradle with history from liberty dashboard', async () => { +it('start gradle with history from liberty dashboard', async () => { const reportPath = path.join(utils.getGradleProjectPath(),"build", "reports", "tests", "test", "index.html"); - const deleteReport = await utils.deleteReports(reportPath); + const deleteReport = await utils.deleteReports(reportPath); expect (deleteReport).to.be.true; - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); - console.log("foundcmd:" + foundCommand); + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); + const foundCommand = await utils.chooseCmdFromHistory("--hotTests"); + console.log("foundcmd:" + foundCommand); expect (foundCommand).to.be.true; - await utils.delay(30000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + await utils.delay(30000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started with params message not found in the terminal "); + console.log("Server started with params message not found in the terminal "); else { - console.log("Server succuessfully started"); - let checkFile = await utils.checkIfTestReportExists(reportPath); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + let checkFile = await utils.checkIfTestReportExists(reportPath); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus) - console.error("Server stopped message not found in terminal"); - else - console.log("Server stopped successfully"); + console.error("Server stopped message not found in terminal"); + else + console.log("Server stopped successfully"); expect (serverStopStatus).to.be.true; expect (checkFile).to.be.true; - } +} expect (serverStartStatus).to.be.true; - - }).timeout(350000); + +}).timeout(350000); - it('attach debugger for gradle with custom parameter event', async () => { - console.log("start attach debugger"); - let isServerRunning: Boolean = true; - let attachStatus: Boolean = false; - try { +it('attach debugger for gradle with custom parameter event', async () => { + console.log("start attach debugger"); + let isServerRunning: Boolean = true; + let attachStatus: Boolean = false; + try { await utils.launchDashboardAction(item,constants.START_DASHBOARD_ACTION_WITH_PARAM, constants.START_DASHBOARD_MAC_ACTION_WITH_PARAM); - await utils.setCustomParameter("-DdebugPort=7777"); - await utils.delay(30000); - - isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if (!isServerRunning) - console.log("Server started with params message not found in terminal"); - else { - console.log("Server succuessfully started"); + await utils.setCustomParameter("-DdebugPort=7777"); + await utils.delay(30000); + + isServerRunning = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if (!isServerRunning) + console.log("Server started with params message not found in terminal"); + else { + console.log("Server succuessfully started"); await utils.launchDashboardAction(item,constants.ATTACH_DEBUGGER_DASHBOARD_ACTION, constants.ATTACH_DEBUGGER_DASHBOARD_MAC_ACTION); - console.log("Attach Debugger action done"); - await utils.delay(8000); - const contentPart = debugView.getContent(); - //console.log("Get Content"); - - let mysecarry: Promise = contentPart.getSections(); - let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); - for (const [key, value] of (mysecmap)) { - if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { - //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); - console.log("Found Breakpoints"); - attachStatus = true; - break; - } - } - - await utils.stopLibertyserver(); - isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning - if (!isServerRunning) - console.log("Server stopped successfully "); - } - } catch (e) { - console.error("error - ", e) - } finally { - console.log("finally block: is server running - ", isServerRunning); - if (isServerRunning) { - utils.stopLibertyserver(); + console.log("Attach Debugger action done"); + await utils.delay(8000); + const contentPart = debugView.getContent(); + //console.log("Get Content"); + + let mysecarry: Promise = contentPart.getSections(); + let mysecmap: IterableIterator<[number, ViewSection]> = (await mysecarry).entries(); + for (const [key, value] of (mysecmap)) { + if ((await value.getEnclosingElement().getText()).includes("BREAKPOINTS")) { + //console.log("******** mysecmap getEnclosingElement " + (await value.getEnclosingElement().getText()).valueOf()); + console.log("Found Breakpoints"); + attachStatus = true; + break; } - else - console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); } - expect(attachStatus).to.be.true; - }).timeout(550000); - - it('start gradle with docker from liberty dashboard', async () => { + await utils.stopLibertyserver(); + isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning + if (!isServerRunning) + console.log("Server stopped successfully "); + } + } catch (e) { + console.error("error - ", e) + } finally { + console.log("finally block: is server running - ", isServerRunning); + if (isServerRunning) { + utils.stopLibertyserver(); + } + else + console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); + } + expect(attachStatus).to.be.true; +}).timeout(550000); + +it('start gradle with docker from liberty dashboard', async () => { + if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) { - //skip running for platforms , enable them for linux after resolving docker setup in GHA - return true; - } - - - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); - await utils.delay(60000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + //skip running for platforms , enable them for linux after resolving docker setup in GHA + return true; + } + + + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); + await utils.delay(60000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); if(!serverStartStatus) - console.log("Server started message not found in the terminal"); + console.log("Server started message not found in the terminal"); else { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; + console.error("Server stopped message not found in the terminal"); } + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; +} expect (serverStartStatus).to.be.true; - - - }).timeout(350000); + + +}).timeout(350000); it('View test report for gradle project', async () => { @@ -259,5 +259,4 @@ it('getViewControl works with the correct label', async() => { await utils.clearCommandPalette(); }).timeout(100000); -}); - +}); \ No newline at end of file From 9b69f6f2f21248eeeea7eab79f91e2d172fddb59 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Tue, 14 Jan 2025 22:09:58 +0530 Subject: [PATCH 20/22] reverted launch.json changes --- .vscode/launch.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f27c1143..1736de24 100755 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,12 +5,6 @@ { "version": "0.2.0", "configurations": [ - { - "command": "npm run test-mac-gradle", - "name": "Run npm start", - "request": "launch", - "type": "node-terminal" - }, { "name": "Run Extension", "type": "extensionHost", From 5f7720c1070f5ab7c401d58ec5c1dd70cc033870 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Fri, 24 Jan 2025 10:21:44 +0530 Subject: [PATCH 21/22] changes made to resolve conflict --- src/test/GradleTestDevModeActions.ts | 101 +++++++++++++-------------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 6e2b881d..b81a7edf 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -1,9 +1,8 @@ import { expect } from 'chai'; -import { SideBarView, ViewSection, EditorView, DefaultTreeItem, DebugView } from 'vscode-extension-tester'; +import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem, DebugView } from 'vscode-extension-tester'; import * as utils from './utils/testUtils'; import * as constants from './definitions/constants'; import path = require('path'); -import { viewTestReportForMac } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { let sidebar: SideBarView; @@ -65,6 +64,37 @@ it('Start gradle project from liberty dashboard', async () => { expect (serverStartStatus).to.be.true; +}).timeout(350000); + +it('start gradle with docker from liberty dashboard', async () => { + + if((process.platform === 'darwin' ) || (process.platform === 'win32')) + { + //skip running for platforms , enable them for linux after resolving docker setup in GHA + return true; + } + + + await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); + await utils.delay(60000); + const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); + if(!serverStartStatus) + console.log("Server started message not found in the terminal"); + else + { + console.log("Server succuessfully started"); + await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); + const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); + if(!serverStopStatus){ + console.error("Server stopped message not found in the terminal"); + } + else + console.log("Server stopped successfully"); + expect (serverStopStatus).to.be.true; +} + expect (serverStartStatus).to.be.true; + + }).timeout(350000); it('Run tests for gradle project', async () => { @@ -154,7 +184,10 @@ it('start gradle with history from liberty dashboard', async () => { }).timeout(350000); - +/** + * All future test cases should be written before the test that attaches the debugger, as this will switch the UI to the debugger view. + * If, for any reason, a test case needs to be written after the debugger test, ensure that the UI is switched back to the explorer view before executing the subsequent tests. + */ it('attach debugger for gradle with custom parameter event', async () => { console.log("start attach debugger"); let isServerRunning: Boolean = true; @@ -186,7 +219,7 @@ it('attach debugger for gradle with custom parameter event', async () => { } } - await utils.stopLibertyserver(); + await utils.stopLibertyserver(constants.GRADLE_PROJECT); isServerRunning = !await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); //negate isServerRunning if (!isServerRunning) console.log("Server stopped successfully "); @@ -196,7 +229,7 @@ it('attach debugger for gradle with custom parameter event', async () => { } finally { console.log("finally block: is server running - ", isServerRunning); if (isServerRunning) { - utils.stopLibertyserver(); + utils.stopLibertyserver(constants.GRADLE_PROJECT); } else console.log("good to close test - Attach Debugger for start with custom parameter(-DdebugPort=7777) event"); @@ -204,59 +237,25 @@ it('attach debugger for gradle with custom parameter event', async () => { expect(attachStatus).to.be.true; }).timeout(550000); -it('start gradle with docker from liberty dashboard', async () => { - +it('View test report for gradle project', async () => { + if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) { - //skip running for platforms , enable them for linux after resolving docker setup in GHA + //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved return true; } - - await utils.launchDashboardAction(item, constants.START_DASHBOARD_ACTION_WITHDOCKER, constants.START_DASHBOARD_MAC_ACTION_WITHDOCKER); - await utils.delay(60000); - const serverStartStatus = await utils.checkTerminalforServerState(constants.SERVER_START_STRING); - if(!serverStartStatus) - console.log("Server started message not found in the terminal"); - else - { - console.log("Server succuessfully started"); - await utils.launchDashboardAction(item, constants.STOP_DASHBOARD_ACTION, constants.STOP_DASHBOARD_MAC_ACTION); - const serverStopStatus= await utils.checkTerminalforServerState(constants.SERVER_STOP_STRING); - if(!serverStopStatus){ - console.error("Server stopped message not found in the terminal"); - } - else - console.log("Server stopped successfully"); - expect (serverStopStatus).to.be.true; -} - expect (serverStartStatus).to.be.true; - + await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + tabs = await new EditorView().getOpenEditorTitles(); + // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); + expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); -}).timeout(350000); - - it('View test report for gradle project', async () => { - - if ((process.platform === 'darwin')) { - //Function call to enter corresponding command in the command prompt to display test report for gradle project in mac - await viewTestReportForMac(); - } else { - await utils.launchDashboardAction(item, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); - tabs = await new EditorView().getOpenEditorTitles(); - // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); - } - tabs = await new EditorView().getOpenEditorTitles(); - await utils.delay(1000); - console.log("Tabs opened: " + tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); - - expect(tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE) > -1, "Gradle test report not found").to.equal(true); - }).timeout(60000); +}).timeout(30000); // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests. - it('Clear Command Palatte', async () => { - await utils.delay(3000); - await utils.clearCommandPalette(); - }).timeout(100000); +it('Clear Command Palatte', async () => { + await utils.clearCommandPalette(); +}).timeout(100000); -}); \ No newline at end of file +}); From 75be6ed5093bda323bb4c1fd4afa5e9bf75c5104 Mon Sep 17 00:00:00 2001 From: SuparnaSuresh Date: Fri, 24 Jan 2025 10:48:53 +0530 Subject: [PATCH 22/22] resolved conflict and updated branch --- src/test/GradleTestDevModeActions.ts | 34 ++++++++++++++++------------ 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index b81a7edf..2fa1390c 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -3,6 +3,7 @@ import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem import * as utils from './utils/testUtils'; import * as constants from './definitions/constants'; import path = require('path'); +import { viewTestReportForMac } from './utils/macUtils'; describe('Devmode action tests for Gradle Project', () => { let sidebar: SideBarView; @@ -184,6 +185,24 @@ it('start gradle with history from liberty dashboard', async () => { }).timeout(350000); + +it('View test report for gradle project', async () => { + + if ((process.platform === 'darwin')) { + //Function call to enter corresponding command in the command prompt to display test report for gradle project in mac + await viewTestReportForMac(); + } else { + await utils.launchDashboardAction(item, constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); + // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); + } + tabs = await new EditorView().getOpenEditorTitles(); + await utils.delay(1000); + console.log("Tabs opened: " + tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)); + + expect(tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE) > -1, "Gradle test report not found").to.equal(true); +}).timeout(60000); + + /** * All future test cases should be written before the test that attaches the debugger, as this will switch the UI to the debugger view. * If, for any reason, a test case needs to be written after the debugger test, ensure that the UI is switched back to the explorer view before executing the subsequent tests. @@ -237,21 +256,6 @@ it('attach debugger for gradle with custom parameter event', async () => { expect(attachStatus).to.be.true; }).timeout(550000); -it('View test report for gradle project', async () => { - - if((process.platform === 'darwin' ) || (process.platform === 'win32') || (process.platform == 'linux')) - { - //skip running for platforms , enable once https://github.com/OpenLiberty/liberty-tools-vscode/issues/266 is resolved - return true; - } - - await utils.launchDashboardAction(item,constants.GRADLE_TR_DASHABOARD_ACTION, constants.GRADLE_TR_DASHABOARD_MAC_ACTION); - tabs = await new EditorView().getOpenEditorTitles(); - // expect (tabs[1]], "Gradle test report not found").to.equal(constants.GRADLE_TEST_REPORT_TITLE); - expect (tabs.indexOf(constants.GRADLE_TEST_REPORT_TITLE)>-1, "Gradle test report not found").to.equal(true); - -}).timeout(30000); - // Based on the UI testing code, it sometimes selects the wrong command in "command palette", such as choosing "Liberty: Start ..." instead of "Liberty: Start" from the recent suggestions. This discrepancy occurs because we specifically need "Liberty: Start" at that moment. // Now, clear the command history of the "command palette" to avoid receiving "recently used" suggestions. This action should be performed at the end of Gradle Project tests. it('Clear Command Palatte', async () => {