@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.
Files changed (127) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +5 -0
  3. package/out/components/AbstractElement.d.ts +35 -0
  4. package/out/components/AbstractElement.js +69 -0
  5. package/out/components/ElementWithContextMenu.d.ts +11 -0
  6. package/out/components/ElementWithContextMenu.js +38 -0
  7. package/out/components/WebviewMixin.d.ts +29 -0
  8. package/out/components/WebviewMixin.js +70 -0
  9. package/out/components/activityBar/ActionsControl.d.ts +18 -0
  10. package/out/components/activityBar/ActionsControl.js +27 -0
  11. package/out/components/activityBar/ActivityBar.d.ts +30 -0
  12. package/out/components/activityBar/ActivityBar.js +71 -0
  13. package/out/components/activityBar/ViewControl.d.ts +23 -0
  14. package/out/components/activityBar/ViewControl.js +56 -0
  15. package/out/components/bottomBar/AbstractViews.d.ts +38 -0
  16. package/out/components/bottomBar/AbstractViews.js +88 -0
  17. package/out/components/bottomBar/BottomBarPanel.d.ts +47 -0
  18. package/out/components/bottomBar/BottomBarPanel.js +123 -0
  19. package/out/components/bottomBar/ProblemsView.d.ts +88 -0
  20. package/out/components/bottomBar/ProblemsView.js +149 -0
  21. package/out/components/bottomBar/Views.d.ts +75 -0
  22. package/out/components/bottomBar/Views.js +195 -0
  23. package/out/components/bottomBar/WebviewView.d.ts +12 -0
  24. package/out/components/bottomBar/WebviewView.js +21 -0
  25. package/out/components/dialog/ModalDialog.d.ts +32 -0
  26. package/out/components/dialog/ModalDialog.js +56 -0
  27. package/out/components/editor/Breakpoint.d.ts +18 -0
  28. package/out/components/editor/Breakpoint.js +38 -0
  29. package/out/components/editor/ContentAssist.d.ts +34 -0
  30. package/out/components/editor/ContentAssist.js +94 -0
  31. package/out/components/editor/CustomEditor.d.ts +26 -0
  32. package/out/components/editor/CustomEditor.js +45 -0
  33. package/out/components/editor/DiffEditor.d.ts +19 -0
  34. package/out/components/editor/DiffEditor.js +31 -0
  35. package/out/components/editor/Editor.d.ts +17 -0
  36. package/out/components/editor/Editor.js +29 -0
  37. package/out/components/editor/EditorAction.d.ts +10 -0
  38. package/out/components/editor/EditorAction.js +17 -0
  39. package/out/components/editor/EditorView.d.ts +153 -0
  40. package/out/components/editor/EditorView.js +350 -0
  41. package/out/components/editor/SettingsEditor.d.ts +121 -0
  42. package/out/components/editor/SettingsEditor.js +278 -0
  43. package/out/components/editor/TextEditor.d.ts +265 -0
  44. package/out/components/editor/TextEditor.js +707 -0
  45. package/out/components/editor/WebView.d.ts +11 -0
  46. package/out/components/editor/WebView.js +38 -0
  47. package/out/components/menu/ContextMenu.d.ts +37 -0
  48. package/out/components/menu/ContextMenu.js +123 -0
  49. package/out/components/menu/MacTitleBar.d.ts +16 -0
  50. package/out/components/menu/MacTitleBar.js +41 -0
  51. package/out/components/menu/Menu.d.ts +38 -0
  52. package/out/components/menu/Menu.js +53 -0
  53. package/out/components/menu/MenuItem.d.ts +24 -0
  54. package/out/components/menu/MenuItem.js +36 -0
  55. package/out/components/menu/TitleBar.d.ts +36 -0
  56. package/out/components/menu/TitleBar.js +78 -0
  57. package/out/components/menu/WindowControls.d.ts +28 -0
  58. package/out/components/menu/WindowControls.js +59 -0
  59. package/out/components/sidebar/SideBarView.d.ts +18 -0
  60. package/out/components/sidebar/SideBarView.js +29 -0
  61. package/out/components/sidebar/ViewContent.d.ts +57 -0
  62. package/out/components/sidebar/ViewContent.js +76 -0
  63. package/out/components/sidebar/ViewItem.d.ts +97 -0
  64. package/out/components/sidebar/ViewItem.js +192 -0
  65. package/out/components/sidebar/ViewSection.d.ts +98 -0
  66. package/out/components/sidebar/ViewSection.js +164 -0
  67. package/out/components/sidebar/ViewTitlePart.d.ts +35 -0
  68. package/out/components/sidebar/ViewTitlePart.js +59 -0
  69. package/out/components/sidebar/WelcomeContent.d.ts +47 -0
  70. package/out/components/sidebar/WelcomeContent.js +72 -0
  71. package/out/components/sidebar/debug/DebugView.d.ts +33 -0
  72. package/out/components/sidebar/debug/DebugView.js +70 -0
  73. package/out/components/sidebar/extensions/ExtensionsViewItem.d.ts +48 -0
  74. package/out/components/sidebar/extensions/ExtensionsViewItem.js +93 -0
  75. package/out/components/sidebar/extensions/ExtensionsViewSection.d.ts +33 -0
  76. package/out/components/sidebar/extensions/ExtensionsViewSection.js +117 -0
  77. package/out/components/sidebar/scm/NewScmView.d.ts +34 -0
  78. package/out/components/sidebar/scm/NewScmView.js +155 -0
  79. package/out/components/sidebar/scm/ScmView.d.ts +110 -0
  80. package/out/components/sidebar/scm/ScmView.js +275 -0
  81. package/out/components/sidebar/tree/TreeSection.d.ts +14 -0
  82. package/out/components/sidebar/tree/TreeSection.js +55 -0
  83. package/out/components/sidebar/tree/custom/CustomTreeItem.d.ts +15 -0
  84. package/out/components/sidebar/tree/custom/CustomTreeItem.js +36 -0
  85. package/out/components/sidebar/tree/custom/CustomTreeSection.d.ts +26 -0
  86. package/out/components/sidebar/tree/custom/CustomTreeSection.js +66 -0
  87. package/out/components/sidebar/tree/debug/BreakpointSectionItem.d.ts +33 -0
  88. package/out/components/sidebar/tree/debug/BreakpointSectionItem.js +63 -0
  89. package/out/components/sidebar/tree/debug/DebugBreakpointSection.d.ts +7 -0
  90. package/out/components/sidebar/tree/debug/DebugBreakpointSection.js +12 -0
  91. package/out/components/sidebar/tree/debug/DebugVariablesSection.d.ts +7 -0
  92. package/out/components/sidebar/tree/debug/DebugVariablesSection.js +12 -0
  93. package/out/components/sidebar/tree/debug/SectionBreakpoint.d.ts +3 -0
  94. package/out/components/sidebar/tree/debug/SectionBreakpoint.js +8 -0
  95. package/out/components/sidebar/tree/debug/VariableSectionItem.d.ts +33 -0
  96. package/out/components/sidebar/tree/debug/VariableSectionItem.js +60 -0
  97. package/out/components/sidebar/tree/default/DefaultTreeItem.d.ts +14 -0
  98. package/out/components/sidebar/tree/default/DefaultTreeItem.js +39 -0
  99. package/out/components/sidebar/tree/default/DefaultTreeSection.d.ts +9 -0
  100. package/out/components/sidebar/tree/default/DefaultTreeSection.js +44 -0
  101. package/out/components/statusBar/StatusBar.d.ts +96 -0
  102. package/out/components/statusBar/StatusBar.js +159 -0
  103. package/out/components/workbench/DebugToolbar.d.ts +52 -0
  104. package/out/components/workbench/DebugToolbar.js +93 -0
  105. package/out/components/workbench/Notification.d.ts +78 -0
  106. package/out/components/workbench/Notification.js +134 -0
  107. package/out/components/workbench/NotificationsCenter.d.ts +27 -0
  108. package/out/components/workbench/NotificationsCenter.js +57 -0
  109. package/out/components/workbench/Workbench.d.ts +69 -0
  110. package/out/components/workbench/Workbench.js +135 -0
  111. package/out/components/workbench/input/Input.d.ts +107 -0
  112. package/out/components/workbench/input/Input.js +249 -0
  113. package/out/components/workbench/input/InputBox.d.ts +30 -0
  114. package/out/components/workbench/input/InputBox.js +75 -0
  115. package/out/components/workbench/input/QuickOpenBox.d.ts +15 -0
  116. package/out/components/workbench/input/QuickOpenBox.js +41 -0
  117. package/out/conditions/WaitForAttribute.d.ts +8 -0
  118. package/out/conditions/WaitForAttribute.js +17 -0
  119. package/out/errors/NullAttributeError.d.ts +3 -0
  120. package/out/errors/NullAttributeError.js +11 -0
  121. package/out/index.d.ts +67 -0
  122. package/out/index.js +95 -0
  123. package/out/locators/loader.d.ts +20 -0
  124. package/out/locators/loader.js +108 -0
  125. package/out/locators/locators.d.ts +463 -0
  126. package/out/locators/locators.js +52 -0
  127. package/package.json +48 -0
