Skip to content

Commit

Permalink
Addressed review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
vaisakhkannan committed Mar 26, 2024
1 parent 9e5dfe1 commit 6f451d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
19 changes: 3 additions & 16 deletions src/test/GradleTestDevModeActions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView,DefaultTreeItem, DebugView, ModalDialog } from 'vscode-extension-tester';
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');
Expand All @@ -8,10 +8,8 @@ describe('Devmode action tests for Gradle Project', () => {
let sidebar: SideBarView;
let debugView: DebugView;
let section: ViewSection;
let item: DefaultTreeItem;
let menu: ViewItem[];
let item: DefaultTreeItem;
let tabs: string[];
let dialog: ModalDialog;

before(() => {
sidebar = new SideBarView();
Expand Down Expand Up @@ -268,18 +266,7 @@ it('View test report for gradle project', async () => {

// 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 new Workbench().executeCommand('Clear Command History');
await utils.delay(30000);
dialog = new ModalDialog();
const message = await dialog.getMessage();

expect(message).contains('Do you want to clear the history of recently used commands?');
const details = await dialog.getDetails();

expect(details).equals(`This action is irreversible!`);
const buttons = await dialog.getButtons();
expect(buttons.length).equals(2);
await dialog.pushButton('Clear');
await utils.clearCommandPalette();
}).timeout(100000);

});
Expand Down
18 changes: 17 additions & 1 deletion src/test/utils/testUtils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import path = require('path');
import { Workbench, InputBox, DefaultTreeItem } from 'vscode-extension-tester';
import { Workbench, InputBox, DefaultTreeItem, ModalDialog } from 'vscode-extension-tester';
import * as fs from 'fs';
import { MAVEN_PROJECT, STOP_DASHBOARD_MAC_ACTION } from '../definitions/constants';
import { MapContextMenuforMac } from './macUtils';
import clipboard = require('clipboardy');
import { expect } from 'chai';

export function delay(millisec: number) {
return new Promise( resolve => setTimeout(resolve, millisec) );
Expand Down Expand Up @@ -178,4 +179,19 @@ export async function stopLibertyserver() {
(await input).click();
await delay(10000);
}

export async function clearCommandPalette() {
await new Workbench().executeCommand('Clear Command History');
await delay(30000);
const dialog = new ModalDialog();
const message = await dialog.getMessage();

expect(message).contains('Do you want to clear the history of recently used commands?');
const details = await dialog.getDetails();

expect(details).equals(`This action is irreversible!`);
const buttons = await dialog.getButtons();
expect(buttons.length).equals(2);
await dialog.pushButton('Clear');
}

0 comments on commit 6f451d5

Please sign in to comment.