-
Notifications
You must be signed in to change notification settings - Fork 37
Issue#354 Test cases added for Gradle and Maven #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SuparnaSuresh
wants to merge
21
commits into
OpenLiberty:main
Choose a base branch
from
SuparnaSuresh:issue354-GradleTestcaseProjectNameSpace
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ec9c722
Added test cases for gradle project name with space
SuparnaSuresh f062164
Renaming the project before starting test case
SuparnaSuresh 33e5f92
Added code changes for project detection
SuparnaSuresh 240e82e
Test cases for gradle directory with space
SuparnaSuresh 0264f37
Test cases to handle scenario for Maven project directory with space
SuparnaSuresh 2cf8f32
Updated fs-extra
SuparnaSuresh 9bc6186
Changes after addressing review comments
SuparnaSuresh d2bfa49
Updated test names
SuparnaSuresh ed27802
Merge branch 'OpenLiberty:main' into issue354-GradleTestcaseProjectNa…
SuparnaSuresh 74be44b
Merge branch 'OpenLiberty:main' into issue354-GradleTestcaseProjectNa…
SuparnaSuresh ae98503
Merge branch 'OpenLiberty:main' into issue354-GradleTestcaseProjectNa…
SuparnaSuresh 647fd5f
updated the code to copy project
SuparnaSuresh 1e8c134
Merge branch 'issue354-GradleTestcaseProjectNameSpace' of https://git…
SuparnaSuresh 79d8690
undo the format changes which are not part of the issue
SuparnaSuresh 60d7d28
Modified code for await
SuparnaSuresh 078b1df
resolving conflict - updated testUtils
SuparnaSuresh 71169ce
Merge branch 'OpenLiberty:main' into issue354-GradleTestcaseProjectNa…
SuparnaSuresh 176de3c
resolved conflict and updated testUtils
SuparnaSuresh c554f70
updated stopLibertyServer function
SuparnaSuresh 97de944
Merge branch 'OpenLiberty:main' into issue354-GradleTestcaseProjectNa…
SuparnaSuresh bae2ab9
GHA Build failure - time delay increased
SuparnaSuresh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { WebDriver, VSBrowser } from 'vscode-extension-tester'; | ||
import * as utils from './utils/testUtils'; | ||
|
||
describe('Open Gradle Project - Project name with space', () => { | ||
|
||
let driver: WebDriver; | ||
|
||
before(() => { | ||
utils.renameProject(); | ||
driver = VSBrowser.instance.driver; | ||
|
||
}); | ||
|
||
it('Open Sample Gradle Project - Project name with space', async () => { | ||
await utils.delay(8000); | ||
await VSBrowser.instance.openResources(utils.getNewGradleProjectNameWithSpace()); | ||
}).timeout(25000); | ||
}); | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,265 @@ | ||
import { expect } from 'chai'; | ||
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView,DefaultTreeItem, DebugView } from 'vscode-extension-tester'; | ||
import * as utils from './utils/testUtils'; | ||
import * as constants from './definitions/constants'; | ||
import path = require('path'); | ||
|
||
describe('Devmode action tests for Gradle Project- Project name with space', () => { | ||
let sidebar: SideBarView; | ||
let debugView: DebugView; | ||
let section: ViewSection; | ||
let item: DefaultTreeItem; | ||
let tabs: string[]; | ||
|
||
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(25000); | ||
|
||
|
||
it('Open dasboard shows items - Gradle', async () => { | ||
|
||
|
||
aparnamichael marked this conversation as resolved.
Show resolved
Hide resolved
|
||
await utils.delay(85000); | ||
await section.expand(); | ||
await utils.delay(6000); | ||
const menu = await section.getVisibleItems(); | ||
expect(menu).not.empty; | ||
item = await section.findItem(constants.GRADLE_PROJECT_WSP) 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); | ||
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 () => { | ||
|
||
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); | ||
|
||
|
||
it('start gradle with options from liberty dashboard', async () => { | ||
|
||
const reportPath = path.join(utils.getNewGradleProjectNameWithSpace(),"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.getNewGradleProjectNameWithSpace(),"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); | ||
|
||
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"); | ||
|
||
let mysecarry: Promise<ViewSection[]> = 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; | ||
} | ||
|
||
|
||
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('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); | ||
|
||
|
||
// 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.clearCommandPalette(); | ||
}).timeout(100000); | ||
|
||
after(() => { | ||
const gradleProjectPath = path.join(__dirname,"..","..","src", "test","resources","gradleproject"); | ||
console.log("Current path __dirname: "+ __dirname); | ||
console.log("Removing project from the path: "+ gradleProjectPath); | ||
utils.removeProjectFolder(gradleProjectPath); | ||
}); | ||
|
||
}); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { WebDriver, VSBrowser } from 'vscode-extension-tester'; | ||
import * as utils from './utils/testUtils'; | ||
|
||
|
||
|
||
describe('Open Gradle Project - path with space', () => { | ||
|
||
let driver: WebDriver; | ||
|
||
|
||
before(() => { | ||
driver = VSBrowser.instance.driver; | ||
utils.createGradleProjectPathWithSpace(); | ||
|
||
}); | ||
|
||
it('Open Sample Gradle Project - path with space', async () => { | ||
|
||
await VSBrowser.instance.openResources(utils.getGradleProjectPathDirWithSpace()); | ||
|
||
}).timeout(25000); | ||
|
||
|
||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.