Skip to content

Commit

Permalink
Fix test case for the transform command
Browse files Browse the repository at this point in the history
- Remove .only method from test suite.
- Remove unused methods from testUtils.

Signed-off-by: Marcelo Henrique Diniz de Araujo <mdinizde@redhat.com>
  • Loading branch information
hdamarcelo committed Oct 8, 2024
1 parent 545a753 commit 18f9c7f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/ui-test/tests/commands.transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ActivityBar, DefaultTreeSection, EditorView, InputBox, Menu, SideBarVie
import * as pjson from '../../../package.json';
import { EXAMPLE_TRANSFORM_COMMAND_JAVA_FILE, EXAMPLE_TRANSFORM_COMMAND_XML_FILE, EXAMPLE_TRANSFORM_COMMAND_YAML_FILE, FOLDER_WITH_RESOURCES_FOR_TRANSFORM_COMMAND, NEW_CAMEL_FILE_LABEL, TRANSFORM_CAMEL_ROUTE_YAML_DSL_LABEL, TRANSFORM_ROUTES_IN_FOLDER_TO_YAML_COMMAND_ID, TRANSFORM_ROUTE_TO_YAML_COMMAND_ID, deleteFile, killTerminal, openFileInEditor, waitUntilEditorIsOpened, waitUntilExtensionIsActivated } from '../utils/testUtils';

describe.only('Transform Camel Routes to YAML using commands', function () {
describe('Transform Camel Routes to YAML using commands', function () {
this.timeout(600000);

let driver: WebDriver;
Expand Down
33 changes: 2 additions & 31 deletions src/ui-test/utils/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

import * as fs from 'fs-extra';
import * as path from 'path';
import {
ActivityBar,
BottomBarPanel,
By,
ComboSetting,
ContentAssistItem,
ContextMenu,
ContextMenuItem,
DefaultTreeSection,
EditorView,
InputBox,
Expand All @@ -33,14 +33,11 @@ import {
TerminalView,
TextEditor,
TextSetting,
ViewItem,
VSBrowser,
WebDriver,
Workbench
} from "vscode-uitests-tooling";
import { storageFolder } from "../uitest_runner";
import * as path from 'path';
import * as fs from 'fs-extra';

// Resources and file names inside.
export const RESOURCES: string = path.resolve('src', 'ui-test', 'resources');
Expand Down Expand Up @@ -602,29 +599,3 @@ export async function initNewCamelFile(type: string, name: string, kamelet: stri
await input.confirm();
}

/**
* Opens the context menu for a given route in the sidebar.
* @param route The route for which the context menu should be opened.
* @returns A promise that resolves to the opened ContextMenu.
*/
export async function openContextMenu(route: string): Promise<ContextMenu> {
const item = await (await new SideBarView().getContent().getSection('explorer')).findItem(route) as ViewItem;
const menu = await item.openContextMenu();
return menu;
}

/**
* Selects a specific command from a given context menu.
* @param command The command to select from the context menu.
* @param menu The ContextMenu instance from which to select the command.
* @returns A promise that resolves once the command is selected.
* @throws An error if the specified command is not found in the context menu.
*/
export async function selectContextMenuItem(command: string, menu: ContextMenu): Promise<void> {
const button = await menu.getItem(command);
if (button instanceof ContextMenuItem) {
await button.select();
} else {
throw new Error(`Button ${command} not found in context menu`);
}
}

0 comments on commit 18f9c7f

Please sign in to comment.