@@ -0,0 +1,11 @@
1
+ import { WebElement } from "selenium-webdriver";
2
+ import { Editor } from "./Editor";
3
+ /**
4
+ * Page object representing an open editor containing a web view
5
+ */
6
+ declare class WebViewBase extends Editor {
7
+ getViewToSwitchTo(handle: string): Promise<WebElement | undefined>;
8
+ }
9
+ export declare const WebView: new (...args: any[]) => WebViewBase & import("../WebviewMixin").WebviewMixinType;
10
+ export type WebView = InstanceType<typeof WebView>;
11
+ export {};
@@ -0,0 +1,38 @@
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.WebView = void 0;
7
+ const selenium_webdriver_1 = require("selenium-webdriver");
8
+ const WebviewMixin_1 = __importDefault(require("../WebviewMixin"));
9
+ const Editor_1 = require("./Editor");
10
+ /**
11
+ * Page object representing an open editor containing a web view
12
+ */
13
+ class WebViewBase extends Editor_1.Editor {
14
+ async getViewToSwitchTo(handle) {
15
+ const handles = await this.getDriver().getAllWindowHandles();
16
+ for (const handle of handles) {
17
+ await this.getDriver().switchTo().window(handle);
18
+ if ((await this.getDriver().getTitle()).includes('Virtual Document')) {
19
+ await this.getDriver().switchTo().frame(0);
20
+ return;
21
+ }
22
+ }
23
+ await this.getDriver().switchTo().window(handle);
24
+ const reference = await this.findElement(WebViewBase.locators.EditorView.webView);
25
+ const containers = await this.getDriver().wait(selenium_webdriver_1.until.elementsLocated(WebViewBase.locators.WebView.container(await reference.getAttribute(WebViewBase.locators.WebView.attribute))), 5000);
26
+ return await containers[0].getDriver().wait(async () => {
27
+ for (let container of containers) {
28
+ const tries = await container.findElements(WebViewBase.locators.WebView.iframe);
29
+ if (tries.length > 0) {
30
+ return tries[0];
31
+ }
32
+ }
33
+ return undefined;
34
+ }, 5000);
35
+ }
36
+ }
37
+ exports.WebView = (0, WebviewMixin_1.default)(WebViewBase);
38
+ //# sourceMappingURL=WebView.js.map
@@ -0,0 +1,37 @@
1
+ import { Menu, MenuItem } from "../..";
2
+ import { WebElement } from "selenium-webdriver";
3
+ /**
4
+ * Object representing a context menu
5
+ */
6
+ export declare class ContextMenu extends Menu {
7
+ constructor(containingElement: WebElement);
8
+ /**
9
+ * Get context menu item by name
10
+ * @param name name of the item to search by
11
+ * @returns Promise resolving to ContextMenuItem object
12
+ */
13
+ getItem(name: string): Promise<ContextMenuItem | undefined>;
14
+ /**
15
+ * Get all context menu items
16
+ * @returns Promise resolving to array of ContextMenuItem objects
17
+ */
18
+ getItems(): Promise<ContextMenuItem[]>;
19
+ /**
20
+ * Close the context menu
21
+ * @returns Promise resolving when the menu is closed
22
+ */
23
+ close(): Promise<void>;
24
+ /**
25
+ * Wait for the menu to appear and load all its items
26
+ */
27
+ wait(timeout?: number): Promise<this>;
28
+ }
29
+ /**
30
+ * Object representing an item of a context menu
31
+ */
32
+ export declare class ContextMenuItem extends MenuItem {
33
+ constructor(item: WebElement, parent: Menu);
34
+ select(): Promise<Menu | undefined>;
35
+ getLabel(): Promise<string>;
36
+ private isNesting;
37
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ContextMenuItem = exports.ContextMenu = void 0;
4
+ const __1 = require("../..");
5
+ const selenium_webdriver_1 = require("selenium-webdriver");
6
+ /**
7
+ * Object representing a context menu
8
+ */
9
+ class ContextMenu extends __1.Menu {
10
+ constructor(containingElement) {
11
+ super(ContextMenu.locators.ContextMenu.constructor, containingElement);
12
+ }
13
+ /**
14
+ * Get context menu item by name
15
+ * @param name name of the item to search by
16
+ * @returns Promise resolving to ContextMenuItem object
17
+ */
18
+ async getItem(name) {
19
+ try {
20
+ const items = await this.getItems();
21
+ for (const item of items) {
22
+ if (await item.getLabel() === name) {
23
+ return item;
24
+ }
25
+ }
26
+ }
27
+ catch (err) {
28
+ return undefined;
29
+ }
30
+ }
31
+ /**
32
+ * Get all context menu items
33
+ * @returns Promise resolving to array of ContextMenuItem objects
34
+ */
35
+ async getItems() {
36
+ const items = [];
37
+ const elements = await this.findElements(ContextMenu.locators.ContextMenu.itemElement);
38
+ for (const element of elements) {
39
+ const klass = await element.getAttribute('class');
40
+ if (klass.indexOf('disabled') < 0) {
41
+ items.push(await new ContextMenuItem(element, this).wait());
42
+ }
43
+ }
44
+ return items;
45
+ }
46
+ /**
47
+ * Close the context menu
48
+ * @returns Promise resolving when the menu is closed
49
+ */
50
+ async close() {
51
+ let actions = this.getDriver().actions();
52
+ await actions.clear();
53
+ await this.getDriver().actions().sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
54
+ try {
55
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(this));
56
+ }
57
+ catch (err) {
58
+ if (!(err instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
59
+ throw err;
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ * Wait for the menu to appear and load all its items
65
+ */
66
+ async wait(timeout = 5000) {
67
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(this), timeout);
68
+ let items = (await this.getItems()).length;
69
+ try {
70
+ await this.getDriver().wait(async () => {
71
+ const temp = (await this.getItems()).length;
72
+ if (temp === items) {
73
+ return true;
74
+ }
75
+ else {
76
+ items = temp;
77
+ return false;
78
+ }
79
+ }, 1000);
80
+ }
81
+ catch (err) {
82
+ if (err instanceof selenium_webdriver_1.error.TimeoutError) {
83
+ // ignore timeout
84
+ }
85
+ else {
86
+ throw err;
87
+ }
88
+ }
89
+ return this;
90
+ }
91
+ }
92
+ exports.ContextMenu = ContextMenu;
93
+ /**
94
+ * Object representing an item of a context menu
95
+ */
96
+ class ContextMenuItem extends __1.MenuItem {
97
+ constructor(item, parent) {
98
+ super(item, parent);
99
+ this.parent = parent;
100
+ }
101
+ async select() {
102
+ await this.click();
103
+ await new Promise(res => setTimeout(res, 500));
104
+ if (await this.isNesting()) {
105
+ return await new ContextMenu(this).wait();
106
+ }
107
+ return undefined;
108
+ }
109
+ async getLabel() {
110
+ const labelItem = await this.findElement(ContextMenu.locators.ContextMenu.itemLabel);
111
+ return await labelItem.getAttribute(ContextMenu.locators.ContextMenu.itemText);
112
+ }
113
+ async isNesting() {
114
+ try {
115
+ return await this.findElement(ContextMenu.locators.ContextMenu.itemNesting).isDisplayed();
116
+ }
117
+ catch (err) {
118
+ return false;
119
+ }
120
+ }
121
+ }
122
+ exports.ContextMenuItem = ContextMenuItem;
123
+ //# sourceMappingURL=ContextMenu.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Handler object for macOS based title bar
3
+ */
4
+ export declare class MacTitleBar {
5
+ /**
6
+ * Select an item from the mac menu bar by its path,
7
+ * does not actually visibly open the menus.
8
+ *
9
+ * @param items varargs path to the given menu item
10
+ * each argument serves as a part of the path in order,
11
+ *
12
+ * e.g. ('File', 'Save') will select the 'Save' item from
13
+ * the 'File' submenu
14
+ */
15
+ static select(...items: string[]): void;
16
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MacTitleBar = void 0;
4
+ const child_process_1 = require("child_process");
5
+ /**
6
+ * Handler object for macOS based title bar
7
+ */
8
+ class MacTitleBar {
9
+ /**
10
+ * Select an item from the mac menu bar by its path,
11
+ * does not actually visibly open the menus.
12
+ *
13
+ * @param items varargs path to the given menu item
14
+ * each argument serves as a part of the path in order,
15
+ *
16
+ * e.g. ('File', 'Save') will select the 'Save' item from
17
+ * the 'File' submenu
18
+ */
19
+ static select(...items) {
20
+ let menuCounter = 0;
21
+ const commands = [
22
+ `tell application "System Events"`,
23
+ `tell process "Code"`,
24
+ `tell menu bar item "${items[0]}" of menu bar 1`
25
+ ];
26
+ for (let i = 1; i < items.length - 1; i++) {
27
+ commands.push(`tell menu item "${items[i]}" of menu 1`);
28
+ ++menuCounter;
29
+ }
30
+ if (items.length > 1) {
31
+ commands.push(`click menu item "${items[items.length - 1]}" of menu 1`);
32
+ }
33
+ for (let i = 0; i < menuCounter + 3; i++) {
34
+ commands.push(`end tell`);
35
+ }
36
+ const command = `osascript -e '${commands.join('\n')}'`;
37
+ (0, child_process_1.execSync)(command);
38
+ }
39
+ }
40
+ exports.MacTitleBar = MacTitleBar;
41
+ //# sourceMappingURL=MacTitleBar.js.map
@@ -0,0 +1,38 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { MenuItem } from "./MenuItem";
3
+ /**
4
+ * Abstract element representing a menu
5
+ */
6
+ export declare abstract class Menu extends AbstractElement {
7
+ /**
8
+ * Find whether the menu has an item of a given name
9
+ * @param name name of the item to search for
10
+ * @returns true if menu has an item with the given name, false otherwise
11
+ */
12
+ hasItem(name: string): Promise<boolean>;
13
+ /**
14
+ * Return a menu item of a given name, undefined if not found
15
+ * @param name name of the item to search for
16
+ */
17
+ abstract getItem(name: string): Promise<MenuItem | undefined>;
18
+ /**
19
+ * Get all items of a menu
20
+ * @returns array of MenuItem object representing the menu items
21
+ */
22
+ abstract getItems(): Promise<MenuItem[]>;
23
+ /**
24
+ * Recursively select an item with a given path.
25
+ *
26
+ * E.g. calling select('File', 'Preferences', 'Settings') will
27
+ * open the 'File' -> 'Preferences' submenus and then click on 'Settings'.
28
+ *
29
+ * Selection happens in order of the arguments, if one of the items in the middle
30
+ * of the path has no children, the consequent path arguments will be ignored.
31
+ *
32
+ *
33
+ * @param path path to the item to select, represented by a sequence of strings
34
+ * @returns void if the last clicked item is a leaf, Menu item representing
35
+ * its submenu otherwise
36
+ */
37
+ select(...path: string[]): Promise<Menu | undefined>;
38
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Menu = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ /**
6
+ * Abstract element representing a menu
7
+ */
8
+ class Menu extends AbstractElement_1.AbstractElement {
9
+ /**
10
+ * Find whether the menu has an item of a given name
11
+ * @param name name of the item to search for
12
+ * @returns true if menu has an item with the given name, false otherwise
13
+ */
14
+ async hasItem(name) {
15
+ const item = await this.getItem(name);
16
+ return !!item && (item).isDisplayed();
17
+ }
18
+ /**
19
+ * Recursively select an item with a given path.
20
+ *
21
+ * E.g. calling select('File', 'Preferences', 'Settings') will
22
+ * open the 'File' -> 'Preferences' submenus and then click on 'Settings'.
23
+ *
24
+ * Selection happens in order of the arguments, if one of the items in the middle
25
+ * of the path has no children, the consequent path arguments will be ignored.
26
+ *
27
+ *
28
+ * @param path path to the item to select, represented by a sequence of strings
29
+ * @returns void if the last clicked item is a leaf, Menu item representing
30
+ * its submenu otherwise
31
+ */
32
+ async select(...path) {
33
+ let parent = this;
34
+ for (const label of path) {
35
+ const item = await parent.getItem(label);
36
+ if (!item)
37
+ return parent;
38
+ await Menu.driver.wait(async function () {
39
+ return await item.isDisplayed() && await item.isEnabled();
40
+ });
41
+ const submenu = await item.select();
42
+ if (submenu) {
43
+ parent = submenu;
44
+ }
45
+ else {
46
+ return;
47
+ }
48
+ }
49
+ return parent;
50
+ }
51
+ }
52
+ exports.Menu = Menu;
53
+ //# sourceMappingURL=Menu.js.map
@@ -0,0 +1,24 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { Menu } from "./Menu";
3
+ /**
4
+ * Abstract element representing a menu item
5
+ */
6
+ export declare abstract class MenuItem extends AbstractElement {
7
+ protected parent: Menu;
8
+ protected label: string;
9
+ /**
10
+ * Use the given menu item: Opens the submenu if the item has children,
11
+ * otherwise simply click the item.
12
+ *
13
+ * @returns Menu object representing the submenu if the item has children, void otherwise.
14
+ */
15
+ select(): Promise<Menu | undefined>;
16
+ /**
17
+ * Return the Menu object representing the menu this item belongs to
18
+ */
19
+ getParent(): Menu;
20
+ /**
21
+ * Returns the label of the menu item
22
+ */
23
+ getLabel(): string | Promise<string>;
24
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MenuItem = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ /**
6
+ * Abstract element representing a menu item
7
+ */
8
+ class MenuItem extends AbstractElement_1.AbstractElement {
9
+ parent;
10
+ label;
11
+ /**
12
+ * Use the given menu item: Opens the submenu if the item has children,
13
+ * otherwise simply click the item.
14
+ *
15
+ * @returns Menu object representing the submenu if the item has children, void otherwise.
16
+ */
17
+ async select() {
18
+ await this.click();
19
+ await new Promise(res => setTimeout(res, 500));
20
+ return undefined;
21
+ }
22
+ /**
23
+ * Return the Menu object representing the menu this item belongs to
24
+ */
25
+ getParent() {
26
+ return this.parent;
27
+ }
28
+ /**
29
+ * Returns the label of the menu item
30
+ */
31
+ getLabel() {
32
+ return this.label;
33
+ }
34
+ }
35
+ exports.MenuItem = MenuItem;
36
+ //# sourceMappingURL=MenuItem.js.map
@@ -0,0 +1,36 @@
1
+ import { WindowControls, ContextMenu } from "../..";
2
+ import { Menu } from "./Menu";
3
+ import { MenuItem } from "./MenuItem";
4
+ /**
5
+ * Page object representing the custom VSCode title bar
6
+ */
7
+ export declare class TitleBar extends Menu {
8
+ constructor();
9
+ /**
10
+ * Get title bar item by name
11
+ * @param name name of the item to search by
12
+ * @returns Promise resolving to TitleBarItem object
13
+ */
14
+ getItem(name: string): Promise<TitleBarItem | undefined>;
15
+ /**
16
+ * Get all title bar items
17
+ * @returns Promise resolving to array of TitleBarItem objects
18
+ */
19
+ getItems(): Promise<TitleBarItem[]>;
20
+ /**
21
+ * Get the window title
22
+ * @returns Promise resolving to the window title
23
+ */
24
+ getTitle(): Promise<string>;
25
+ /**
26
+ * Get a reference to the WindowControls
27
+ */
28
+ getWindowControls(): WindowControls;
29
+ }
30
+ /**
31
+ * Page object representing an item of the custom VSCode title bar
32
+ */
33
+ export declare class TitleBarItem extends MenuItem {
34
+ constructor(label: string, parent: Menu);
35
+ select(): Promise<ContextMenu>;
36
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TitleBarItem = exports.TitleBar = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ const __1 = require("../..");
6
+ const Menu_1 = require("./Menu");
7
+ const MenuItem_1 = require("./MenuItem");
8
+ /**
9
+ * Page object representing the custom VSCode title bar
10
+ */
11
+ class TitleBar extends Menu_1.Menu {
12
+ constructor() {
13
+ super(TitleBar.locators.TitleBar.constructor, TitleBar.locators.Workbench.constructor);
14
+ }
15
+ /**
16
+ * Get title bar item by name
17
+ * @param name name of the item to search by
18
+ * @returns Promise resolving to TitleBarItem object
19
+ */
20
+ async getItem(name) {
21
+ try {
22
+ await this.findElement(TitleBar.locators.TitleBar.itemConstructor(name));
23
+ return await new TitleBarItem(name, this).wait();
24
+ }
25
+ catch (err) {
26
+ return undefined;
27
+ }
28
+ }
29
+ /**
30
+ * Get all title bar items
31
+ * @returns Promise resolving to array of TitleBarItem objects
32
+ */
33
+ async getItems() {
34
+ const items = [];
35
+ const elements = await this.findElements(TitleBar.locators.TitleBar.itemElement);
36
+ for (const element of elements) {
37
+ if (await element.isDisplayed()) {
38
+ items.push(await new TitleBarItem(await element.getAttribute(TitleBar.locators.TitleBar.itemLabel), this).wait());
39
+ }
40
+ }
41
+ return items;
42
+ }
43
+ /**
44
+ * Get the window title
45
+ * @returns Promise resolving to the window title
46
+ */
47
+ async getTitle() {
48
+ return await this.findElement(TitleBar.locators.TitleBar.title).getText();
49
+ }
50
+ /**
51
+ * Get a reference to the WindowControls
52
+ */
53
+ getWindowControls() {
54
+ return new __1.WindowControls(this);
55
+ }
56
+ }
57
+ exports.TitleBar = TitleBar;
58
+ /**
59
+ * Page object representing an item of the custom VSCode title bar
60
+ */
61
+ class TitleBarItem extends MenuItem_1.MenuItem {
62
+ constructor(label, parent) {
63
+ super(TitleBar.locators.TitleBar.itemConstructor(label), parent);
64
+ this.parent = parent;
65
+ this.label = label;
66
+ }
67
+ async select() {
68
+ const openMenus = await this.getDriver().findElements(TitleBar.locators.ContextMenu.constructor);
69
+ if (openMenus.length > 0 && await openMenus[0].isDisplayed()) {
70
+ await this.getDriver().actions().sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
71
+ }
72
+ await this.click();
73
+ await new Promise(res => setTimeout(res, 500));
74
+ return new __1.ContextMenu(this).wait();
75
+ }
76
+ }
77
+ exports.TitleBarItem = TitleBarItem;
78
+ //# sourceMappingURL=TitleBar.js.map
@@ -0,0 +1,28 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { TitleBar } from "../..";
3
+ /**
4
+ * Page object for the windows controls part of the title bar
5
+ */
6
+ export declare class WindowControls extends AbstractElement {
7
+ constructor(bar?: TitleBar);
8
+ /**
9
+ * Use the minimize window button
10
+ * @returns Promise resolving when minimize button is pressed
11
+ */
12
+ minimize(): Promise<void>;
13
+ /**
14
+ * Use the maximize window button if the window is not maximized
15
+ * @returns Promise resolving when maximize button is pressed
16
+ */
17
+ maximize(): Promise<void>;
18
+ /**
19
+ * Use the restore window button if the window is maximized
20
+ * @returns Promise resolving when restore button is pressed
21
+ */
22
+ restore(): Promise<void>;
23
+ /**
24
+ * Use the window close button. Use at your own risk.
25
+ * @returns Promise resolving when close button is pressed
26
+ */
27
+ close(): Promise<void>;
28
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WindowControls = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ const __1 = require("../..");
6
+ /**
7
+ * Page object for the windows controls part of the title bar
8
+ */
9
+ class WindowControls extends AbstractElement_1.AbstractElement {
10
+ constructor(bar = new __1.TitleBar()) {
11
+ super(WindowControls.locators.WindowControls.constructor, bar);
12
+ }
13
+ /**
14
+ * Use the minimize window button
15
+ * @returns Promise resolving when minimize button is pressed
16
+ */
17
+ async minimize() {
18
+ const minButton = await this.findElement(WindowControls.locators.WindowControls.minimize);
19
+ await minButton.click();
20
+ }
21
+ /**
22
+ * Use the maximize window button if the window is not maximized
23
+ * @returns Promise resolving when maximize button is pressed
24
+ */
25
+ async maximize() {
26
+ let maxButton;
27
+ try {
28
+ maxButton = await this.findElement(WindowControls.locators.WindowControls.maximize);
29
+ await maxButton.click();
30
+ }
31
+ catch (err) {
32
+ console.log('Window is already maximized');
33
+ }
34
+ }
35
+ /**
36
+ * Use the restore window button if the window is maximized
37
+ * @returns Promise resolving when restore button is pressed
38
+ */
39
+ async restore() {
40
+ let maxButton;
41
+ try {
42
+ maxButton = await this.findElement(WindowControls.locators.WindowControls.restore);
43
+ await maxButton.click();
44
+ }
45
+ catch (err) {
46
+ console.log('Window is not maximized');
47
+ }
48
+ }
49
+ /**
50
+ * Use the window close button. Use at your own risk.
51
+ * @returns Promise resolving when close button is pressed
52
+ */
53
+ async close() {
54
+ const closeButton = await this.findElement(WindowControls.locators.WindowControls.close);
55
+ await closeButton.click();
56
+ }
57
+ }
58
+ exports.WindowControls = WindowControls;
59
+ //# sourceMappingURL=WindowControls.js.map
@@ -0,0 +1,18 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { ViewTitlePart, ViewContent } from "../..";
3
+ /**
4
+ * Page object for the side bar view
5
+ */
6
+ export declare class SideBarView extends AbstractElement {
7
+ constructor();
8
+ /**
9
+ * Get the top part of the open view (contains title and possibly some buttons)
10
+ * @returns ViewTitlePart object
11
+ */
12
+ getTitlePart(): ViewTitlePart;
13
+ /**
14
+ * Get the content part of the open view
15
+ * @returns ViewContent object
16
+ */
17
+ getContent(): ViewContent;
18
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SideBarView = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ const __1 = require("../..");
6
+ /**
7
+ * Page object for the side bar view
8
+ */
9
+ class SideBarView extends AbstractElement_1.AbstractElement {
10
+ constructor() {
11
+ super(SideBarView.locators.SideBarView.constructor, SideBarView.locators.Workbench.constructor);
12
+ }
13
+ /**
14
+ * Get the top part of the open view (contains title and possibly some buttons)
15
+ * @returns ViewTitlePart object
16
+ */
17
+ getTitlePart() {
18
+ return new __1.ViewTitlePart(this);
19
+ }
20
+ /**
21
+ * Get the content part of the open view
22
+ * @returns ViewContent object
23
+ */
24
+ getContent() {
25
+ return new __1.ViewContent(this);
26
+ }
27
+ }
28
+ exports.SideBarView = SideBarView;
29
+ //# sourceMappingURL=SideBarView.js.map