Skip to content
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

Issue266 - automated test for view test report for gradle project #470

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2fe17aa
commented code for test
SuparnaSuresh Jan 8, 2025
8dc481c
test for integration test
SuparnaSuresh Jan 8, 2025
39bcdd5
removed unwanted code
SuparnaSuresh Jan 8, 2025
e14f498
Automated test debug entries added
SuparnaSuresh Jan 13, 2025
0087a64
print for debug added - devCommands
SuparnaSuresh Jan 13, 2025
1845977
print for debug added
SuparnaSuresh Jan 13, 2025
7b7a797
fix for test report issue
SuparnaSuresh Jan 13, 2025
a1e688f
delay added for command palette
SuparnaSuresh Jan 13, 2025
0889282
time delay increased
SuparnaSuresh Jan 13, 2025
4a2f01f
Removed unwanted lines
SuparnaSuresh Jan 14, 2025
c843c29
code modified
SuparnaSuresh Jan 14, 2025
4bc0e41
enabled commented test cases
SuparnaSuresh Jan 14, 2025
975ce88
code modified to display test report
SuparnaSuresh Jan 14, 2025
d5719ed
code added in macUtils
SuparnaSuresh Jan 14, 2025
522e306
Documentation added
SuparnaSuresh Jan 14, 2025
3e03b21
removed print statements from helperUtils
SuparnaSuresh Jan 14, 2025
c9d101b
Print statements removed from devCommands
SuparnaSuresh Jan 14, 2025
7d85a4f
removed unwanted imports
SuparnaSuresh Jan 14, 2025
8e8a5ca
Reverted the aligment related changes for the code
SuparnaSuresh Jan 14, 2025
9b69f6f
reverted launch.json changes
SuparnaSuresh Jan 14, 2025
5f7720c
changes made to resolve conflict
SuparnaSuresh Jan 24, 2025
10060a5
Merge branch 'OpenLiberty:main' into issue266_AutomatedTestForViewTes…
SuparnaSuresh Jan 24, 2025
75be6ed
resolved conflict and updated branch
SuparnaSuresh Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 22 additions & 33 deletions src/test/GradleTestDevModeActions.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { expect } from 'chai';
import { InputBox, Workbench,SideBarView, ViewSection,EditorView,DefaultTreeItem, DebugView } 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;
Expand Down Expand Up @@ -154,20 +155,6 @@ it('start gradle with history from liberty dashboard', async () => {
}).timeout(350000);
















it('attach debugger for gradle with custom parameter event', async () => {
console.log("start attach debugger");
let isServerRunning: Boolean = true;
Expand Down Expand Up @@ -248,26 +235,28 @@ it('start gradle with docker from liberty dashboard', async () => {

}).timeout(350000);

it('View test report for gradle project', async () => {
it('View test report for gradle project', async () => {
Copy link
Contributor

@aparnamichael aparnamichael Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the indentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed. Thanks


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);
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);

// 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.clearCommandPalette();
}).timeout(100000);

});
it('Clear Command Palatte', async () => {
await utils.delay(3000);
await utils.clearCommandPalette();
}).timeout(100000);

});
17 changes: 16 additions & 1 deletion src/test/utils/macUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,4 +25,18 @@ export async function setInputBox(MapActionString: string): Promise<boolean> {
} else {
return false;
}
}

/**
* 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();
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);
}
Loading