/** * 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 { Editor } from './Editor'; import { ContextMenu } from '../menu/ContextMenu'; import { WebElement, By } from 'selenium-webdriver'; import { AbstractElement } from '../AbstractElement'; import { EditorView, EditorGroup } from '../..'; /** * Page object representing the internal VS Code settings editor */ export declare class SettingsEditor extends Editor { private divider; constructor(view?: EditorView | EditorGroup); protected reinitialize(): Promise; /** * Search for a setting with a particular title and category. * Returns an appropriate Setting object if the label is found, * undefined otherwise. * * If your setting has nested categories (i.e `example.general.test`), * pass in each category as a separate string. * * @param title title of the setting * @param categories category of the setting * @returns Promise resolving to a Setting object if found, undefined otherwise */ findSetting(title: string, ...categories: string[]): Promise; /** * Search for a setting with a precise ID. * Returns an appropriate Setting object if it exists, * undefined otherwise. * * @param id of the setting * @returns Promise resolving to a Setting object if found, undefined otherwise */ findSettingByID(id: string): Promise; private _getSettingItem; private scanForSettingItem; /** * Switch between settings perspectives * Works only if your vscode instance has both user and workspace settings available * * @param perspective User or Workspace * @returns Promise that resolves when the appropriate button is clicked */ switchToPerspective(perspective: 'User' | 'Workspace'): Promise; /** * Context menu is disabled in this editor, throw an error */ openContextMenu(): Promise; private createSetting; } /** * Abstract item representing a Setting with title, description and * an input element (combo/textbox/checkbox/link/array) */ export declare abstract class Setting extends AbstractElement { constructor(settingsConstructor: By, settings: SettingsEditor); /** * Get the value of the setting based on its input type * * @returns promise that resolves to the current value of the setting */ abstract getValue(): Promise; /** * Set the value of the setting based on its input type * * @param value boolean for checkboxes, string otherwise */ abstract setValue(value: string | boolean): Promise; /** * Get the category of the setting * All settings are labeled as Category: Title */ getCategory(): Promise; /** * Get description of the setting * @returns Promise resolving to setting description */ getDescription(): Promise; /** * Get title of the setting */ getTitle(): Promise; } /** * Setting with a combo box */ export declare class ComboSetting extends Setting { getValue(): Promise; setValue(value: string): Promise; /** * Get the labels of all options from the combo * @returns Promise resolving to array of string values */ getValues(): Promise; private getOptions; } /** * Setting with a text box input */ export declare class TextSetting extends Setting { getValue(): Promise; setValue(value: string): Promise; } /** * Setting with a checkbox */ export declare class CheckboxSetting extends Setting { getValue(): Promise; setValue(value: boolean): Promise; } /** * Setting with no value, with a link to settings.json instead */ export declare class LinkSetting extends Setting { getValue(): Promise; setValue(value: string | boolean): Promise; /** * Open the link that leads to the value in settings.json * @returns Promise resolving when the link has been clicked */ openLink(): Promise; } /** * Setting with an array of string values (rows) */ export declare class ArraySetting extends Setting { /** * @deprecated Method 'getValue' is not available for ArraySetting! */ getValue(): Promise; /** * @deprecated Method 'setValue' is not available for ArraySetting! */ setValue(value: string | boolean): Promise; /** * Select a row of a setting array of string values * @param item label | index */ select(item: string | number): Promise; /** * Get a row as new ArraySettingItem object * @param item label or index * @returns ArraySettingItem | undefined */ getItem(item: string | number): Promise; /** * Get a list of all rows as ArraySettingItem objects * @returns ArraySettingItem[] */ getItems(): Promise; /** * Get a list of all rows values * @returns string[] */ getValues(): Promise; /** * Click 'Add Item' and get row as ArraySettingItem in edit mode * @returns ArraySettingItem */ add(): Promise; /** * Select a row, then click 'Edit Item' and get row as ArraySettingItem in edit mode * @param item label | index * @returns ArraySettingItem | undefined */ edit(item: string | number): Promise; private getListRootElement; private getRows; private findRow; } /** * Represents each row of an ArraySetting array of strings */ export declare class ArraySettingItem extends AbstractElement { constructor(element: WebElement, setting: ArraySetting); /** * Select an item */ select(): Promise; /** * Get item text value * @returns string */ getValue(): Promise; /** * Set item text value * @param value string */ setValue(value: string): Promise; /** * Click 'Remove Item' button */ remove(): Promise; /** * Click 'OK' button * @description Only when the item is in edit mode */ ok(): Promise; /** * Click 'Cancel' button * @description Only when the item is in edit mode */ cancel(): Promise; }