@redhat-developer/page-objects
Version:
Page Object API implementation for a VS Code editor used by ExTester framework.
127 lines (126 loc) • 5 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 { SideBarView } from '../SideBarView';
import { WebElement } from 'selenium-webdriver';
import { AbstractElement } from '../../AbstractElement';
import { ContextMenu } from '../../..';
import { ElementWithContextMenu } from '../../ElementWithContextMenu';
/**
* Page object representing the Source Control view
*/
export declare class ScmView extends SideBarView {
/**
* Get SCM provider (repository) by title
* @param title name of the repository
* @returns promise resolving to ScmProvider object
*/
getProvider(title?: string): Promise<ScmProvider | undefined>;
/**
* Get all SCM providers
* @returns promise resolving to ScmProvider array
*/
getProviders(): Promise<ScmProvider[]>;
/**
* Initialize repository in the current folder if no SCM provider is found
* @returns true if the action was completed successfully, false if a provider already exists
*/
initializeRepository(): Promise<boolean>;
}
/**
* Page object representing a repository in the source control view
* Maps roughly to a view section of the source control view
*/
export declare class ScmProvider extends AbstractElement {
constructor(element: WebElement, view: ScmView);
/**
* Get title of the scm provider
*/
getTitle(): Promise<string>;
/**
* Get type of the scm provider (e.g. Git)
*/
getType(): Promise<string>;
/**
* Find an action button for the SCM provider by title and click it. (e.g 'Commit')
* @param title Title of the action button to click
* @returns true if the given action could be performed, false if the button doesn't exist
*/
takeAction(title: string): Promise<boolean>;
/**
* Open a context menu using the 'More Actions...' button
* @returns Promise resolving to a ContextMenu object
*/
openMoreActions(): Promise<ContextMenu>;
/**
* Fill in the message field and send ctrl/cmd + enter to commit the changes
* @param message the commit message to use
* @returns promise resolving once the keypresses are sent
*/
commitChanges(message: string): Promise<void>;
/**
* Get page objects for all tree items representing individual changes
* @param staged when true, finds staged changes; otherwise finds unstaged changes
* @returns promise resolving to ScmChange object array
*/
getChanges(staged?: boolean): Promise<ScmChange[]>;
/**
* Get the number of changes for a given section
* @param staged when true, counts the staged changes, unstaged otherwise
* @returns promise resolving to number of changes in the given subsection
*/
getChangeCount(staged?: boolean): Promise<number>;
}
/**
* Page object representing a SCM change tree item
*/
export declare class ScmChange extends ElementWithContextMenu {
constructor(row: WebElement, provider: ScmProvider);
/**
* Get label as a string
*/
getLabel(): Promise<string>;
/**
* Get description as a string
*/
getDescription(): Promise<string>;
/**
* Get the status string (e.g. 'Modified')
*/
getStatus(): Promise<string>;
/**
* Find if the item is expanded
* @returns promise resolving to true if change is expanded, to false otherwise
*/
isExpanded(): Promise<boolean>;
/**
* Expand or collapse a change item if possible, only works for folders in hierarchical view mode
* @param expand true to expand the item, false to collapse
* @returns promise resolving to true if the item changed state, to false otherwise
*/
toggleExpand(expand: boolean): Promise<boolean>;
/**
* Find and click an action button available to a given change tree item
* @param title title of the action button (e.g 'Stage Changes')
* @returns promise resolving to true if the action was performed successfully,
* false if the given button does not exist
*/
takeAction(title: string): Promise<boolean>;
}
export declare class MoreAction extends ElementWithContextMenu {
constructor(scm: ScmProvider | ScmView);
openContextMenu(): Promise<ContextMenu>;
}