@redhat-developer/page-objects
Version:
Page Object API implementation for a VS Code editor used by ExTester framework.
114 lines (113 loc) • 4.28 kB
TypeScript
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License", destination); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ElementWithContextMenu } from '../ElementWithContextMenu';
import { AbstractElement } from '../AbstractElement';
import { WebElement, By } from 'selenium-webdriver';
/**
* Arbitrary item in the side bar view
*/
export declare abstract class ViewItem extends ElementWithContextMenu {
/**
* Select the item in the view.
* Note that selecting the item will toggle its expand state when applicable.
* @returns Promise resolving when the item has been clicked
*/
select(): Promise<void>;
}
/**
* Abstract representation of a row in the tree inside a view content section
*/
export declare abstract class TreeItem extends ViewItem {
/**
* Retrieves the label of this view item
*/
abstract getLabel(): Promise<string>;
/**
* Retrieves the tooltip of this TreeItem.
* @returns A promise resolving to the tooltip or undefined if the TreeItem has no tooltip.
*/
getTooltip(): Promise<string | undefined>;
/**
* Retrieves the description of this TreeItem.
* @returns A promise resolving to the tooltip or undefined if the TreeItem has no description.
*/
getDescription(): Promise<string | undefined>;
/**
* Finds if the item has children by actually counting the child items
* Note that this will expand the item if it was collapsed
* @returns Promise resolving to true/false
*/
hasChildren(): Promise<boolean>;
/**
* Finds whether the item is expanded. Always returns false if item has no children.
* @returns Promise resolving to true/false
*/
abstract isExpanded(): Promise<boolean>;
/**
* Find children of an item, will try to expand the item in the process
* @returns Promise resolving to array of TreeItem objects, empty array if item has no children
*/
abstract getChildren(): Promise<TreeItem[]>;
/**
* Finds if the item is expandable/collapsible
* @returns Promise resolving to true/false
*/
abstract isExpandable(): Promise<boolean>;
/**
* Expands the current item, if it can be expanded and is collapsed.
*/
expand(): Promise<void>;
/**
* Find a child item with the given name
* @returns Promise resolving to TreeItem object if the child item exists, undefined otherwise
*/
findChildItem(name: string): Promise<TreeItem | undefined>;
/**
* Collapse the item if expanded
*/
collapse(): Promise<void>;
/**
* Find all action buttons bound to the view item
*
* @returns array of ViewItemAction objects, empty array if item has no
* actions associated
*/
getActionButtons(): Promise<ViewItemAction[]>;
/**
* Find action button for view item by label
* @param label label of the button to search by
*
* @returns ViewItemAction object if such button exists, undefined otherwise
*/
getActionButton(label: string): Promise<ViewItemAction | undefined>;
/**
* Find all child elements of a tree item
* @param locator locator of a given type of tree item
*/
protected getChildItems(locator: By): Promise<WebElement[]>;
protected findTwistie(): Promise<WebElement>;
}
/**
* Action button bound to a view item
*/
export declare class ViewItemAction extends AbstractElement {
constructor(actionConstructor: By, viewItem: TreeItem);
/**
* Get label of the action button
*/
getLabel(): Promise<string>;
}