diff --git a/src/test/GradleTestDevModeActions.ts b/src/test/GradleTestDevModeActions.ts index 75a76f9f..7daf9cc9 100755 --- a/src/test/GradleTestDevModeActions.ts +++ b/src/test/GradleTestDevModeActions.ts @@ -1,8 +1,9 @@ -import { expect } from 'chai'; +import { assert, expect } from 'chai'; 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; @@ -184,6 +185,22 @@ it('start gradle with history from liberty dashboard', async () => { }).timeout(350000); + +it('View test report for gradle project', async () => { + // Close all the tabs in editor. + await new EditorView().closeAllEditors(); + utils.delay(5000); + 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(); + await utils.delay(1000); + assert.equal(tabs[0], constants.GRADLE_TEST_REPORT_TITLE, 'Gradle test report not found'); +}).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 +254,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 () => { @@ -259,4 +261,3 @@ it('Clear Command Palatte', async () => { }).timeout(100000); }); - diff --git a/src/test/utils/macUtils.ts b/src/test/utils/macUtils.ts index 288844b0..303f036e 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,18 @@ export async function setInputBox(MapActionString: string): Promise { } 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); } \ No newline at end of file