@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,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalView = exports.DebugConsoleView = exports.OutputView = void 0;
|
|
4
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
5
|
+
const __1 = require("../..");
|
|
6
|
+
const AbstractViews_1 = require("./AbstractViews");
|
|
7
|
+
const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
|
|
8
|
+
/**
|
|
9
|
+
* Output view of the bottom panel
|
|
10
|
+
*/
|
|
11
|
+
class OutputView extends AbstractViews_1.TextView {
|
|
12
|
+
constructor(panel = new __1.BottomBarPanel()) {
|
|
13
|
+
super(OutputView.locators.OutputView.constructor, panel);
|
|
14
|
+
this.actionsLabel = OutputView.locators.OutputView.actionsLabel;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Select a channel using the selector combo
|
|
18
|
+
* @param name name of the channel to open
|
|
19
|
+
*/
|
|
20
|
+
async selectChannel(name) {
|
|
21
|
+
await super.selectChannel(name);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.OutputView = OutputView;
|
|
25
|
+
/**
|
|
26
|
+
* Debug Console view on the bottom panel
|
|
27
|
+
* Most functionality will only be available when a debug session is running
|
|
28
|
+
*/
|
|
29
|
+
class DebugConsoleView extends ElementWithContextMenu_1.ElementWithContexMenu {
|
|
30
|
+
constructor(panel = new __1.BottomBarPanel()) {
|
|
31
|
+
super(DebugConsoleView.locators.DebugConsoleView.constructor, panel);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clear the console of all text
|
|
35
|
+
*/
|
|
36
|
+
async clearText() {
|
|
37
|
+
const menu = await this.openContextMenu();
|
|
38
|
+
await menu.select('Clear Console');
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Type an expression into the debug console text area
|
|
42
|
+
* @param expression expression in form of a string
|
|
43
|
+
*/
|
|
44
|
+
async setExpression(expression) {
|
|
45
|
+
const textarea = await this.findElement(DebugConsoleView.locators.BottomBarViews.textArea);
|
|
46
|
+
await textarea.clear();
|
|
47
|
+
await textarea.sendKeys(expression);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Evaluate an expression:
|
|
51
|
+
* - if no argument is supplied, evaluate the current expression present in debug console text area
|
|
52
|
+
* - if a string argument is supplied, replace the current expression with the `expression` argument and evaluate
|
|
53
|
+
*
|
|
54
|
+
* @param expression expression to evaluate. To use existing contents of the debug console text area instead, don't define this argument
|
|
55
|
+
*/
|
|
56
|
+
async evaluateExpression(expression) {
|
|
57
|
+
const textarea = await this.findElement(DebugConsoleView.locators.BottomBarViews.textArea);
|
|
58
|
+
if (expression) {
|
|
59
|
+
await this.setExpression(expression);
|
|
60
|
+
}
|
|
61
|
+
await textarea.sendKeys(selenium_webdriver_1.Key.ENTER);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a content assist page object
|
|
65
|
+
* @returns promise resolving to ContentAssist object
|
|
66
|
+
*/
|
|
67
|
+
async getContentAssist() {
|
|
68
|
+
await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(__1.ContentAssist.locators.ContentAssist.constructor), 1000);
|
|
69
|
+
return new __1.ContentAssist(this).wait();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.DebugConsoleView = DebugConsoleView;
|
|
73
|
+
/**
|
|
74
|
+
* Terminal view on the bottom panel
|
|
75
|
+
*/
|
|
76
|
+
class TerminalView extends AbstractViews_1.ChannelView {
|
|
77
|
+
constructor(panel = new __1.BottomBarPanel()) {
|
|
78
|
+
super(TerminalView.locators.TerminalView.constructor, panel);
|
|
79
|
+
this.actionsLabel = TerminalView.locators.TerminalView.actionsLabel;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Execute command in the internal terminal and wait for results
|
|
83
|
+
* @param command text of the command
|
|
84
|
+
* @param timeout optional maximum time to wait for completion in milliseconds, 0 for unlimited
|
|
85
|
+
* @returns Promise resolving when the command is finished
|
|
86
|
+
*/
|
|
87
|
+
async executeCommand(command, timeout = 0) {
|
|
88
|
+
const input = await this.findElement(TerminalView.locators.TerminalView.textArea);
|
|
89
|
+
try {
|
|
90
|
+
await input.clear();
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
// try clearing, ignore if not available
|
|
94
|
+
}
|
|
95
|
+
await input.sendKeys(command, selenium_webdriver_1.Key.ENTER);
|
|
96
|
+
let timer = 0;
|
|
97
|
+
let style = await input.getCssValue('left');
|
|
98
|
+
do {
|
|
99
|
+
if (timeout > 0 && timer > timeout) {
|
|
100
|
+
throw new Error(`Timeout of ${timeout}ms exceeded`);
|
|
101
|
+
}
|
|
102
|
+
await new Promise(res => setTimeout(res, 500));
|
|
103
|
+
timer += 500;
|
|
104
|
+
style = await input.getCssValue('left');
|
|
105
|
+
} while (style === '0px');
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Get all text from the internal terminal
|
|
109
|
+
* Beware, no formatting.
|
|
110
|
+
*
|
|
111
|
+
* @returns Promise resolving to all terminal text
|
|
112
|
+
*/
|
|
113
|
+
async getText() {
|
|
114
|
+
const clipboard = (await import('clipboardy')).default;
|
|
115
|
+
let originalClipboard = '';
|
|
116
|
+
try {
|
|
117
|
+
originalClipboard = clipboard.readSync();
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
// workaround issue https://github.com/redhat-developer/vscode-extension-tester/issues/835
|
|
121
|
+
// do not fail if clipboard is empty
|
|
122
|
+
}
|
|
123
|
+
const workbench = new __1.Workbench();
|
|
124
|
+
await workbench.executeCommand('terminal select all');
|
|
125
|
+
await workbench.getDriver().sleep(500);
|
|
126
|
+
const text = clipboard.readSync();
|
|
127
|
+
if (originalClipboard.length > 0) {
|
|
128
|
+
clipboard.writeSync(originalClipboard);
|
|
129
|
+
}
|
|
130
|
+
return text;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Destroy the currently open terminal
|
|
134
|
+
* @returns Promise resolving when Kill Terminal button is pressed
|
|
135
|
+
*/
|
|
136
|
+
async killTerminal() {
|
|
137
|
+
await new __1.Workbench().executeCommand('terminal: kill the active terminal instance');
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Initiate new terminal creation
|
|
141
|
+
* @returns Promise resolving when New Terminal button is pressed
|
|
142
|
+
*/
|
|
143
|
+
async newTerminal() {
|
|
144
|
+
await new __1.Workbench().executeCommand(TerminalView.locators.TerminalView.newCommand);
|
|
145
|
+
const combo = await this.enclosingItem.findElements(AbstractViews_1.ChannelView.locators.BottomBarViews.channelCombo);
|
|
146
|
+
if (combo.length < 1) {
|
|
147
|
+
await this.getDriver().wait(async () => {
|
|
148
|
+
const list = await this.findElements(TerminalView.locators.TerminalView.tabList);
|
|
149
|
+
return list.length > 0;
|
|
150
|
+
}, 5000);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
async getCurrentChannel() {
|
|
154
|
+
const combo = await this.enclosingItem.findElements(AbstractViews_1.ChannelView.locators.BottomBarViews.channelCombo);
|
|
155
|
+
if (combo.length > 0) {
|
|
156
|
+
return await super.getCurrentChannel();
|
|
157
|
+
}
|
|
158
|
+
const singleTerm = await this.enclosingItem.findElements(TerminalView.locators.TerminalView.singleTab);
|
|
159
|
+
if (singleTerm.length > 0) {
|
|
160
|
+
return await singleTerm[0].getText();
|
|
161
|
+
}
|
|
162
|
+
const list = await this.findElement(TerminalView.locators.TerminalView.tabList);
|
|
163
|
+
const row = await list.findElement(TerminalView.locators.TerminalView.selectedRow);
|
|
164
|
+
await this.getDriver().sleep(1000);
|
|
165
|
+
const label = (await row.getAttribute('aria-label')).split(' ');
|
|
166
|
+
return `${label[1]}: ${label[2]}`;
|
|
167
|
+
}
|
|
168
|
+
async selectChannel(name) {
|
|
169
|
+
const combo = await this.enclosingItem.findElements(AbstractViews_1.ChannelView.locators.BottomBarViews.channelCombo);
|
|
170
|
+
if (combo.length > 0) {
|
|
171
|
+
return await super.selectChannel(name);
|
|
172
|
+
}
|
|
173
|
+
const singleTerm = await this.enclosingItem.findElements(TerminalView.locators.TerminalView.singleTab);
|
|
174
|
+
if (singleTerm.length > 0) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const matches = /.*(\d+).?\s.*/.exec(name);
|
|
178
|
+
if (matches === null || !matches[1]) {
|
|
179
|
+
throw new Error(`Channel ${name} not found`);
|
|
180
|
+
}
|
|
181
|
+
const channelNumber = matches[1];
|
|
182
|
+
const list = await this.findElement(TerminalView.locators.TerminalView.tabList);
|
|
183
|
+
const rows = await list.findElements(TerminalView.locators.TerminalView.row);
|
|
184
|
+
for (const row of rows) {
|
|
185
|
+
const label = await row.getAttribute('aria-label');
|
|
186
|
+
if (label.includes(channelNumber)) {
|
|
187
|
+
await row.click();
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
throw new Error(`Channel ${name} not found`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
exports.TerminalView = TerminalView;
|
|
195
|
+
//# sourceMappingURL=Views.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WebElement } from "selenium-webdriver";
|
|
2
|
+
import { AbstractElement } from "../AbstractElement";
|
|
3
|
+
/**
|
|
4
|
+
* Page object representing a user-contributed panel implemented using a Webview.
|
|
5
|
+
*/
|
|
6
|
+
declare class WebviewViewBase extends AbstractElement {
|
|
7
|
+
constructor();
|
|
8
|
+
getViewToSwitchTo(handle: string): Promise<WebElement | undefined>;
|
|
9
|
+
}
|
|
10
|
+
export declare const WebviewView: new (...args: any[]) => WebviewViewBase & import("../WebviewMixin").WebviewMixinType;
|
|
11
|
+
export type WebviewView = InstanceType<typeof WebviewView>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebviewView = void 0;
|
|
7
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
8
|
+
const WebviewMixin_1 = __importDefault(require("../WebviewMixin"));
|
|
9
|
+
/**
|
|
10
|
+
* Page object representing a user-contributed panel implemented using a Webview.
|
|
11
|
+
*/
|
|
12
|
+
class WebviewViewBase extends AbstractElement_1.AbstractElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(WebviewViewBase.locators.Workbench.constructor);
|
|
15
|
+
}
|
|
16
|
+
async getViewToSwitchTo(handle) {
|
|
17
|
+
return await this.getDriver().findElement(WebviewViewBase.locators.WebviewView.iframe);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.WebviewView = (0, WebviewMixin_1.default)(WebviewViewBase);
|
|
21
|
+
//# sourceMappingURL=WebviewView.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WebElement } from "selenium-webdriver";
|
|
2
|
+
import { AbstractElement } from "../AbstractElement";
|
|
3
|
+
/**
|
|
4
|
+
* Page Object for Custom Style Modal Dialogs (non-native)
|
|
5
|
+
*/
|
|
6
|
+
export declare class ModalDialog extends AbstractElement {
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Get the dialog's message in a Promise
|
|
10
|
+
*/
|
|
11
|
+
getMessage(): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Get the details message in a Promise
|
|
14
|
+
*/
|
|
15
|
+
getDetails(): Promise<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the list of buttons as WebElements
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise resolving to Array of WebElement items representing the buttons
|
|
20
|
+
*/
|
|
21
|
+
getButtons(): Promise<WebElement[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Push a button with given title if it exists
|
|
24
|
+
*
|
|
25
|
+
* @param title title/text of the button
|
|
26
|
+
*/
|
|
27
|
+
pushButton(title: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Close the dialog using the 'cross' button
|
|
30
|
+
*/
|
|
31
|
+
close(): Promise<void>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModalDialog = void 0;
|
|
4
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
5
|
+
/**
|
|
6
|
+
* Page Object for Custom Style Modal Dialogs (non-native)
|
|
7
|
+
*/
|
|
8
|
+
class ModalDialog extends AbstractElement_1.AbstractElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super(ModalDialog.locators.Dialog.constructor);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the dialog's message in a Promise
|
|
14
|
+
*/
|
|
15
|
+
async getMessage() {
|
|
16
|
+
const message = await this.findElement(ModalDialog.locators.Dialog.message);
|
|
17
|
+
return await message.getText();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the details message in a Promise
|
|
21
|
+
*/
|
|
22
|
+
async getDetails() {
|
|
23
|
+
const details = await this.findElement(ModalDialog.locators.Dialog.details);
|
|
24
|
+
return await details.getText();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the list of buttons as WebElements
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise resolving to Array of WebElement items representing the buttons
|
|
30
|
+
*/
|
|
31
|
+
async getButtons() {
|
|
32
|
+
return await this.findElement(ModalDialog.locators.Dialog.buttonContainer).findElements(ModalDialog.locators.Dialog.button);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Push a button with given title if it exists
|
|
36
|
+
*
|
|
37
|
+
* @param title title/text of the button
|
|
38
|
+
*/
|
|
39
|
+
async pushButton(title) {
|
|
40
|
+
const buttons = await this.getButtons();
|
|
41
|
+
const titles = await Promise.all(buttons.map(async (btn) => ModalDialog.locators.Dialog.buttonLabel.value(btn)));
|
|
42
|
+
const index = titles.findIndex(value => value === title);
|
|
43
|
+
if (index > -1) {
|
|
44
|
+
await buttons[index].click();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Close the dialog using the 'cross' button
|
|
49
|
+
*/
|
|
50
|
+
async close() {
|
|
51
|
+
const btn = await this.findElement(ModalDialog.locators.Dialog.closeButton);
|
|
52
|
+
return await btn.click();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.ModalDialog = ModalDialog;
|
|
56
|
+
//# sourceMappingURL=ModalDialog.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebElement } from 'selenium-webdriver';
|
|
2
|
+
import { AbstractElement } from '../AbstractElement';
|
|
3
|
+
export declare class Breakpoint extends AbstractElement {
|
|
4
|
+
private lineElement;
|
|
5
|
+
constructor(breakpoint: WebElement, lineElement: WebElement);
|
|
6
|
+
isEnabled(): Promise<boolean>;
|
|
7
|
+
isPaused(): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Return line number of the breakpoint.
|
|
10
|
+
* @returns number indicating line where breakpoint is set
|
|
11
|
+
*/
|
|
12
|
+
getLineNumber(): Promise<number>;
|
|
13
|
+
/**
|
|
14
|
+
* Remove breakpoint.
|
|
15
|
+
* @param timeout time in ms when operation is considered to be unsuccessful
|
|
16
|
+
*/
|
|
17
|
+
remove(timeout?: number): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Breakpoint = void 0;
|
|
4
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
5
|
+
const AbstractElement_1 = require("../AbstractElement");
|
|
6
|
+
class Breakpoint extends AbstractElement_1.AbstractElement {
|
|
7
|
+
lineElement;
|
|
8
|
+
constructor(breakpoint, lineElement) {
|
|
9
|
+
super(breakpoint, lineElement);
|
|
10
|
+
this.lineElement = lineElement;
|
|
11
|
+
}
|
|
12
|
+
async isEnabled() {
|
|
13
|
+
return await Breakpoint.locators.TextEditor.breakpoint.properties.enabled(this);
|
|
14
|
+
}
|
|
15
|
+
async isPaused() {
|
|
16
|
+
return await Breakpoint.locators.TextEditor.breakpoint.properties.paused(this);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Return line number of the breakpoint.
|
|
20
|
+
* @returns number indicating line where breakpoint is set
|
|
21
|
+
*/
|
|
22
|
+
async getLineNumber() {
|
|
23
|
+
const breakpointLocators = Breakpoint.locators.TextEditor.breakpoint;
|
|
24
|
+
const line = await this.lineElement.findElement(breakpointLocators.properties.line.selector);
|
|
25
|
+
const lineNumber = await breakpointLocators.properties.line.number(line);
|
|
26
|
+
return lineNumber;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Remove breakpoint.
|
|
30
|
+
* @param timeout time in ms when operation is considered to be unsuccessful
|
|
31
|
+
*/
|
|
32
|
+
async remove(timeout = 5000) {
|
|
33
|
+
await this.click();
|
|
34
|
+
await this.getDriver().wait(selenium_webdriver_1.until.stalenessOf(this), timeout);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Breakpoint = Breakpoint;
|
|
38
|
+
//# sourceMappingURL=Breakpoint.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TextEditor, Menu, MenuItem, DebugConsoleView } from "../..";
|
|
2
|
+
import { WebElement } from 'selenium-webdriver';
|
|
3
|
+
/**
|
|
4
|
+
* Page object representing the content assistant
|
|
5
|
+
*/
|
|
6
|
+
export declare class ContentAssist extends Menu {
|
|
7
|
+
constructor(parent: TextEditor | DebugConsoleView);
|
|
8
|
+
/**
|
|
9
|
+
* Get content assist item by name/text, scroll through the list
|
|
10
|
+
* until the item is found, or the end is reached
|
|
11
|
+
*
|
|
12
|
+
* @param name name/text to search by
|
|
13
|
+
* @returns Promise resolving to ContentAssistItem object if found, undefined otherwise
|
|
14
|
+
*/
|
|
15
|
+
getItem(name: string): Promise<ContentAssistItem | undefined>;
|
|
16
|
+
/**
|
|
17
|
+
* Get all visible content assist items
|
|
18
|
+
* @returns Promise resolving to array of ContentAssistItem objects
|
|
19
|
+
*/
|
|
20
|
+
getItems(): Promise<ContentAssistItem[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Find if the content assist is still loading the suggestions
|
|
23
|
+
* @returns promise that resolves to true when suggestions are done loading,
|
|
24
|
+
* to false otherwise
|
|
25
|
+
*/
|
|
26
|
+
isLoaded(): Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Page object for a content assist item
|
|
30
|
+
*/
|
|
31
|
+
export declare class ContentAssistItem extends MenuItem {
|
|
32
|
+
constructor(item: WebElement, contentAssist: ContentAssist);
|
|
33
|
+
getLabel(): Promise<string>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContentAssistItem = exports.ContentAssist = void 0;
|
|
4
|
+
const __1 = require("../..");
|
|
5
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
6
|
+
/**
|
|
7
|
+
* Page object representing the content assistant
|
|
8
|
+
*/
|
|
9
|
+
class ContentAssist extends __1.Menu {
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
super(ContentAssist.locators.ContentAssist.constructor, parent);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get content assist item by name/text, scroll through the list
|
|
15
|
+
* until the item is found, or the end is reached
|
|
16
|
+
*
|
|
17
|
+
* @param name name/text to search by
|
|
18
|
+
* @returns Promise resolving to ContentAssistItem object if found, undefined otherwise
|
|
19
|
+
*/
|
|
20
|
+
async getItem(name) {
|
|
21
|
+
let lastItem = false;
|
|
22
|
+
const scrollable = await this.findElement(ContentAssist.locators.ContentAssist.itemList);
|
|
23
|
+
let firstItem = await this.findElements(ContentAssist.locators.ContentAssist.firstItem);
|
|
24
|
+
while (firstItem.length < 1) {
|
|
25
|
+
await scrollable.sendKeys(selenium_webdriver_1.Key.PAGE_UP, selenium_webdriver_1.Key.NULL);
|
|
26
|
+
firstItem = await this.findElements(ContentAssist.locators.ContentAssist.firstItem);
|
|
27
|
+
}
|
|
28
|
+
while (!lastItem) {
|
|
29
|
+
const items = await this.getItems();
|
|
30
|
+
for (const item of items) {
|
|
31
|
+
if (await item.getLabel() === name) {
|
|
32
|
+
return item;
|
|
33
|
+
}
|
|
34
|
+
lastItem = lastItem || (await item.getAttribute('data-last-element')) === 'true';
|
|
35
|
+
}
|
|
36
|
+
if (!lastItem) {
|
|
37
|
+
await scrollable.sendKeys(selenium_webdriver_1.Key.PAGE_DOWN);
|
|
38
|
+
await new Promise(res => setTimeout(res, 100));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get all visible content assist items
|
|
44
|
+
* @returns Promise resolving to array of ContentAssistItem objects
|
|
45
|
+
*/
|
|
46
|
+
async getItems() {
|
|
47
|
+
await this.getDriver().wait(async () => { return await this.isLoaded(); });
|
|
48
|
+
const elements = await this.findElement(ContentAssist.locators.ContentAssist.itemRows)
|
|
49
|
+
.findElements(ContentAssist.locators.ContentAssist.itemRow);
|
|
50
|
+
const items = [];
|
|
51
|
+
for (const item of elements) {
|
|
52
|
+
try {
|
|
53
|
+
items.push(await new ContentAssistItem(item, this).wait());
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
if (!(err instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return items;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Find if the content assist is still loading the suggestions
|
|
65
|
+
* @returns promise that resolves to true when suggestions are done loading,
|
|
66
|
+
* to false otherwise
|
|
67
|
+
*/
|
|
68
|
+
async isLoaded() {
|
|
69
|
+
const message = await this.findElement(ContentAssist.locators.ContentAssist.message);
|
|
70
|
+
if (await message.isDisplayed()) {
|
|
71
|
+
if ((await message.getText()).startsWith('No suggestions')) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.ContentAssist = ContentAssist;
|
|
80
|
+
/**
|
|
81
|
+
* Page object for a content assist item
|
|
82
|
+
*/
|
|
83
|
+
class ContentAssistItem extends __1.MenuItem {
|
|
84
|
+
constructor(item, contentAssist) {
|
|
85
|
+
super(item, contentAssist);
|
|
86
|
+
this.parent = contentAssist;
|
|
87
|
+
}
|
|
88
|
+
async getLabel() {
|
|
89
|
+
const labelDiv = await this.findElement(ContentAssist.locators.ContentAssist.itemLabel);
|
|
90
|
+
return await labelDiv.getText();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.ContentAssistItem = ContentAssistItem;
|
|
94
|
+
//# sourceMappingURL=ContentAssist.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Editor, InputBox, WebView } from "../..";
|
|
2
|
+
/**
|
|
3
|
+
* Page object for custom editors
|
|
4
|
+
*/
|
|
5
|
+
export declare class CustomEditor extends Editor {
|
|
6
|
+
/**
|
|
7
|
+
* Get the WebView object contained in the editor
|
|
8
|
+
* @returns WebView page object
|
|
9
|
+
*/
|
|
10
|
+
getWebView(): WebView;
|
|
11
|
+
/**
|
|
12
|
+
* Check if the editor has unsaved changes
|
|
13
|
+
* @returns Promise resolving to true if there are unsaved changes, false otherwise
|
|
14
|
+
*/
|
|
15
|
+
isDirty(): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Save the editor
|
|
18
|
+
*/
|
|
19
|
+
save(): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Open the Save as prompt
|
|
22
|
+
*
|
|
23
|
+
* @returns InputBox serving as a simple file dialog
|
|
24
|
+
*/
|
|
25
|
+
saveAs(): Promise<InputBox>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomEditor = void 0;
|
|
4
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
5
|
+
const __1 = require("../..");
|
|
6
|
+
/**
|
|
7
|
+
* Page object for custom editors
|
|
8
|
+
*/
|
|
9
|
+
class CustomEditor extends __1.Editor {
|
|
10
|
+
/**
|
|
11
|
+
* Get the WebView object contained in the editor
|
|
12
|
+
* @returns WebView page object
|
|
13
|
+
*/
|
|
14
|
+
getWebView() {
|
|
15
|
+
return new __1.WebView();
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if the editor has unsaved changes
|
|
19
|
+
* @returns Promise resolving to true if there are unsaved changes, false otherwise
|
|
20
|
+
*/
|
|
21
|
+
async isDirty() {
|
|
22
|
+
const tab = await this.getTab();
|
|
23
|
+
const klass = await tab.getAttribute('class');
|
|
24
|
+
return klass.includes('dirty');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Save the editor
|
|
28
|
+
*/
|
|
29
|
+
async save() {
|
|
30
|
+
const tab = await this.getTab();
|
|
31
|
+
await tab.sendKeys(selenium_webdriver_1.Key.chord(CustomEditor.ctlKey, 's'));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Open the Save as prompt
|
|
35
|
+
*
|
|
36
|
+
* @returns InputBox serving as a simple file dialog
|
|
37
|
+
*/
|
|
38
|
+
async saveAs() {
|
|
39
|
+
const tab = await this.getTab();
|
|
40
|
+
await tab.sendKeys(selenium_webdriver_1.Key.chord(CustomEditor.ctlKey, selenium_webdriver_1.Key.SHIFT, 's'));
|
|
41
|
+
return await __1.InputBox.create();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.CustomEditor = CustomEditor;
|
|
45
|
+
//# sourceMappingURL=CustomEditor.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Editor } from './Editor';
|
|
2
|
+
import { TextEditor } from './TextEditor';
|
|
3
|
+
/**
|
|
4
|
+
* Page object representing a diff editor
|
|
5
|
+
*/
|
|
6
|
+
export declare class DiffEditor extends Editor {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the text editor corresponding to the originalside.
|
|
9
|
+
* (The left side of the diff editor)
|
|
10
|
+
* @returns Promise resolving to TextEditor object
|
|
11
|
+
*/
|
|
12
|
+
getOriginalEditor(): Promise<TextEditor>;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the text editor corresponding to the modified side.
|
|
15
|
+
* (The right side of the diff editor)
|
|
16
|
+
* @returns Promise resolving to TextEditor object
|
|
17
|
+
*/
|
|
18
|
+
getModifiedEditor(): Promise<TextEditor>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DiffEditor = void 0;
|
|
4
|
+
const Editor_1 = require("./Editor");
|
|
5
|
+
const TextEditor_1 = require("./TextEditor");
|
|
6
|
+
const EditorView_1 = require("./EditorView");
|
|
7
|
+
/**
|
|
8
|
+
* Page object representing a diff editor
|
|
9
|
+
*/
|
|
10
|
+
class DiffEditor extends Editor_1.Editor {
|
|
11
|
+
/**
|
|
12
|
+
* Gets the text editor corresponding to the originalside.
|
|
13
|
+
* (The left side of the diff editor)
|
|
14
|
+
* @returns Promise resolving to TextEditor object
|
|
15
|
+
*/
|
|
16
|
+
async getOriginalEditor() {
|
|
17
|
+
const element = await this.getEnclosingElement().findElement(DiffEditor.locators.DiffEditor.originalEditor);
|
|
18
|
+
return new TextEditor_1.TextEditor(new EditorView_1.EditorView(), element);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the text editor corresponding to the modified side.
|
|
22
|
+
* (The right side of the diff editor)
|
|
23
|
+
* @returns Promise resolving to TextEditor object
|
|
24
|
+
*/
|
|
25
|
+
async getModifiedEditor() {
|
|
26
|
+
const element = await this.getEnclosingElement().findElement(DiffEditor.locators.DiffEditor.modifiedEditor);
|
|
27
|
+
return new TextEditor_1.TextEditor(new EditorView_1.EditorView(), element);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.DiffEditor = DiffEditor;
|
|
31
|
+
//# sourceMappingURL=DiffEditor.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ElementWithContexMenu } from "../ElementWithContextMenu";
|
|
2
|
+
import { EditorTab, EditorView, EditorGroup } from "../..";
|
|
3
|
+
import { WebElement, Locator } from 'selenium-webdriver';
|
|
4
|
+
/**
|
|
5
|
+
* Abstract representation of an editor tab
|
|
6
|
+
*/
|
|
7
|
+
export declare abstract class Editor extends ElementWithContexMenu {
|
|
8
|
+
constructor(view?: EditorView | EditorGroup, base?: Locator | WebElement);
|
|
9
|
+
/**
|
|
10
|
+
* Get title/name of the open editor
|
|
11
|
+
*/
|
|
12
|
+
getTitle(): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the corresponding editor tab
|
|
15
|
+
*/
|
|
16
|
+
getTab(): Promise<EditorTab>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Editor = void 0;
|
|
4
|
+
const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
|
|
5
|
+
const __1 = require("../..");
|
|
6
|
+
/**
|
|
7
|
+
* Abstract representation of an editor tab
|
|
8
|
+
*/
|
|
9
|
+
class Editor extends ElementWithContextMenu_1.ElementWithContexMenu {
|
|
10
|
+
constructor(view = new __1.EditorView(), base = Editor.locators.Editor.constructor) {
|
|
11
|
+
super(base, view);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get title/name of the open editor
|
|
15
|
+
*/
|
|
16
|
+
async getTitle() {
|
|
17
|
+
const tab = await this.getTab();
|
|
18
|
+
return await tab.getTitle();
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the corresponding editor tab
|
|
22
|
+
*/
|
|
23
|
+
async getTab() {
|
|
24
|
+
const element = this.enclosingItem;
|
|
25
|
+
return await element.getActiveTab();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Editor = Editor;
|
|
29
|
+
//# sourceMappingURL=Editor.js.map
|