@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,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatusBar = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const NotificationsCenter_1 = require("../workbench/NotificationsCenter");
7
+ /**
8
+ * Page object for the status bar at the bottom
9
+ */
10
+ class StatusBar extends AbstractElement_1.AbstractElement {
11
+ constructor() {
12
+ super(StatusBar.locators.StatusBar.constructor, StatusBar.locators.Workbench.constructor);
13
+ }
14
+ /**
15
+ * Retrieve all status bar items currently displayed
16
+ * @returns Promise resolving to an array of WebElement
17
+ */
18
+ async getItems() {
19
+ return await this.findElements(StatusBar.locators.StatusBar.item);
20
+ }
21
+ /**
22
+ * Find status bar item by title/visible label
23
+ * @param title title of the item
24
+ * @returns Promise resolving to a WebElement if item is found, to undefined otherwise
25
+ */
26
+ async getItem(title) {
27
+ const items = await this.getItems();
28
+ for (const item of items) {
29
+ try {
30
+ if (await item.getAttribute(StatusBar.locators.StatusBar.itemTitle) === title) {
31
+ return item;
32
+ }
33
+ }
34
+ catch (err) {
35
+ if (!(err instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
36
+ throw err;
37
+ }
38
+ }
39
+ }
40
+ return undefined;
41
+ }
42
+ /**
43
+ * Open the notifications center
44
+ * @returns Promise resolving to NotificationsCenter object
45
+ */
46
+ async openNotificationsCenter() {
47
+ await this.toggleNotificationsCentre(true);
48
+ return new NotificationsCenter_1.NotificationsCenter();
49
+ }
50
+ /**
51
+ * Close the notifications center
52
+ * @returns Promise resolving when the notifications center is closed
53
+ */
54
+ async closeNotificationsCenter() {
55
+ await this.toggleNotificationsCentre(false);
56
+ }
57
+ /**
58
+ * Open the language selection quick pick
59
+ * Only works with an open editor
60
+ * @returns Promise resolving when the language selection is opened
61
+ */
62
+ async openLanguageSelection() {
63
+ await this.findElement(StatusBar.locators.StatusBar.language).click();
64
+ }
65
+ /**
66
+ * Get the current language label text
67
+ * Only works with an open editor
68
+ * @returns Promise resolving to string representation of current language
69
+ */
70
+ async getCurrentLanguage() {
71
+ return await this.getPartText(StatusBar.locators.StatusBar.language);
72
+ }
73
+ /**
74
+ * Open the quick pick for line endings selection
75
+ * Only works with an open editor
76
+ * @returns Promise resolving when the line ending selection is opened
77
+ */
78
+ async openLineEndingSelection() {
79
+ await this.findElement(StatusBar.locators.StatusBar.lines).click();
80
+ }
81
+ /**
82
+ * Get the currently selected line ending as text
83
+ * Only works with an open editor
84
+ * @returns Promise resolving to string representation of current line ending
85
+ */
86
+ async getCurrentLineEnding() {
87
+ return await this.getPartText(StatusBar.locators.StatusBar.lines);
88
+ }
89
+ /**
90
+ * Open the encoding selection quick pick
91
+ * Only works with an open editor
92
+ * @returns Promise resolving when the encoding selection is opened
93
+ */
94
+ async openEncodingSelection() {
95
+ await this.findElement(StatusBar.locators.StatusBar.encoding).click();
96
+ }
97
+ /**
98
+ * Get the name of the current encoding as text
99
+ * Only works with an open editor
100
+ * @returns Promise resolving to string representation of current encoding
101
+ */
102
+ async getCurrentEncoding() {
103
+ return await this.getPartText(StatusBar.locators.StatusBar.encoding);
104
+ }
105
+ /**
106
+ * Open the indentation selection quick pick
107
+ * Only works with an open editor
108
+ * @returns Promise resolving when the indentation selection is opened
109
+ */
110
+ async openIndentationSelection() {
111
+ await this.findElement(StatusBar.locators.StatusBar.indent).click();
112
+ }
113
+ /**
114
+ * Get the current indentation option label as text
115
+ * Only works with an open editor
116
+ * @returns Promise resolving to string representation of current indentation
117
+ */
118
+ async getCurrentIndentation() {
119
+ return await this.getPartText(StatusBar.locators.StatusBar.indent);
120
+ }
121
+ /**
122
+ * Open the line selection input box
123
+ * Only works with an open editor
124
+ * @returns Promise resolving when the line selection is opened
125
+ */
126
+ async openLineSelection() {
127
+ await this.findElement(StatusBar.locators.StatusBar.selection).click();
128
+ }
129
+ /**
130
+ * Get the current editor coordinates as text
131
+ * Only works with an open editor
132
+ * @returns Promise resolving to string representation of current position in the editor
133
+ */
134
+ async getCurrentPosition() {
135
+ return await this.getPartText(StatusBar.locators.StatusBar.selection);
136
+ }
137
+ /**
138
+ * Open/Close notification centre
139
+ * @param open true to open, false to close
140
+ */
141
+ async toggleNotificationsCentre(open) {
142
+ let visible = false;
143
+ try {
144
+ const klass = await this.enclosingItem.findElement(StatusBar.locators.StatusBar.notifications).getAttribute('class');
145
+ visible = klass.indexOf('visible') > -1;
146
+ }
147
+ catch (err) {
148
+ // element doesn't exist until the button is first clicked
149
+ }
150
+ if (visible !== open) {
151
+ await this.findElement(StatusBar.locators.StatusBar.bell).click();
152
+ }
153
+ }
154
+ async getPartText(locator) {
155
+ return await this.findElement(locator).findElement(selenium_webdriver_1.By.css('a')).getAttribute('innerHTML');
156
+ }
157
+ }
158
+ exports.StatusBar = StatusBar;
159
+ //# sourceMappingURL=StatusBar.js.map
@@ -0,0 +1,52 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ /**
3
+ * Page object for the Debugger Toolbar
4
+ */
5
+ export declare class DebugToolbar extends AbstractElement {
6
+ constructor();
7
+ /**
8
+ * Wait for the debug toolbar to appear and instantiate it.
9
+ * Assumes that debug session is already starting and it is just
10
+ * a matter of waiting for the toolbar to appear.
11
+ *
12
+ * @param timeout max time to wait in milliseconds, default 5000
13
+ */
14
+ static create(timeout?: number): Promise<DebugToolbar>;
15
+ /**
16
+ * Wait for the execution to pause at the next breakpoint
17
+ */
18
+ waitForBreakPoint(timeout?: undefined): Promise<void>;
19
+ /**
20
+ * Click Continue
21
+ */
22
+ continue(): Promise<void>;
23
+ /**
24
+ * Click Disconnect
25
+ */
26
+ disconnect(): Promise<void>;
27
+ /**
28
+ * Click Pause
29
+ */
30
+ pause(): Promise<void>;
31
+ /**
32
+ * Click Step Over
33
+ */
34
+ stepOver(): Promise<void>;
35
+ /**
36
+ * Click Step Into
37
+ */
38
+ stepInto(): Promise<void>;
39
+ /**
40
+ * Click Step Out
41
+ */
42
+ stepOut(): Promise<void>;
43
+ /**
44
+ * Click Restart
45
+ */
46
+ restart(): Promise<void>;
47
+ /**
48
+ * Click Stop
49
+ */
50
+ stop(): Promise<void>;
51
+ private getButton;
52
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DebugToolbar = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const Workbench_1 = require("./Workbench");
7
+ /**
8
+ * Page object for the Debugger Toolbar
9
+ */
10
+ class DebugToolbar extends AbstractElement_1.AbstractElement {
11
+ constructor() {
12
+ super(DebugToolbar.locators.DebugToolbar.ctor, new Workbench_1.Workbench());
13
+ }
14
+ /**
15
+ * Wait for the debug toolbar to appear and instantiate it.
16
+ * Assumes that debug session is already starting and it is just
17
+ * a matter of waiting for the toolbar to appear.
18
+ *
19
+ * @param timeout max time to wait in milliseconds, default 5000
20
+ */
21
+ static async create(timeout = 5000) {
22
+ await DebugToolbar.driver.wait(selenium_webdriver_1.until.elementLocated(DebugToolbar.locators.DebugToolbar.ctor), timeout);
23
+ return new DebugToolbar().wait(timeout);
24
+ }
25
+ /**
26
+ * Wait for the execution to pause at the next breakpoint
27
+ */
28
+ async waitForBreakPoint(timeout = undefined) {
29
+ let btn = await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(DebugToolbar.locators.DebugToolbar.button('continue')));
30
+ await this.getDriver().wait(async () => {
31
+ try {
32
+ const enabled = await btn.isEnabled();
33
+ return enabled;
34
+ }
35
+ catch (err) {
36
+ btn = await this.findElement(DebugToolbar.locators.DebugToolbar.button('continue'));
37
+ }
38
+ }, timeout);
39
+ }
40
+ /**
41
+ * Click Continue
42
+ */
43
+ async continue() {
44
+ await (await this.getButton('continue')).click();
45
+ }
46
+ /**
47
+ * Click Disconnect
48
+ */
49
+ async disconnect() {
50
+ await (await this.getButton('disconnect')).click();
51
+ }
52
+ /**
53
+ * Click Pause
54
+ */
55
+ async pause() {
56
+ await (await this.getButton('pause')).click();
57
+ }
58
+ /**
59
+ * Click Step Over
60
+ */
61
+ async stepOver() {
62
+ await (await this.getButton('step-over')).click();
63
+ }
64
+ /**
65
+ * Click Step Into
66
+ */
67
+ async stepInto() {
68
+ await (await this.getButton('step-into')).click();
69
+ }
70
+ /**
71
+ * Click Step Out
72
+ */
73
+ async stepOut() {
74
+ await (await this.getButton('step-out')).click();
75
+ }
76
+ /**
77
+ * Click Restart
78
+ */
79
+ async restart() {
80
+ await (await this.getButton('restart')).click();
81
+ }
82
+ /**
83
+ * Click Stop
84
+ */
85
+ async stop() {
86
+ await (await this.getButton('stop')).click();
87
+ }
88
+ async getButton(name) {
89
+ return await this.findElement(DebugToolbar.locators.DebugToolbar.button(name));
90
+ }
91
+ }
92
+ exports.DebugToolbar = DebugToolbar;
93
+ //# sourceMappingURL=DebugToolbar.js.map
@@ -0,0 +1,78 @@
1
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
2
+ import { AbstractElement } from "../AbstractElement";
3
+ import { By, WebElement } from "selenium-webdriver";
4
+ /**
5
+ * Available types of notifications
6
+ */
7
+ export declare enum NotificationType {
8
+ Info = "info",
9
+ Warning = "warning",
10
+ Error = "error",
11
+ Any = "any"
12
+ }
13
+ /**
14
+ * Abstract element representing a notification
15
+ */
16
+ export declare abstract class Notification extends ElementWithContexMenu {
17
+ /**
18
+ * Get the message of the notification
19
+ * @returns Promise resolving to notification message
20
+ */
21
+ getMessage(): Promise<string>;
22
+ /**
23
+ * Get the type of the notification
24
+ * @returns Promise resolving to NotificationType
25
+ */
26
+ getType(): Promise<NotificationType>;
27
+ /**
28
+ * Get the source of the notification as text
29
+ * @returns Promise resolving to notification source
30
+ */
31
+ getSource(): Promise<string>;
32
+ /**
33
+ * Find whether the notification has an active progress bar
34
+ * @returns Promise resolving to true/false
35
+ */
36
+ hasProgress(): Promise<boolean>;
37
+ /**
38
+ * Dismiss the notification
39
+ * @returns Promise resolving when notification is dismissed
40
+ */
41
+ dismiss(): Promise<void>;
42
+ /**
43
+ * Get the action buttons of the notification as an array
44
+ * of NotificationButton objects
45
+ * @returns Promise resolving to array of NotificationButton objects
46
+ */
47
+ getActions(): Promise<NotificationButton[]>;
48
+ /**
49
+ * Click on an action button with the given title
50
+ * @param title title of the action/button
51
+ * @returns Promise resolving when the select button is pressed
52
+ */
53
+ takeAction(title: string): Promise<void>;
54
+ /**
55
+ * Expand the notification if possible
56
+ */
57
+ expand(): Promise<void>;
58
+ }
59
+ /**
60
+ * Notification displayed on its own in the notifications-toasts container
61
+ */
62
+ export declare class StandaloneNotification extends Notification {
63
+ constructor(notification: WebElement);
64
+ }
65
+ /**
66
+ * Notification displayed within the notifications center
67
+ */
68
+ export declare class CenterNotification extends Notification {
69
+ constructor(notification: WebElement);
70
+ }
71
+ /**
72
+ * Notification button
73
+ */
74
+ declare class NotificationButton extends AbstractElement {
75
+ constructor(buttonConstructor: By, notification: Notification);
76
+ getTitle(): Promise<string>;
77
+ }
78
+ export {};
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CenterNotification = exports.StandaloneNotification = exports.Notification = exports.NotificationType = void 0;
4
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const selenium_webdriver_1 = require("selenium-webdriver");
7
+ /**
8
+ * Available types of notifications
9
+ */
10
+ var NotificationType;
11
+ (function (NotificationType) {
12
+ NotificationType["Info"] = "info";
13
+ NotificationType["Warning"] = "warning";
14
+ NotificationType["Error"] = "error";
15
+ NotificationType["Any"] = "any";
16
+ })(NotificationType || (exports.NotificationType = NotificationType = {}));
17
+ /**
18
+ * Abstract element representing a notification
19
+ */
20
+ class Notification extends ElementWithContextMenu_1.ElementWithContexMenu {
21
+ /**
22
+ * Get the message of the notification
23
+ * @returns Promise resolving to notification message
24
+ */
25
+ async getMessage() {
26
+ return await (await this.findElement(Notification.locators.Notification.message)).getText();
27
+ }
28
+ /**
29
+ * Get the type of the notification
30
+ * @returns Promise resolving to NotificationType
31
+ */
32
+ async getType() {
33
+ const iconType = await (await this.findElement(Notification.locators.Notification.icon)).getAttribute('class');
34
+ if (iconType.indexOf('icon-info') > -1) {
35
+ return NotificationType.Info;
36
+ }
37
+ else if (iconType.indexOf('icon-warning') > -1) {
38
+ return NotificationType.Warning;
39
+ }
40
+ else {
41
+ return NotificationType.Error;
42
+ }
43
+ }
44
+ /**
45
+ * Get the source of the notification as text
46
+ * @returns Promise resolving to notification source
47
+ */
48
+ async getSource() {
49
+ await this.expand();
50
+ return await (await this.findElement(Notification.locators.Notification.source)).getAttribute('title');
51
+ }
52
+ /**
53
+ * Find whether the notification has an active progress bar
54
+ * @returns Promise resolving to true/false
55
+ */
56
+ async hasProgress() {
57
+ const klass = await (await this.findElement(Notification.locators.Notification.progress)).getAttribute('class');
58
+ return klass.indexOf('done') < 0;
59
+ }
60
+ /**
61
+ * Dismiss the notification
62
+ * @returns Promise resolving when notification is dismissed
63
+ */
64
+ async dismiss() {
65
+ await this.getDriver().actions().move({ origin: this }).perform();
66
+ const btn = await this.findElement(Notification.locators.Notification.dismiss);
67
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(btn), 2000);
68
+ await btn.click();
69
+ }
70
+ /**
71
+ * Get the action buttons of the notification as an array
72
+ * of NotificationButton objects
73
+ * @returns Promise resolving to array of NotificationButton objects
74
+ */
75
+ async getActions() {
76
+ const buttons = [];
77
+ const elements = await this.findElement(Notification.locators.Notification.actions)
78
+ .findElements(Notification.locators.Notification.action);
79
+ for (const button of elements) {
80
+ const title = await Notification.locators.Notification.actionLabel.value(button);
81
+ buttons.push(await new NotificationButton(Notification.locators.Notification.buttonConstructor(title), this).wait());
82
+ }
83
+ return buttons;
84
+ }
85
+ /**
86
+ * Click on an action button with the given title
87
+ * @param title title of the action/button
88
+ * @returns Promise resolving when the select button is pressed
89
+ */
90
+ async takeAction(title) {
91
+ await new NotificationButton(Notification.locators.Notification.buttonConstructor(title), this).click();
92
+ }
93
+ /**
94
+ * Expand the notification if possible
95
+ */
96
+ async expand() {
97
+ await this.getDriver().actions().move({ origin: this }).perform();
98
+ const exp = await this.findElements(Notification.locators.Notification.expand);
99
+ if (exp[0]) {
100
+ await exp[0].click();
101
+ }
102
+ }
103
+ }
104
+ exports.Notification = Notification;
105
+ /**
106
+ * Notification displayed on its own in the notifications-toasts container
107
+ */
108
+ class StandaloneNotification extends Notification {
109
+ constructor(notification) {
110
+ super(notification, StandaloneNotification.locators.Notification.standaloneContainer);
111
+ }
112
+ }
113
+ exports.StandaloneNotification = StandaloneNotification;
114
+ /**
115
+ * Notification displayed within the notifications center
116
+ */
117
+ class CenterNotification extends Notification {
118
+ constructor(notification) {
119
+ super(notification, CenterNotification.locators.NotificationsCenter.constructor);
120
+ }
121
+ }
122
+ exports.CenterNotification = CenterNotification;
123
+ /**
124
+ * Notification button
125
+ */
126
+ class NotificationButton extends AbstractElement_1.AbstractElement {
127
+ constructor(buttonConstructor, notification) {
128
+ super(buttonConstructor, notification);
129
+ }
130
+ async getTitle() {
131
+ return await Notification.locators.Notification.actionLabel.value(this);
132
+ }
133
+ }
134
+ //# sourceMappingURL=Notification.js.map
@@ -0,0 +1,27 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { Notification, NotificationType } from "./Notification";
3
+ /**
4
+ * Notifications center page object
5
+ */
6
+ export declare class NotificationsCenter extends AbstractElement {
7
+ constructor();
8
+ /**
9
+ * Close the notifications center
10
+ * @returns Promise resolving when the center is closed
11
+ */
12
+ close(): Promise<void>;
13
+ /**
14
+ * Clear all notifications in the notifications center
15
+ * Note that this will also hide the notifications center
16
+ * @returns Promise resolving when the clear all button is pressed
17
+ */
18
+ clearAllNotifications(): Promise<void>;
19
+ /**
20
+ * Get all notifications of a given type
21
+ * @param type type of the notifications to look for,
22
+ * NotificationType.Any will retrieve all notifications
23
+ *
24
+ * @returns Promise resolving to array of Notification objects
25
+ */
26
+ getNotifications(type: NotificationType): Promise<Notification[]>;
27
+ }
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationsCenter = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const Notification_1 = require("./Notification");
7
+ /**
8
+ * Notifications center page object
9
+ */
10
+ class NotificationsCenter extends AbstractElement_1.AbstractElement {
11
+ constructor() {
12
+ super(NotificationsCenter.locators.NotificationsCenter.constructor, NotificationsCenter.locators.Workbench.constructor);
13
+ }
14
+ /**
15
+ * Close the notifications center
16
+ * @returns Promise resolving when the center is closed
17
+ */
18
+ async close() {
19
+ if (await this.isDisplayed()) {
20
+ try {
21
+ await this.findElement(NotificationsCenter.locators.NotificationsCenter.close).click();
22
+ }
23
+ catch (error) {
24
+ await this.click();
25
+ this.getDriver().actions().sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
26
+ }
27
+ }
28
+ }
29
+ /**
30
+ * Clear all notifications in the notifications center
31
+ * Note that this will also hide the notifications center
32
+ * @returns Promise resolving when the clear all button is pressed
33
+ */
34
+ async clearAllNotifications() {
35
+ await this.findElement(NotificationsCenter.locators.NotificationsCenter.clear).click();
36
+ }
37
+ /**
38
+ * Get all notifications of a given type
39
+ * @param type type of the notifications to look for,
40
+ * NotificationType.Any will retrieve all notifications
41
+ *
42
+ * @returns Promise resolving to array of Notification objects
43
+ */
44
+ async getNotifications(type) {
45
+ const notifications = [];
46
+ const elements = await this.findElements(NotificationsCenter.locators.NotificationsCenter.row);
47
+ for (const element of elements) {
48
+ const not = new Notification_1.CenterNotification(element);
49
+ if (type === Notification_1.NotificationType.Any || await not.getType() === type) {
50
+ notifications.push(await not.wait());
51
+ }
52
+ }
53
+ return notifications;
54
+ }
55
+ }
56
+ exports.NotificationsCenter = NotificationsCenter;
57
+ //# sourceMappingURL=NotificationsCenter.js.map
@@ -0,0 +1,69 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { TitleBar } from "../menu/TitleBar";
3
+ import { SideBarView } from "../sidebar/SideBarView";
4
+ import { ActivityBar } from "../activityBar/ActivityBar";
5
+ import { StatusBar } from "../statusBar/StatusBar";
6
+ import { EditorView } from "../editor/EditorView";
7
+ import { BottomBarPanel } from "../bottomBar/BottomBarPanel";
8
+ import { Notification } from "./Notification";
9
+ import { NotificationsCenter } from "./NotificationsCenter";
10
+ import { QuickOpenBox } from "./input/QuickOpenBox";
11
+ import { SettingsEditor } from "../editor/SettingsEditor";
12
+ import { InputBox } from "./input/InputBox";
13
+ /**
14
+ * Handler for general workbench related actions
15
+ */
16
+ export declare class Workbench extends AbstractElement {
17
+ constructor();
18
+ /**
19
+ * Get a title bar handle
20
+ */
21
+ getTitleBar(): TitleBar;
22
+ /**
23
+ * Get a side bar handle
24
+ */
25
+ getSideBar(): SideBarView;
26
+ /**
27
+ * Get an activity bar handle
28
+ */
29
+ getActivityBar(): ActivityBar;
30
+ /**
31
+ * Get a status bar handle
32
+ */
33
+ getStatusBar(): StatusBar;
34
+ /**
35
+ * Get a bottom bar handle
36
+ */
37
+ getBottomBar(): BottomBarPanel;
38
+ /**
39
+ * Get a handle for the editor view
40
+ */
41
+ getEditorView(): EditorView;
42
+ /**
43
+ * Get all standalone notifications (notifications outside the notifications center)
44
+ * @returns Promise resolving to array of Notification objects
45
+ */
46
+ getNotifications(): Promise<Notification[]>;
47
+ /**
48
+ * Opens the notifications center
49
+ * @returns Promise resolving to NotificationsCenter object
50
+ */
51
+ openNotificationsCenter(): Promise<NotificationsCenter>;
52
+ /**
53
+ * Opens the settings editor
54
+ *
55
+ * @returns promise that resolves to a SettingsEditor instance
56
+ */
57
+ openSettings(): Promise<SettingsEditor>;
58
+ /**
59
+ * Open the VS Code command line prompt
60
+ * @returns Promise resolving to InputBox (vscode 1.44+) or QuickOpenBox (vscode up to 1.43) object
61
+ */
62
+ openCommandPrompt(): Promise<QuickOpenBox | InputBox>;
63
+ /**
64
+ * Open the command prompt, type in a command and execute
65
+ * @param command text of the command to be executed
66
+ * @returns Promise resolving when the command prompt is confirmed
67
+ */
68
+ executeCommand(command: string): Promise<void>;
69
+ }