@redhat-developer/page-objects 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +5 -0
- package/out/components/AbstractElement.d.ts +35 -0
- package/out/components/AbstractElement.js +69 -0
- package/out/components/ElementWithContextMenu.d.ts +11 -0
- package/out/components/ElementWithContextMenu.js +38 -0
- package/out/components/WebviewMixin.d.ts +29 -0
- package/out/components/WebviewMixin.js +70 -0
- package/out/components/activityBar/ActionsControl.d.ts +18 -0
- package/out/components/activityBar/ActionsControl.js +27 -0
- package/out/components/activityBar/ActivityBar.d.ts +30 -0
- package/out/components/activityBar/ActivityBar.js +71 -0
- package/out/components/activityBar/ViewControl.d.ts +23 -0
- package/out/components/activityBar/ViewControl.js +56 -0
- package/out/components/bottomBar/AbstractViews.d.ts +38 -0
- package/out/components/bottomBar/AbstractViews.js +88 -0
- package/out/components/bottomBar/BottomBarPanel.d.ts +47 -0
- package/out/components/bottomBar/BottomBarPanel.js +123 -0
- package/out/components/bottomBar/ProblemsView.d.ts +88 -0
- package/out/components/bottomBar/ProblemsView.js +149 -0
- package/out/components/bottomBar/Views.d.ts +75 -0
- package/out/components/bottomBar/Views.js +195 -0
- package/out/components/bottomBar/WebviewView.d.ts +12 -0
- package/out/components/bottomBar/WebviewView.js +21 -0
- package/out/components/dialog/ModalDialog.d.ts +32 -0
- package/out/components/dialog/ModalDialog.js +56 -0
- package/out/components/editor/Breakpoint.d.ts +18 -0
- package/out/components/editor/Breakpoint.js +38 -0
- package/out/components/editor/ContentAssist.d.ts +34 -0
- package/out/components/editor/ContentAssist.js +94 -0
- package/out/components/editor/CustomEditor.d.ts +26 -0
- package/out/components/editor/CustomEditor.js +45 -0
- package/out/components/editor/DiffEditor.d.ts +19 -0
- package/out/components/editor/DiffEditor.js +31 -0
- package/out/components/editor/Editor.d.ts +17 -0
- package/out/components/editor/Editor.js +29 -0
- package/out/components/editor/EditorAction.d.ts +10 -0
- package/out/components/editor/EditorAction.js +17 -0
- package/out/components/editor/EditorView.d.ts +153 -0
- package/out/components/editor/EditorView.js +350 -0
- package/out/components/editor/SettingsEditor.d.ts +121 -0
- package/out/components/editor/SettingsEditor.js +278 -0
- package/out/components/editor/TextEditor.d.ts +265 -0
- package/out/components/editor/TextEditor.js +707 -0
- package/out/components/editor/WebView.d.ts +11 -0
- package/out/components/editor/WebView.js +38 -0
- package/out/components/menu/ContextMenu.d.ts +37 -0
- package/out/components/menu/ContextMenu.js +123 -0
- package/out/components/menu/MacTitleBar.d.ts +16 -0
- package/out/components/menu/MacTitleBar.js +41 -0
- package/out/components/menu/Menu.d.ts +38 -0
- package/out/components/menu/Menu.js +53 -0
- package/out/components/menu/MenuItem.d.ts +24 -0
- package/out/components/menu/MenuItem.js +36 -0
- package/out/components/menu/TitleBar.d.ts +36 -0
- package/out/components/menu/TitleBar.js +78 -0
- package/out/components/menu/WindowControls.d.ts +28 -0
- package/out/components/menu/WindowControls.js +59 -0
- package/out/components/sidebar/SideBarView.d.ts +18 -0
- package/out/components/sidebar/SideBarView.js +29 -0
- package/out/components/sidebar/ViewContent.d.ts +57 -0
- package/out/components/sidebar/ViewContent.js +76 -0
- package/out/components/sidebar/ViewItem.d.ts +97 -0
- package/out/components/sidebar/ViewItem.js +192 -0
- package/out/components/sidebar/ViewSection.d.ts +98 -0
- package/out/components/sidebar/ViewSection.js +164 -0
- package/out/components/sidebar/ViewTitlePart.d.ts +35 -0
- package/out/components/sidebar/ViewTitlePart.js +59 -0
- package/out/components/sidebar/WelcomeContent.d.ts +47 -0
- package/out/components/sidebar/WelcomeContent.js +72 -0
- package/out/components/sidebar/debug/DebugView.d.ts +33 -0
- package/out/components/sidebar/debug/DebugView.js +70 -0
- package/out/components/sidebar/extensions/ExtensionsViewItem.d.ts +48 -0
- package/out/components/sidebar/extensions/ExtensionsViewItem.js +93 -0
- package/out/components/sidebar/extensions/ExtensionsViewSection.d.ts +33 -0
- package/out/components/sidebar/extensions/ExtensionsViewSection.js +117 -0
- package/out/components/sidebar/scm/NewScmView.d.ts +34 -0
- package/out/components/sidebar/scm/NewScmView.js +155 -0
- package/out/components/sidebar/scm/ScmView.d.ts +110 -0
- package/out/components/sidebar/scm/ScmView.js +275 -0
- package/out/components/sidebar/tree/TreeSection.d.ts +14 -0
- package/out/components/sidebar/tree/TreeSection.js +55 -0
- package/out/components/sidebar/tree/custom/CustomTreeItem.d.ts +15 -0
- package/out/components/sidebar/tree/custom/CustomTreeItem.js +36 -0
- package/out/components/sidebar/tree/custom/CustomTreeSection.d.ts +26 -0
- package/out/components/sidebar/tree/custom/CustomTreeSection.js +66 -0
- package/out/components/sidebar/tree/debug/BreakpointSectionItem.d.ts +33 -0
- package/out/components/sidebar/tree/debug/BreakpointSectionItem.js +63 -0
- package/out/components/sidebar/tree/debug/DebugBreakpointSection.d.ts +7 -0
- package/out/components/sidebar/tree/debug/DebugBreakpointSection.js +12 -0
- package/out/components/sidebar/tree/debug/DebugVariablesSection.d.ts +7 -0
- package/out/components/sidebar/tree/debug/DebugVariablesSection.js +12 -0
- package/out/components/sidebar/tree/debug/SectionBreakpoint.d.ts +3 -0
- package/out/components/sidebar/tree/debug/SectionBreakpoint.js +8 -0
- package/out/components/sidebar/tree/debug/VariableSectionItem.d.ts +33 -0
- package/out/components/sidebar/tree/debug/VariableSectionItem.js +60 -0
- package/out/components/sidebar/tree/default/DefaultTreeItem.d.ts +14 -0
- package/out/components/sidebar/tree/default/DefaultTreeItem.js +39 -0
- package/out/components/sidebar/tree/default/DefaultTreeSection.d.ts +9 -0
- package/out/components/sidebar/tree/default/DefaultTreeSection.js +44 -0
- package/out/components/statusBar/StatusBar.d.ts +96 -0
- package/out/components/statusBar/StatusBar.js +159 -0
- package/out/components/workbench/DebugToolbar.d.ts +52 -0
- package/out/components/workbench/DebugToolbar.js +93 -0
- package/out/components/workbench/Notification.d.ts +78 -0
- package/out/components/workbench/Notification.js +134 -0
- package/out/components/workbench/NotificationsCenter.d.ts +27 -0
- package/out/components/workbench/NotificationsCenter.js +57 -0
- package/out/components/workbench/Workbench.d.ts +69 -0
- package/out/components/workbench/Workbench.js +135 -0
- package/out/components/workbench/input/Input.d.ts +107 -0
- package/out/components/workbench/input/Input.js +249 -0
- package/out/components/workbench/input/InputBox.d.ts +30 -0
- package/out/components/workbench/input/InputBox.js +75 -0
- package/out/components/workbench/input/QuickOpenBox.d.ts +15 -0
- package/out/components/workbench/input/QuickOpenBox.js +41 -0
- package/out/conditions/WaitForAttribute.d.ts +8 -0
- package/out/conditions/WaitForAttribute.js +17 -0
- package/out/errors/NullAttributeError.d.ts +3 -0
- package/out/errors/NullAttributeError.js +11 -0
- package/out/index.d.ts +67 -0
- package/out/index.js +95 -0
- package/out/locators/loader.d.ts +20 -0
- package/out/locators/loader.js +108 -0
- package/out/locators/locators.d.ts +463 -0
- package/out/locators/locators.js +52 -0
- package/package.json +48 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LinkSetting = exports.CheckboxSetting = exports.TextSetting = exports.ComboSetting = exports.Setting = exports.SettingsEditor = void 0;
|
|
4
|
+
const Editor_1 = require("./Editor");
|
|
5
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
6
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
/**
|
|
9
|
+
* Page object representing the internal VSCode settings editor
|
|
10
|
+
*/
|
|
11
|
+
class SettingsEditor extends Editor_1.Editor {
|
|
12
|
+
divider = SettingsEditor.versionInfo.version >= '1.83.0' ? '›' : ' › ';
|
|
13
|
+
constructor(view = new __1.EditorView()) {
|
|
14
|
+
super(view);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Search for a setting with a particular title and category.
|
|
18
|
+
* Returns an appropriate Setting object if the label is found,
|
|
19
|
+
* undefined otherwise.
|
|
20
|
+
*
|
|
21
|
+
* If your setting has nested categories (i.e `example.general.test`),
|
|
22
|
+
* pass in each category as a separate string.
|
|
23
|
+
*
|
|
24
|
+
* @param title title of the setting
|
|
25
|
+
* @param categories category of the setting
|
|
26
|
+
* @returns Promise resolving to a Setting object if found, undefined otherwise
|
|
27
|
+
*/
|
|
28
|
+
async findSetting(title, ...categories) {
|
|
29
|
+
const category = categories.join(this.divider);
|
|
30
|
+
const searchBox = await this.findElement(SettingsEditor.locators.Editor.inputArea);
|
|
31
|
+
await searchBox.sendKeys(selenium_webdriver_1.Key.chord(SettingsEditor.ctlKey, 'a'));
|
|
32
|
+
await searchBox.sendKeys(`${category}${this.divider}${title}`);
|
|
33
|
+
return await this._getSettingItem(title, category);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Search for a setting with a precise ID.
|
|
37
|
+
* Returns an appropriate Setting object if it exists,
|
|
38
|
+
* undefined otherwise.
|
|
39
|
+
*
|
|
40
|
+
* @param id of the setting
|
|
41
|
+
* @returns Promise resolving to a Setting object if found, undefined otherwise
|
|
42
|
+
*/
|
|
43
|
+
async findSettingByID(id) {
|
|
44
|
+
const searchBox = await this.findElement(SettingsEditor.locators.Editor.inputArea);
|
|
45
|
+
await searchBox.sendKeys(selenium_webdriver_1.Key.chord(SettingsEditor.ctlKey, 'a'));
|
|
46
|
+
await searchBox.sendKeys(id);
|
|
47
|
+
const title = id.split('.').pop();
|
|
48
|
+
return await this._getSettingItem(title);
|
|
49
|
+
}
|
|
50
|
+
async _getSettingItem(title = '', category = '') {
|
|
51
|
+
const count = await this.findElement(SettingsEditor.locators.SettingsEditor.itemCount);
|
|
52
|
+
let textCount = await count.getText();
|
|
53
|
+
await this.getDriver().wait(async function () {
|
|
54
|
+
await new Promise(res => setTimeout(res, 1500));
|
|
55
|
+
const text = await count.getText();
|
|
56
|
+
if (text !== textCount) {
|
|
57
|
+
textCount = text;
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
});
|
|
62
|
+
let setting;
|
|
63
|
+
const items = await this.findElements(SettingsEditor.locators.SettingsEditor.itemRow);
|
|
64
|
+
for (const item of items) {
|
|
65
|
+
try {
|
|
66
|
+
const _category = (await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingCategory)).getText()).replace(':', '');
|
|
67
|
+
const _title = await (await item.findElement(SettingsEditor.locators.SettingsEditor.settingLabel)).getText();
|
|
68
|
+
if (category !== '') {
|
|
69
|
+
if (category.toLowerCase().replace(this.divider, '').replace(/\s/g, '').trim() !== _category.toLowerCase().replace(this.divider, '').replace(/\s/g, '').trim()) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (title !== '') {
|
|
74
|
+
if (title.toLowerCase().replace(/\s/g, '').trim() !== _title.toLowerCase().replace(/\s/g, '').trim()) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return await (await this.createSetting(item, _title, _category)).wait();
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return setting;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Switch between settings perspectives
|
|
87
|
+
* Works only if your vscode instance has both user and workspace settings available
|
|
88
|
+
*
|
|
89
|
+
* @param perspective User or Workspace
|
|
90
|
+
* @returns Promise that resolves when the appropriate button is clicked
|
|
91
|
+
*/
|
|
92
|
+
async switchToPerspective(perspective) {
|
|
93
|
+
const actions = await this.findElement(SettingsEditor.locators.SettingsEditor.header)
|
|
94
|
+
.findElement(SettingsEditor.locators.SettingsEditor.tabs)
|
|
95
|
+
.findElement(SettingsEditor.locators.SettingsEditor.actions);
|
|
96
|
+
await actions.findElement(SettingsEditor.locators.SettingsEditor.action(perspective)).click();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Context menu is disabled in this editor, throw an error
|
|
100
|
+
*/
|
|
101
|
+
async openContextMenu() {
|
|
102
|
+
throw new Error('Operation not supported');
|
|
103
|
+
}
|
|
104
|
+
async createSetting(element, title, category) {
|
|
105
|
+
await element.findElement(SettingsEditor.locators.SettingsEditor.settingConstructor(title, category));
|
|
106
|
+
try {
|
|
107
|
+
// try a combo setting
|
|
108
|
+
await element.findElement(SettingsEditor.locators.SettingsEditor.comboSetting);
|
|
109
|
+
return new ComboSetting(SettingsEditor.locators.SettingsEditor.settingConstructor(title, category), this);
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
try {
|
|
113
|
+
// try text setting
|
|
114
|
+
await element.findElement(SettingsEditor.locators.SettingsEditor.textSetting);
|
|
115
|
+
return new TextSetting(SettingsEditor.locators.SettingsEditor.settingConstructor(title, category), this);
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
try {
|
|
119
|
+
// try checkbox setting
|
|
120
|
+
await element.findElement(SettingsEditor.locators.SettingsEditor.checkboxSetting);
|
|
121
|
+
return new CheckboxSetting(SettingsEditor.locators.SettingsEditor.settingConstructor(title, category), this);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
// try link setting
|
|
125
|
+
try {
|
|
126
|
+
await element.findElement(SettingsEditor.locators.SettingsEditor.linkButton);
|
|
127
|
+
return new LinkSetting(SettingsEditor.locators.SettingsEditor.settingConstructor(title, category), this);
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
throw new Error('Setting type not supported');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.SettingsEditor = SettingsEditor;
|
|
138
|
+
/**
|
|
139
|
+
* Abstract item representing a Setting with title, description and
|
|
140
|
+
* an input element (combo/textbox/checkbox/link)
|
|
141
|
+
*/
|
|
142
|
+
class Setting extends AbstractElement_1.AbstractElement {
|
|
143
|
+
constructor(settingsConstructor, settings) {
|
|
144
|
+
super(settingsConstructor, settings);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the category of the setting
|
|
148
|
+
* All settings are labeled as Category: Title
|
|
149
|
+
*/
|
|
150
|
+
async getCategory() {
|
|
151
|
+
return await (await this.findElement(SettingsEditor.locators.SettingsEditor.settingCategory)).getText();
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Get description of the setting
|
|
155
|
+
* @returns Promise resolving to setting description
|
|
156
|
+
*/
|
|
157
|
+
async getDescription() {
|
|
158
|
+
return await (await this.findElement(SettingsEditor.locators.SettingsEditor.settingDesctiption)).getText();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Get title of the setting
|
|
162
|
+
*/
|
|
163
|
+
async getTitle() {
|
|
164
|
+
return await (await this.findElement(SettingsEditor.locators.SettingsEditor.settingLabel)).getText();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
exports.Setting = Setting;
|
|
168
|
+
/**
|
|
169
|
+
* Setting with a combo box
|
|
170
|
+
*/
|
|
171
|
+
class ComboSetting extends Setting {
|
|
172
|
+
async getValue() {
|
|
173
|
+
const combo = await this.findElement(SettingsEditor.locators.SettingsEditor.comboSetting);
|
|
174
|
+
return await combo.getAttribute(SettingsEditor.locators.SettingsEditor.comboValue);
|
|
175
|
+
}
|
|
176
|
+
async setValue(value) {
|
|
177
|
+
const rows = await this.getOptions();
|
|
178
|
+
for (let row of rows) {
|
|
179
|
+
if ((await row.getAttribute('class')).indexOf('disabled') < 0) {
|
|
180
|
+
const text = await (await row.findElement(SettingsEditor.locators.SettingsEditor.comboOption)).getText();
|
|
181
|
+
if (value === text) {
|
|
182
|
+
return await row.click();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get the labels of all options from the combo
|
|
189
|
+
* @returns Promise resolving to array of string values
|
|
190
|
+
*/
|
|
191
|
+
async getValues() {
|
|
192
|
+
const values = [];
|
|
193
|
+
const rows = await this.getOptions();
|
|
194
|
+
for (const row of rows) {
|
|
195
|
+
values.push(await (await row.findElement(SettingsEditor.locators.SettingsEditor.comboOption)).getText());
|
|
196
|
+
}
|
|
197
|
+
return values;
|
|
198
|
+
}
|
|
199
|
+
async getOptions() {
|
|
200
|
+
const menu = await this.openCombo();
|
|
201
|
+
return await menu.findElements(SettingsEditor.locators.SettingsEditor.itemRow);
|
|
202
|
+
}
|
|
203
|
+
async openCombo() {
|
|
204
|
+
const combo = await this.findElement(SettingsEditor.locators.SettingsEditor.comboSetting);
|
|
205
|
+
const workbench = await this.getDriver().findElement(SettingsEditor.locators.Workbench.constructor);
|
|
206
|
+
const menus = await workbench.findElements(SettingsEditor.locators.ContextMenu.contextView);
|
|
207
|
+
let menu;
|
|
208
|
+
if (menus.length < 1) {
|
|
209
|
+
await combo.click();
|
|
210
|
+
menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView);
|
|
211
|
+
return menu;
|
|
212
|
+
}
|
|
213
|
+
else if (await menus[0].isDisplayed()) {
|
|
214
|
+
await combo.click();
|
|
215
|
+
await this.getDriver().sleep(200);
|
|
216
|
+
}
|
|
217
|
+
await combo.click();
|
|
218
|
+
menu = await workbench.findElement(SettingsEditor.locators.ContextMenu.contextView);
|
|
219
|
+
return menu;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
exports.ComboSetting = ComboSetting;
|
|
223
|
+
/**
|
|
224
|
+
* Setting with a text box input
|
|
225
|
+
*/
|
|
226
|
+
class TextSetting extends Setting {
|
|
227
|
+
async getValue() {
|
|
228
|
+
const input = await this.findElement(SettingsEditor.locators.SettingsEditor.textSetting);
|
|
229
|
+
return await input.getAttribute('value');
|
|
230
|
+
}
|
|
231
|
+
async setValue(value) {
|
|
232
|
+
const input = await this.findElement(SettingsEditor.locators.SettingsEditor.textSetting);
|
|
233
|
+
await input.clear();
|
|
234
|
+
await input.sendKeys(value);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.TextSetting = TextSetting;
|
|
238
|
+
/**
|
|
239
|
+
* Setting with a checkbox
|
|
240
|
+
*/
|
|
241
|
+
class CheckboxSetting extends Setting {
|
|
242
|
+
async getValue() {
|
|
243
|
+
const checkbox = await this.findElement(SettingsEditor.locators.SettingsEditor.checkboxSetting);
|
|
244
|
+
const checked = await checkbox.getAttribute(SettingsEditor.locators.SettingsEditor.checkboxChecked);
|
|
245
|
+
if (checked === 'true') {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
async setValue(value) {
|
|
251
|
+
const checkbox = await this.findElement(SettingsEditor.locators.SettingsEditor.checkboxSetting);
|
|
252
|
+
if (await this.getValue() !== value) {
|
|
253
|
+
await checkbox.click();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
exports.CheckboxSetting = CheckboxSetting;
|
|
258
|
+
/**
|
|
259
|
+
* Setting with no value, with a link to settings.json instead
|
|
260
|
+
*/
|
|
261
|
+
class LinkSetting extends Setting {
|
|
262
|
+
async getValue() {
|
|
263
|
+
throw new Error('Method getValue is not available for LinkSetting');
|
|
264
|
+
}
|
|
265
|
+
async setValue(value) {
|
|
266
|
+
throw new Error('Method setValue is not available for LinkSetting');
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Open the link that leads to the value in settings.json
|
|
270
|
+
* @returns Promise resolving when the link has been clicked
|
|
271
|
+
*/
|
|
272
|
+
async openLink() {
|
|
273
|
+
const link = await this.findElement(SettingsEditor.locators.SettingsEditor.linkButton);
|
|
274
|
+
await link.click();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
exports.LinkSetting = LinkSetting;
|
|
278
|
+
//# sourceMappingURL=SettingsEditor.js.map
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { ContentAssist, ContextMenu, InputBox } from "../..";
|
|
2
|
+
import { WebElement } from "selenium-webdriver";
|
|
3
|
+
import { Editor } from "./Editor";
|
|
4
|
+
import { ElementWithContexMenu } from "../ElementWithContextMenu";
|
|
5
|
+
import { AbstractElement } from "../AbstractElement";
|
|
6
|
+
import { Breakpoint } from "./Breakpoint";
|
|
7
|
+
export declare class BreakpointError extends Error {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Page object representing the active text editor
|
|
11
|
+
*/
|
|
12
|
+
export declare class TextEditor extends Editor {
|
|
13
|
+
breakPoints: number[];
|
|
14
|
+
/**
|
|
15
|
+
* Find whether the active editor has unsaved changes
|
|
16
|
+
* @returns Promise resolving to true/false
|
|
17
|
+
*/
|
|
18
|
+
isDirty(): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Saves the active editor
|
|
21
|
+
* @returns Promise resolving when ctrl+s is invoked
|
|
22
|
+
*/
|
|
23
|
+
save(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Open the Save as prompt
|
|
26
|
+
*
|
|
27
|
+
* @returns InputBox serving as a simple file dialog
|
|
28
|
+
*/
|
|
29
|
+
saveAs(): Promise<InputBox>;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve the Uri of the file opened in the active editor
|
|
32
|
+
* @returns Promise resolving to editor's underlying Uri
|
|
33
|
+
*/
|
|
34
|
+
getFileUri(): Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve the path to the file opened in the active editor
|
|
37
|
+
* @returns Promise resolving to editor's underlying file path
|
|
38
|
+
*/
|
|
39
|
+
getFilePath(): Promise<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Open/Close the content assistant at the current position in the editor by sending the default
|
|
42
|
+
* keyboard shortcut signal
|
|
43
|
+
* @param open true to open, false to close
|
|
44
|
+
* @returns Promise resolving to ContentAssist object when opening, void otherwise
|
|
45
|
+
*/
|
|
46
|
+
toggleContentAssist(open: boolean): Promise<ContentAssist | void>;
|
|
47
|
+
/**
|
|
48
|
+
* Get all text from the editor
|
|
49
|
+
* @returns Promise resolving to editor text
|
|
50
|
+
*/
|
|
51
|
+
getText(): Promise<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Replace the contents of the editor with a given text
|
|
54
|
+
* @param text text to type into the editor
|
|
55
|
+
* @param formatText format the new text, default false
|
|
56
|
+
* @returns Promise resolving once the new text is copied over
|
|
57
|
+
*/
|
|
58
|
+
setText(text: string, formatText?: boolean): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Deletes all text within the editor
|
|
61
|
+
* @returns Promise resolving once the text is deleted
|
|
62
|
+
*/
|
|
63
|
+
clearText(): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Get text from a given line
|
|
66
|
+
* @param line number of the line to retrieve
|
|
67
|
+
* @returns Promise resolving to text at the given line number
|
|
68
|
+
*/
|
|
69
|
+
getTextAtLine(line: number): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Replace the contents of a line with a given text
|
|
72
|
+
* @param line number of the line to edit
|
|
73
|
+
* @param text text to set at the line
|
|
74
|
+
* @returns Promise resolving when the text is typed in
|
|
75
|
+
*/
|
|
76
|
+
setTextAtLine(line: number, text: string): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Get line number that contains the given text. Not suitable for multi line inputs.
|
|
79
|
+
*
|
|
80
|
+
* @param text text to search for
|
|
81
|
+
* @param occurrence select which occurrence of the search text to look for in case there are multiple in the document, defaults to 1 (the first instance)
|
|
82
|
+
*
|
|
83
|
+
* @returns Number of the line that contains the start of the given text. -1 if no such text is found.
|
|
84
|
+
* If occurrence number is specified, searches until it finds as many instances of the given text.
|
|
85
|
+
* Returns the line number that holds the last occurrence found this way.
|
|
86
|
+
*/
|
|
87
|
+
getLineOfText(text: string, occurrence?: number): Promise<number>;
|
|
88
|
+
/**
|
|
89
|
+
* Find and select a given text. Not usable for multi line selection.
|
|
90
|
+
*
|
|
91
|
+
* @param text text to select
|
|
92
|
+
* @param occurrence specify which onccurrence of text to select if multiple are present in the document
|
|
93
|
+
*/
|
|
94
|
+
selectText(text: string, occurrence?: number): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Get the text that is currently selected as string
|
|
97
|
+
*/
|
|
98
|
+
getSelectedText(): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Get the selection block as a page object
|
|
101
|
+
* @returns Selection page object
|
|
102
|
+
*/
|
|
103
|
+
getSelection(): Promise<Selection | undefined>;
|
|
104
|
+
openFindWidget(): Promise<FindWidget>;
|
|
105
|
+
/**
|
|
106
|
+
* Add the given text to the given coordinates
|
|
107
|
+
* @param line number of the line to type into
|
|
108
|
+
* @param column number of the column to start typing at
|
|
109
|
+
* @param text text to add
|
|
110
|
+
* @returns Promise resolving when the text is typed in
|
|
111
|
+
*/
|
|
112
|
+
typeTextAt(line: number, column: number, text: string): Promise<void>;
|
|
113
|
+
/**
|
|
114
|
+
* Type given text at the current coordinates
|
|
115
|
+
* @param text text to type
|
|
116
|
+
* @returns promise resolving when the text is typed in
|
|
117
|
+
*/
|
|
118
|
+
typeText(text: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Move the cursor to the given coordinates
|
|
121
|
+
* @param line line number to move to
|
|
122
|
+
* @param column column number to move to
|
|
123
|
+
* @returns Promise resolving when the cursor has reached the given coordinates
|
|
124
|
+
*/
|
|
125
|
+
moveCursor(line: number, column: number): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Get number of lines in the editor
|
|
128
|
+
* @returns Promise resolving to number of lines
|
|
129
|
+
*/
|
|
130
|
+
getNumberOfLines(): Promise<number>;
|
|
131
|
+
/**
|
|
132
|
+
* Use the built-in 'Format Document' option to format the text
|
|
133
|
+
* @returns Promise resolving when the Format Document command is invoked
|
|
134
|
+
*/
|
|
135
|
+
formatDocument(): Promise<void>;
|
|
136
|
+
openContextMenu(): Promise<ContextMenu>;
|
|
137
|
+
/**
|
|
138
|
+
* Get the cursor's coordinates as an array of two numbers: `[line, column]`
|
|
139
|
+
*
|
|
140
|
+
* **Caution** line & column coordinates do not start at `0` but at `1`!
|
|
141
|
+
*/
|
|
142
|
+
getCoordinates(): Promise<[number, number]>;
|
|
143
|
+
/**
|
|
144
|
+
* Toggle breakpoint on a given line
|
|
145
|
+
*
|
|
146
|
+
* @param line target line number
|
|
147
|
+
* @returns promise resolving to True when a breakpoint was added, False when removed
|
|
148
|
+
*/
|
|
149
|
+
toggleBreakpoint(line: number): Promise<boolean>;
|
|
150
|
+
/**
|
|
151
|
+
* Get paused breakpoint if available. Otherwise, return undefined.
|
|
152
|
+
* @returns promise which resolves to either Breakpoint page object or undefined
|
|
153
|
+
*/
|
|
154
|
+
getPausedBreakpoint(): Promise<Breakpoint | undefined>;
|
|
155
|
+
/**
|
|
156
|
+
* Get all code lenses within the editor
|
|
157
|
+
* @returns list of CodeLens page objects
|
|
158
|
+
*/
|
|
159
|
+
getCodeLenses(): Promise<CodeLens[]>;
|
|
160
|
+
/**
|
|
161
|
+
* Get a code lens based on title, or zero based index
|
|
162
|
+
*
|
|
163
|
+
* @param indexOrTitle zero based index (counting from the top of the editor), or partial title of the code lens
|
|
164
|
+
* @returns CodeLens object if such a code lens exists, undefined otherwise
|
|
165
|
+
*/
|
|
166
|
+
getCodeLens(indexOrTitle: number | string): Promise<CodeLens | undefined>;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Text selection block
|
|
170
|
+
*/
|
|
171
|
+
declare class Selection extends ElementWithContexMenu {
|
|
172
|
+
constructor(el: WebElement, editor: TextEditor);
|
|
173
|
+
openContextMenu(): Promise<ContextMenu>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Page object for Code Lens inside a text editor
|
|
177
|
+
*/
|
|
178
|
+
export declare class CodeLens extends AbstractElement {
|
|
179
|
+
/**
|
|
180
|
+
* Get tooltip of the code lens
|
|
181
|
+
* @returns tooltip as string
|
|
182
|
+
*/
|
|
183
|
+
getTooltip(): Promise<string>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Text Editor's Find Widget
|
|
187
|
+
*/
|
|
188
|
+
export declare class FindWidget extends AbstractElement {
|
|
189
|
+
constructor(element: WebElement, editor: TextEditor);
|
|
190
|
+
/**
|
|
191
|
+
* Toggle between find and replace mode
|
|
192
|
+
* @param replace true for replace, false for find
|
|
193
|
+
*/
|
|
194
|
+
toggleReplace(replace: boolean): Promise<void>;
|
|
195
|
+
/**
|
|
196
|
+
* Set text in the search box
|
|
197
|
+
* @param text text to fill in
|
|
198
|
+
*/
|
|
199
|
+
setSearchText(text: string): Promise<void>;
|
|
200
|
+
/**
|
|
201
|
+
* Get text from Find input box
|
|
202
|
+
* @returns value of find input as string
|
|
203
|
+
*/
|
|
204
|
+
getSearchText(): Promise<string>;
|
|
205
|
+
/**
|
|
206
|
+
* Set text in the replace box. Will toggle replace mode on if called in find mode.
|
|
207
|
+
* @param text text to fill in
|
|
208
|
+
*/
|
|
209
|
+
setReplaceText(text: string): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* Get text from Replace input box
|
|
212
|
+
* @returns value of replace input as string
|
|
213
|
+
*/
|
|
214
|
+
getReplaceText(): Promise<string>;
|
|
215
|
+
/**
|
|
216
|
+
* Click 'Next match'
|
|
217
|
+
*/
|
|
218
|
+
nextMatch(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Click 'Previous match'
|
|
221
|
+
*/
|
|
222
|
+
previousMatch(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Click 'Replace'. Only works in replace mode.
|
|
225
|
+
*/
|
|
226
|
+
replace(): Promise<void>;
|
|
227
|
+
/**
|
|
228
|
+
* Click 'Replace All'. Only works in replace mode.
|
|
229
|
+
*/
|
|
230
|
+
replaceAll(): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Close the widget.
|
|
233
|
+
*/
|
|
234
|
+
close(): Promise<void>;
|
|
235
|
+
/**
|
|
236
|
+
* Get the number of results as an ordered pair of numbers
|
|
237
|
+
* @returns pair in form of [current result index, total number of results]
|
|
238
|
+
*/
|
|
239
|
+
getResultCount(): Promise<[number, number]>;
|
|
240
|
+
/**
|
|
241
|
+
* Toggle the search to match case
|
|
242
|
+
* @param toggle true to turn on, false to turn off
|
|
243
|
+
*/
|
|
244
|
+
toggleMatchCase(toggle: boolean): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Toggle the search to match whole words
|
|
247
|
+
* @param toggle true to turn on, false to turn off
|
|
248
|
+
*/
|
|
249
|
+
toggleMatchWholeWord(toggle: boolean): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* Toggle the search to use regular expressions
|
|
252
|
+
* @param toggle true to turn on, false to turn off
|
|
253
|
+
*/
|
|
254
|
+
toggleUseRegularExpression(toggle: boolean): Promise<void>;
|
|
255
|
+
/**
|
|
256
|
+
* Toggle the replace to preserve case
|
|
257
|
+
* @param toggle true to turn on, false to turn off
|
|
258
|
+
*/
|
|
259
|
+
togglePreserveCase(toggle: boolean): Promise<void>;
|
|
260
|
+
private toggleControl;
|
|
261
|
+
private clickButton;
|
|
262
|
+
private setText;
|
|
263
|
+
private getInputText;
|
|
264
|
+
}
|
|
265
|
+
export {};
|