@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,10 @@
|
|
|
1
|
+
import { EditorGroup } from "./EditorView";
|
|
2
|
+
import { AbstractElement } from "../AbstractElement";
|
|
3
|
+
import { WebElement } from "../..";
|
|
4
|
+
export declare class EditorAction extends AbstractElement {
|
|
5
|
+
constructor(element: WebElement, parent: EditorGroup);
|
|
6
|
+
/**
|
|
7
|
+
* Get text description of the action.
|
|
8
|
+
*/
|
|
9
|
+
getTitle(): Promise<string>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditorAction = void 0;
|
|
4
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
5
|
+
class EditorAction extends AbstractElement_1.AbstractElement {
|
|
6
|
+
constructor(element, parent) {
|
|
7
|
+
super(element, parent);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get text description of the action.
|
|
11
|
+
*/
|
|
12
|
+
async getTitle() {
|
|
13
|
+
return await this.getAttribute(EditorAction.locators.EditorView.attribute);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.EditorAction = EditorAction;
|
|
17
|
+
//# sourceMappingURL=EditorAction.js.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { WebElement } from "selenium-webdriver";
|
|
2
|
+
import { AbstractElement } from "../AbstractElement";
|
|
3
|
+
import { ElementWithContexMenu } from "../ElementWithContextMenu";
|
|
4
|
+
import { Editor } from "./Editor";
|
|
5
|
+
import { EditorAction } from "./EditorAction";
|
|
6
|
+
export declare class EditorTabNotFound extends Error {
|
|
7
|
+
constructor(title: string, group: number);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* View handling the open editors
|
|
11
|
+
*/
|
|
12
|
+
export declare class EditorView extends AbstractElement {
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Switch to an editor tab with the given title
|
|
16
|
+
* @param title title of the tab
|
|
17
|
+
* @param groupIndex zero based index for the editor group (0 for the left most group)
|
|
18
|
+
* @returns Promise resolving to Editor object
|
|
19
|
+
*/
|
|
20
|
+
openEditor(title: string, groupIndex?: number): Promise<Editor>;
|
|
21
|
+
/**
|
|
22
|
+
* Close an editor tab with the given title
|
|
23
|
+
* @param title title of the tab
|
|
24
|
+
* @param groupIndex zero based index for the editor group (0 for the left most group)
|
|
25
|
+
* @returns Promise resolving when the tab's close button is pressed
|
|
26
|
+
*/
|
|
27
|
+
closeEditor(title: string, groupIndex?: number): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Close all open editor tabs
|
|
30
|
+
* @param groupIndex optional index to specify an editor group
|
|
31
|
+
* @returns Promise resolving once all tabs have had their close button pressed
|
|
32
|
+
*/
|
|
33
|
+
closeAllEditors(groupIndex?: number): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieve all open editor tab titles in an array
|
|
36
|
+
* @param groupIndex optional index to specify an editor group, if left empty will search all groups
|
|
37
|
+
* @returns Promise resolving to array of editor titles
|
|
38
|
+
*/
|
|
39
|
+
getOpenEditorTitles(groupIndex?: number): Promise<string[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve an editor tab from a given group by title
|
|
42
|
+
* @param title title of the tab
|
|
43
|
+
* @param groupIndex zero based index of the editor group, default 0 (leftmost one)
|
|
44
|
+
* @returns promise resolving to EditorTab object
|
|
45
|
+
*/
|
|
46
|
+
getTabByTitle(title: string, groupIndex?: number): Promise<EditorTab>;
|
|
47
|
+
/**
|
|
48
|
+
* Retrieve all open editor tabs
|
|
49
|
+
* @param groupIndex index of group to search for tabs, if left undefined, all groups are searched
|
|
50
|
+
* @returns promise resolving to EditorTab list
|
|
51
|
+
*/
|
|
52
|
+
getOpenTabs(groupIndex?: number): Promise<EditorTab[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieve the active editor tab
|
|
55
|
+
* @returns promise resolving to EditorTab object, undefined if no tab is active
|
|
56
|
+
*/
|
|
57
|
+
getActiveTab(): Promise<EditorTab | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Retrieve all editor groups in a list, sorted left to right
|
|
60
|
+
* @returns promise resolving to an array of EditorGroup objects
|
|
61
|
+
*/
|
|
62
|
+
getEditorGroups(): Promise<EditorGroup[]>;
|
|
63
|
+
/**
|
|
64
|
+
* Retrieve an editor group with a given index (counting from left to right)
|
|
65
|
+
* @param index zero based index of the editor group (leftmost group has index 0)
|
|
66
|
+
* @returns promise resolving to an EditorGroup object
|
|
67
|
+
*/
|
|
68
|
+
getEditorGroup(index: number): Promise<EditorGroup>;
|
|
69
|
+
/**
|
|
70
|
+
* Get editor actions of a select editor group
|
|
71
|
+
* @param groupIndex zero based index of the editor group (leftmost group has index 0), default 0
|
|
72
|
+
* @returns promise resolving to list of EditorAction objects
|
|
73
|
+
*/
|
|
74
|
+
getActions(groupIndex?: number): Promise<EditorAction[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Get editor action of a select editor group, search by title or predicate
|
|
77
|
+
* @param predicateOrTitle title or predicate to be used in search process
|
|
78
|
+
* @param groupIndex zero based index of the editor group (leftmost group has index 0), default 0
|
|
79
|
+
* @returns promise resolving to EditorAction object if found, undefined otherwise
|
|
80
|
+
*/
|
|
81
|
+
getAction(predicateOrTitle: string | ((action: EditorAction) => boolean | PromiseLike<boolean>), groupIndex?: number): Promise<EditorAction | undefined>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Page object representing an editor group
|
|
85
|
+
*/
|
|
86
|
+
export declare class EditorGroup extends AbstractElement {
|
|
87
|
+
private index;
|
|
88
|
+
constructor(element: WebElement, view?: EditorView, index?: number);
|
|
89
|
+
/**
|
|
90
|
+
* Switch to an editor tab with the given title
|
|
91
|
+
* @param title title of the tab
|
|
92
|
+
* @returns Promise resolving to Editor object
|
|
93
|
+
*/
|
|
94
|
+
openEditor(title: string): Promise<Editor>;
|
|
95
|
+
/**
|
|
96
|
+
* Close an editor tab with the given title
|
|
97
|
+
* @param title title of the tab
|
|
98
|
+
* @returns Promise resolving when the tab's close button is pressed
|
|
99
|
+
*/
|
|
100
|
+
closeEditor(title: string): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Close all open editor tabs
|
|
103
|
+
* @returns Promise resolving once all tabs have had their close button pressed
|
|
104
|
+
*/
|
|
105
|
+
closeAllEditors(): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Retrieve all open editor tab titles in an array
|
|
108
|
+
* @returns Promise resolving to array of editor titles
|
|
109
|
+
*/
|
|
110
|
+
getOpenEditorTitles(): Promise<string[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Retrieve an editor tab by title
|
|
113
|
+
* @param title title of the tab
|
|
114
|
+
* @returns promise resolving to EditorTab object
|
|
115
|
+
*/
|
|
116
|
+
getTabByTitle(title: string): Promise<EditorTab>;
|
|
117
|
+
/**
|
|
118
|
+
* Retrieve all open editor tabs
|
|
119
|
+
* @returns promise resolving to EditorTab list
|
|
120
|
+
*/
|
|
121
|
+
getOpenTabs(): Promise<EditorTab[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Retrieve the active editor tab
|
|
124
|
+
* @returns promise resolving to EditorTab object, undefined if no tab is active
|
|
125
|
+
*/
|
|
126
|
+
getActiveTab(): Promise<EditorTab | undefined>;
|
|
127
|
+
/**
|
|
128
|
+
* Retrieve the editor action buttons as EditorActions
|
|
129
|
+
* @returns promise resolving to list of EditorAction objects
|
|
130
|
+
*/
|
|
131
|
+
getActions(): Promise<EditorAction[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Find an editor action button by predicate or title
|
|
134
|
+
* @param predicateOrTitle predicate/title to be used
|
|
135
|
+
* @returns promise resolving to EditorAction representing the button if found, undefined otherwise
|
|
136
|
+
*/
|
|
137
|
+
getAction(predicateOrTitle: string | ((action: EditorAction) => boolean | PromiseLike<boolean>)): Promise<EditorAction | undefined>;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Page object for editor view tab
|
|
141
|
+
*/
|
|
142
|
+
export declare class EditorTab extends ElementWithContexMenu {
|
|
143
|
+
constructor(element: WebElement, view: EditorView);
|
|
144
|
+
/**
|
|
145
|
+
* Get the tab title as string
|
|
146
|
+
*/
|
|
147
|
+
getTitle(): Promise<string>;
|
|
148
|
+
/**
|
|
149
|
+
* Select (click) the tab
|
|
150
|
+
*/
|
|
151
|
+
select(): Promise<void>;
|
|
152
|
+
isSelected(): Promise<boolean>;
|
|
153
|
+
}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditorTab = exports.EditorGroup = exports.EditorView = exports.EditorTabNotFound = void 0;
|
|
4
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
5
|
+
const __1 = require("../..");
|
|
6
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
7
|
+
const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
|
|
8
|
+
const DiffEditor_1 = require("./DiffEditor");
|
|
9
|
+
const EditorAction_1 = require("./EditorAction");
|
|
10
|
+
const SettingsEditor_1 = require("./SettingsEditor");
|
|
11
|
+
const WebView_1 = require("./WebView");
|
|
12
|
+
class EditorTabNotFound extends Error {
|
|
13
|
+
constructor(title, group) {
|
|
14
|
+
super(`No editor with title '${title}' in group '${group}' available`);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.EditorTabNotFound = EditorTabNotFound;
|
|
18
|
+
/**
|
|
19
|
+
* View handling the open editors
|
|
20
|
+
*/
|
|
21
|
+
class EditorView extends AbstractElement_1.AbstractElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(EditorView.locators.EditorView.constructor, EditorView.locators.Workbench.constructor);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Switch to an editor tab with the given title
|
|
27
|
+
* @param title title of the tab
|
|
28
|
+
* @param groupIndex zero based index for the editor group (0 for the left most group)
|
|
29
|
+
* @returns Promise resolving to Editor object
|
|
30
|
+
*/
|
|
31
|
+
async openEditor(title, groupIndex = 0) {
|
|
32
|
+
const group = await this.getEditorGroup(groupIndex);
|
|
33
|
+
return group.openEditor(title);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Close an editor tab with the given title
|
|
37
|
+
* @param title title of the tab
|
|
38
|
+
* @param groupIndex zero based index for the editor group (0 for the left most group)
|
|
39
|
+
* @returns Promise resolving when the tab's close button is pressed
|
|
40
|
+
*/
|
|
41
|
+
async closeEditor(title, groupIndex = 0) {
|
|
42
|
+
const group = await this.getEditorGroup(groupIndex);
|
|
43
|
+
return group.closeEditor(title);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Close all open editor tabs
|
|
47
|
+
* @param groupIndex optional index to specify an editor group
|
|
48
|
+
* @returns Promise resolving once all tabs have had their close button pressed
|
|
49
|
+
*/
|
|
50
|
+
async closeAllEditors(groupIndex) {
|
|
51
|
+
let groups = await this.getEditorGroups();
|
|
52
|
+
if (groupIndex !== undefined) {
|
|
53
|
+
return groups[groupIndex].closeAllEditors();
|
|
54
|
+
}
|
|
55
|
+
while (groups.length > 0 && (await groups[0].getOpenEditorTitles()).length > 0) {
|
|
56
|
+
await groups[0].closeAllEditors();
|
|
57
|
+
await new Promise(res => setTimeout(res, 1000));
|
|
58
|
+
groups = await this.getEditorGroups();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Retrieve all open editor tab titles in an array
|
|
63
|
+
* @param groupIndex optional index to specify an editor group, if left empty will search all groups
|
|
64
|
+
* @returns Promise resolving to array of editor titles
|
|
65
|
+
*/
|
|
66
|
+
async getOpenEditorTitles(groupIndex) {
|
|
67
|
+
const groups = await this.getEditorGroups();
|
|
68
|
+
if (groupIndex !== undefined) {
|
|
69
|
+
return groups[groupIndex].getOpenEditorTitles();
|
|
70
|
+
}
|
|
71
|
+
const titles = [];
|
|
72
|
+
for (const group of groups) {
|
|
73
|
+
titles.push(...(await group.getOpenEditorTitles()));
|
|
74
|
+
}
|
|
75
|
+
return titles;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Retrieve an editor tab from a given group by title
|
|
79
|
+
* @param title title of the tab
|
|
80
|
+
* @param groupIndex zero based index of the editor group, default 0 (leftmost one)
|
|
81
|
+
* @returns promise resolving to EditorTab object
|
|
82
|
+
*/
|
|
83
|
+
async getTabByTitle(title, groupIndex = 0) {
|
|
84
|
+
const group = await this.getEditorGroup(groupIndex);
|
|
85
|
+
return group.getTabByTitle(title);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Retrieve all open editor tabs
|
|
89
|
+
* @param groupIndex index of group to search for tabs, if left undefined, all groups are searched
|
|
90
|
+
* @returns promise resolving to EditorTab list
|
|
91
|
+
*/
|
|
92
|
+
async getOpenTabs(groupIndex) {
|
|
93
|
+
const groups = await this.getEditorGroups();
|
|
94
|
+
if (groupIndex !== undefined) {
|
|
95
|
+
return groups[groupIndex].getOpenTabs();
|
|
96
|
+
}
|
|
97
|
+
const tabs = [];
|
|
98
|
+
for (const group of groups) {
|
|
99
|
+
tabs.push(...(await group.getOpenTabs()));
|
|
100
|
+
}
|
|
101
|
+
return tabs;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Retrieve the active editor tab
|
|
105
|
+
* @returns promise resolving to EditorTab object, undefined if no tab is active
|
|
106
|
+
*/
|
|
107
|
+
async getActiveTab() {
|
|
108
|
+
const tabs = await this.getOpenTabs();
|
|
109
|
+
for (const tab of tabs) {
|
|
110
|
+
if (await tab.isSelected()) {
|
|
111
|
+
return tab;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Retrieve all editor groups in a list, sorted left to right
|
|
118
|
+
* @returns promise resolving to an array of EditorGroup objects
|
|
119
|
+
*/
|
|
120
|
+
async getEditorGroups() {
|
|
121
|
+
const elements = await this.findElements(EditorGroup.locators.EditorView.editorGroup);
|
|
122
|
+
const groups = await Promise.all(elements.map(async (element, index) => new EditorGroup(element, this, index).wait()));
|
|
123
|
+
// sort the groups by x coordinates, so the leftmost is always at index 0
|
|
124
|
+
for (let i = 0; i < groups.length - 1; i++) {
|
|
125
|
+
for (let j = 0; j < groups.length - i - 1; j++) {
|
|
126
|
+
if ((await groups[j].getRect()).x > (await groups[j + 1].getRect()).x) {
|
|
127
|
+
let temp = groups[j];
|
|
128
|
+
groups[j] = groups[j + 1];
|
|
129
|
+
groups[j + 1] = temp;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return groups;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Retrieve an editor group with a given index (counting from left to right)
|
|
137
|
+
* @param index zero based index of the editor group (leftmost group has index 0)
|
|
138
|
+
* @returns promise resolving to an EditorGroup object
|
|
139
|
+
*/
|
|
140
|
+
async getEditorGroup(index) {
|
|
141
|
+
return (await this.getEditorGroups())[index];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Get editor actions of a select editor group
|
|
145
|
+
* @param groupIndex zero based index of the editor group (leftmost group has index 0), default 0
|
|
146
|
+
* @returns promise resolving to list of EditorAction objects
|
|
147
|
+
*/
|
|
148
|
+
async getActions(groupIndex = 0) {
|
|
149
|
+
const group = await this.getEditorGroup(groupIndex);
|
|
150
|
+
return group.getActions();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get editor action of a select editor group, search by title or predicate
|
|
154
|
+
* @param predicateOrTitle title or predicate to be used in search process
|
|
155
|
+
* @param groupIndex zero based index of the editor group (leftmost group has index 0), default 0
|
|
156
|
+
* @returns promise resolving to EditorAction object if found, undefined otherwise
|
|
157
|
+
*/
|
|
158
|
+
async getAction(predicateOrTitle, groupIndex = 0) {
|
|
159
|
+
const group = await this.getEditorGroup(groupIndex);
|
|
160
|
+
return group.getAction(predicateOrTitle);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
exports.EditorView = EditorView;
|
|
164
|
+
/**
|
|
165
|
+
* Page object representing an editor group
|
|
166
|
+
*/
|
|
167
|
+
class EditorGroup extends AbstractElement_1.AbstractElement {
|
|
168
|
+
index;
|
|
169
|
+
constructor(element, view = new EditorView(), index = 0) {
|
|
170
|
+
super(element, view);
|
|
171
|
+
this.index = index;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Switch to an editor tab with the given title
|
|
175
|
+
* @param title title of the tab
|
|
176
|
+
* @returns Promise resolving to Editor object
|
|
177
|
+
*/
|
|
178
|
+
async openEditor(title) {
|
|
179
|
+
const tab = await this.getTabByTitle(title);
|
|
180
|
+
await tab.select();
|
|
181
|
+
try {
|
|
182
|
+
await this.findElement(EditorView.locators.EditorView.settingsEditor);
|
|
183
|
+
return new SettingsEditor_1.SettingsEditor(this).wait();
|
|
184
|
+
}
|
|
185
|
+
catch (err) {
|
|
186
|
+
try {
|
|
187
|
+
await this.findElement(EditorView.locators.EditorView.webView);
|
|
188
|
+
return new WebView_1.WebView(this).wait();
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
try {
|
|
192
|
+
await this.findElement(EditorView.locators.EditorView.diffEditor);
|
|
193
|
+
return new DiffEditor_1.DiffEditor(this).wait();
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
return new __1.TextEditor(this).wait();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Close an editor tab with the given title
|
|
203
|
+
* @param title title of the tab
|
|
204
|
+
* @returns Promise resolving when the tab's close button is pressed
|
|
205
|
+
*/
|
|
206
|
+
async closeEditor(title) {
|
|
207
|
+
const tab = await this.getTabByTitle(title);
|
|
208
|
+
const closeButton = await tab.findElement(EditorView.locators.EditorView.closeTab);
|
|
209
|
+
await closeButton.click();
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Close all open editor tabs
|
|
213
|
+
* @returns Promise resolving once all tabs have had their close button pressed
|
|
214
|
+
*/
|
|
215
|
+
async closeAllEditors() {
|
|
216
|
+
let titles = await this.getOpenEditorTitles();
|
|
217
|
+
while (titles.length > 0) {
|
|
218
|
+
await this.closeEditor(titles[0]);
|
|
219
|
+
try {
|
|
220
|
+
// check if the group still exists
|
|
221
|
+
await this.getTagName();
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
titles = await this.getOpenEditorTitles();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Retrieve all open editor tab titles in an array
|
|
231
|
+
* @returns Promise resolving to array of editor titles
|
|
232
|
+
*/
|
|
233
|
+
async getOpenEditorTitles() {
|
|
234
|
+
const tabs = await this.findElements(EditorView.locators.EditorView.tab);
|
|
235
|
+
const titles = [];
|
|
236
|
+
for (const tab of tabs) {
|
|
237
|
+
try {
|
|
238
|
+
const title = await new EditorTab(tab, this.enclosingItem).getTitle();
|
|
239
|
+
titles.push(title);
|
|
240
|
+
}
|
|
241
|
+
catch (e) {
|
|
242
|
+
if (e instanceof selenium_webdriver_1.error.StaleElementReferenceError) {
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
throw e;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return titles;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Retrieve an editor tab by title
|
|
252
|
+
* @param title title of the tab
|
|
253
|
+
* @returns promise resolving to EditorTab object
|
|
254
|
+
*/
|
|
255
|
+
async getTabByTitle(title) {
|
|
256
|
+
const tabs = await this.findElements(EditorView.locators.EditorView.tab);
|
|
257
|
+
for (const element of tabs) {
|
|
258
|
+
try {
|
|
259
|
+
const tab = new EditorTab(element, this.enclosingItem);
|
|
260
|
+
const label = await tab.getTitle();
|
|
261
|
+
if (label === title) {
|
|
262
|
+
return tab;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (e) {
|
|
266
|
+
if (e instanceof selenium_webdriver_1.error.StaleElementReferenceError) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
throw e;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
throw new EditorTabNotFound(title, this.index);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Retrieve all open editor tabs
|
|
276
|
+
* @returns promise resolving to EditorTab list
|
|
277
|
+
*/
|
|
278
|
+
async getOpenTabs() {
|
|
279
|
+
const tabs = await this.findElements(EditorView.locators.EditorView.tab);
|
|
280
|
+
return Promise.all(tabs.map(async (tab) => new EditorTab(tab, this.enclosingItem).wait()));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Retrieve the active editor tab
|
|
284
|
+
* @returns promise resolving to EditorTab object, undefined if no tab is active
|
|
285
|
+
*/
|
|
286
|
+
async getActiveTab() {
|
|
287
|
+
const tabs = await this.getOpenTabs();
|
|
288
|
+
for (const tab of tabs) {
|
|
289
|
+
if (await tab.isSelected()) {
|
|
290
|
+
return tab;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Retrieve the editor action buttons as EditorActions
|
|
297
|
+
* @returns promise resolving to list of EditorAction objects
|
|
298
|
+
*/
|
|
299
|
+
async getActions() {
|
|
300
|
+
const actions = await this.findElement(EditorGroup.locators.EditorView.actionContainer)
|
|
301
|
+
.findElements(EditorGroup.locators.EditorView.actionItem);
|
|
302
|
+
return actions.map((action) => new EditorAction_1.EditorAction(action, this));
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Find an editor action button by predicate or title
|
|
306
|
+
* @param predicateOrTitle predicate/title to be used
|
|
307
|
+
* @returns promise resolving to EditorAction representing the button if found, undefined otherwise
|
|
308
|
+
*/
|
|
309
|
+
async getAction(predicateOrTitle) {
|
|
310
|
+
const predicate = (typeof predicateOrTitle === 'string') ?
|
|
311
|
+
(async (action) => await action.getTitle() === predicateOrTitle) : (predicateOrTitle);
|
|
312
|
+
const actions = await this.getActions();
|
|
313
|
+
for (const action of actions) {
|
|
314
|
+
if (await predicate(action)) {
|
|
315
|
+
return action;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return undefined;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
exports.EditorGroup = EditorGroup;
|
|
322
|
+
/**
|
|
323
|
+
* Page object for editor view tab
|
|
324
|
+
*/
|
|
325
|
+
class EditorTab extends ElementWithContextMenu_1.ElementWithContexMenu {
|
|
326
|
+
constructor(element, view) {
|
|
327
|
+
super(element, view);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Get the tab title as string
|
|
331
|
+
*/
|
|
332
|
+
async getTitle() {
|
|
333
|
+
const label = await this.findElement(EditorTab.locators.Editor.title);
|
|
334
|
+
return await label.getText();
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Select (click) the tab
|
|
338
|
+
*/
|
|
339
|
+
async select() {
|
|
340
|
+
const tabCoords = await this.getRect();
|
|
341
|
+
await this.getDriver().actions().move({ x: Math.ceil(tabCoords.x + 10), y: Math.ceil(tabCoords.y + 10) }).click().perform();
|
|
342
|
+
}
|
|
343
|
+
async isSelected() {
|
|
344
|
+
const klass = await this.getAttribute('class');
|
|
345
|
+
const segments = klass?.split(/\s+/g) ?? [];
|
|
346
|
+
return await super.isSelected() || segments.includes('active');
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.EditorTab = EditorTab;
|
|
350
|
+
//# sourceMappingURL=EditorView.js.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Editor } from "./Editor";
|
|
2
|
+
import { ContextMenu } from "../menu/ContextMenu";
|
|
3
|
+
import { By } from "selenium-webdriver";
|
|
4
|
+
import { AbstractElement } from "../AbstractElement";
|
|
5
|
+
import { EditorView, EditorGroup } from "../..";
|
|
6
|
+
/**
|
|
7
|
+
* Page object representing the internal VSCode settings editor
|
|
8
|
+
*/
|
|
9
|
+
export declare class SettingsEditor extends Editor {
|
|
10
|
+
private divider;
|
|
11
|
+
constructor(view?: EditorView | EditorGroup);
|
|
12
|
+
/**
|
|
13
|
+
* Search for a setting with a particular title and category.
|
|
14
|
+
* Returns an appropriate Setting object if the label is found,
|
|
15
|
+
* undefined otherwise.
|
|
16
|
+
*
|
|
17
|
+
* If your setting has nested categories (i.e `example.general.test`),
|
|
18
|
+
* pass in each category as a separate string.
|
|
19
|
+
*
|
|
20
|
+
* @param title title of the setting
|
|
21
|
+
* @param categories category of the setting
|
|
22
|
+
* @returns Promise resolving to a Setting object if found, undefined otherwise
|
|
23
|
+
*/
|
|
24
|
+
findSetting(title: string, ...categories: string[]): Promise<Setting>;
|
|
25
|
+
/**
|
|
26
|
+
* Search for a setting with a precise ID.
|
|
27
|
+
* Returns an appropriate Setting object if it exists,
|
|
28
|
+
* undefined otherwise.
|
|
29
|
+
*
|
|
30
|
+
* @param id of the setting
|
|
31
|
+
* @returns Promise resolving to a Setting object if found, undefined otherwise
|
|
32
|
+
*/
|
|
33
|
+
findSettingByID(id: string): Promise<Setting>;
|
|
34
|
+
private _getSettingItem;
|
|
35
|
+
/**
|
|
36
|
+
* Switch between settings perspectives
|
|
37
|
+
* Works only if your vscode instance has both user and workspace settings available
|
|
38
|
+
*
|
|
39
|
+
* @param perspective User or Workspace
|
|
40
|
+
* @returns Promise that resolves when the appropriate button is clicked
|
|
41
|
+
*/
|
|
42
|
+
switchToPerspective(perspective: 'User' | 'Workspace'): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Context menu is disabled in this editor, throw an error
|
|
45
|
+
*/
|
|
46
|
+
openContextMenu(): Promise<ContextMenu>;
|
|
47
|
+
private createSetting;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Abstract item representing a Setting with title, description and
|
|
51
|
+
* an input element (combo/textbox/checkbox/link)
|
|
52
|
+
*/
|
|
53
|
+
export declare abstract class Setting extends AbstractElement {
|
|
54
|
+
constructor(settingsConstructor: By, settings: SettingsEditor);
|
|
55
|
+
/**
|
|
56
|
+
* Get the value of the setting based on its input type
|
|
57
|
+
*
|
|
58
|
+
* @returns promise that resolves to the current value of the setting
|
|
59
|
+
*/
|
|
60
|
+
abstract getValue(): Promise<string | boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Set the value of the setting based on its input type
|
|
63
|
+
*
|
|
64
|
+
* @param value boolean for checkboxes, string otherwise
|
|
65
|
+
*/
|
|
66
|
+
abstract setValue(value: string | boolean): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Get the category of the setting
|
|
69
|
+
* All settings are labeled as Category: Title
|
|
70
|
+
*/
|
|
71
|
+
getCategory(): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Get description of the setting
|
|
74
|
+
* @returns Promise resolving to setting description
|
|
75
|
+
*/
|
|
76
|
+
getDescription(): Promise<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Get title of the setting
|
|
79
|
+
*/
|
|
80
|
+
getTitle(): Promise<string>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Setting with a combo box
|
|
84
|
+
*/
|
|
85
|
+
export declare class ComboSetting extends Setting {
|
|
86
|
+
getValue(): Promise<string>;
|
|
87
|
+
setValue(value: string): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Get the labels of all options from the combo
|
|
90
|
+
* @returns Promise resolving to array of string values
|
|
91
|
+
*/
|
|
92
|
+
getValues(): Promise<string[]>;
|
|
93
|
+
private getOptions;
|
|
94
|
+
private openCombo;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Setting with a text box input
|
|
98
|
+
*/
|
|
99
|
+
export declare class TextSetting extends Setting {
|
|
100
|
+
getValue(): Promise<string>;
|
|
101
|
+
setValue(value: string): Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Setting with a checkbox
|
|
105
|
+
*/
|
|
106
|
+
export declare class CheckboxSetting extends Setting {
|
|
107
|
+
getValue(): Promise<boolean>;
|
|
108
|
+
setValue(value: boolean): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Setting with no value, with a link to settings.json instead
|
|
112
|
+
*/
|
|
113
|
+
export declare class LinkSetting extends Setting {
|
|
114
|
+
getValue(): Promise<string>;
|
|
115
|
+
setValue(value: string | boolean): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Open the link that leads to the value in settings.json
|
|
118
|
+
* @returns Promise resolving when the link has been clicked
|
|
119
|
+
*/
|
|
120
|
+
openLink(): Promise<void>;
|
|
121
|
+
}
|