@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
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2019 Software Freedom Conservancy (SFC)
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # ExTester - Page Objects
2
+
3
+ Page Object API implementation for a VS Code editor used by ExTester framework.
4
+
5
+ - 📄 [Page objects API quick guide](../../docs/Page-Object-APIs)
@@ -0,0 +1,35 @@
1
+ import { WebElement, WebDriver, Locator } from "selenium-webdriver";
2
+ import { Locators } from "../locators/locators";
3
+ /**
4
+ * Default wrapper for webelement
5
+ */
6
+ export declare abstract class AbstractElement extends WebElement {
7
+ static readonly ctlKey: string;
8
+ protected static driver: WebDriver;
9
+ protected static locators: Locators;
10
+ protected static versionInfo: {
11
+ version: string;
12
+ browser: string;
13
+ };
14
+ protected enclosingItem: WebElement;
15
+ /**
16
+ * Constructs a new element from a Locator or an existing WebElement
17
+ * @param base WebDriver compatible Locator for the given element or a reference to an existing WeBelement
18
+ * @param enclosingItem Locator or a WebElement reference to an element containing the element being constructed
19
+ * this will be used to narrow down the search for the underlying DOM element
20
+ */
21
+ constructor(base: Locator | WebElement, enclosingItem?: WebElement | Locator);
22
+ isEnabled(): Promise<boolean>;
23
+ isSelected(): Promise<boolean>;
24
+ /**
25
+ * Wait for the element to become visible
26
+ * @param timeout custom timeout for the wait
27
+ * @returns thenable self reference
28
+ */
29
+ wait(timeout?: number): Promise<this>;
30
+ /**
31
+ * Return a reference to the WebElement containing this element
32
+ */
33
+ getEnclosingElement(): WebElement;
34
+ static init(locators: Locators, driver: WebDriver, browser: string, version: string): void;
35
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractElement = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ /**
6
+ * Default wrapper for webelement
7
+ */
8
+ class AbstractElement extends selenium_webdriver_1.WebElement {
9
+ static ctlKey = process.platform === 'darwin' ? selenium_webdriver_1.Key.COMMAND : selenium_webdriver_1.Key.CONTROL;
10
+ static driver;
11
+ static locators;
12
+ static versionInfo;
13
+ enclosingItem;
14
+ /**
15
+ * Constructs a new element from a Locator or an existing WebElement
16
+ * @param base WebDriver compatible Locator for the given element or a reference to an existing WeBelement
17
+ * @param enclosingItem Locator or a WebElement reference to an element containing the element being constructed
18
+ * this will be used to narrow down the search for the underlying DOM element
19
+ */
20
+ constructor(base, enclosingItem) {
21
+ let item = AbstractElement.driver.findElement(selenium_webdriver_1.By.css('html'));
22
+ if (!enclosingItem) {
23
+ enclosingItem = item;
24
+ }
25
+ if (enclosingItem instanceof selenium_webdriver_1.WebElement) {
26
+ item = enclosingItem;
27
+ }
28
+ else {
29
+ item = AbstractElement.driver.findElement(enclosingItem);
30
+ }
31
+ if (base instanceof selenium_webdriver_1.WebElement) {
32
+ super(AbstractElement.driver, base.getId());
33
+ }
34
+ else {
35
+ let toFind = item.findElement(base);
36
+ let id = toFind.getId();
37
+ super(AbstractElement.driver, id);
38
+ }
39
+ this.enclosingItem = item;
40
+ }
41
+ async isEnabled() {
42
+ return await super.isEnabled() && await AbstractElement.locators.AbstractElement.enabled(this);
43
+ }
44
+ async isSelected() {
45
+ return await super.isSelected() && await AbstractElement.locators.AbstractElement.selected(this);
46
+ }
47
+ /**
48
+ * Wait for the element to become visible
49
+ * @param timeout custom timeout for the wait
50
+ * @returns thenable self reference
51
+ */
52
+ async wait(timeout = 5000) {
53
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(this), timeout);
54
+ return this;
55
+ }
56
+ /**
57
+ * Return a reference to the WebElement containing this element
58
+ */
59
+ getEnclosingElement() {
60
+ return this.enclosingItem;
61
+ }
62
+ static init(locators, driver, browser, version) {
63
+ AbstractElement.locators = locators;
64
+ AbstractElement.driver = driver;
65
+ AbstractElement.versionInfo = { version: version, browser: browser };
66
+ }
67
+ }
68
+ exports.AbstractElement = AbstractElement;
69
+ //# sourceMappingURL=AbstractElement.js.map
@@ -0,0 +1,11 @@
1
+ import { AbstractElement } from "./AbstractElement";
2
+ import { ContextMenu } from "..";
3
+ /**
4
+ * Abstract element that has a context menu
5
+ */
6
+ export declare abstract class ElementWithContexMenu extends AbstractElement {
7
+ /**
8
+ * Open context menu on the element
9
+ */
10
+ openContextMenu(): Promise<ContextMenu>;
11
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ElementWithContexMenu = void 0;
4
+ const AbstractElement_1 = require("./AbstractElement");
5
+ const __1 = require("..");
6
+ const selenium_webdriver_1 = require("selenium-webdriver");
7
+ /**
8
+ * Abstract element that has a context menu
9
+ */
10
+ class ElementWithContexMenu extends AbstractElement_1.AbstractElement {
11
+ /**
12
+ * Open context menu on the element
13
+ */
14
+ async openContextMenu() {
15
+ const workbench = await this.getDriver().findElement(ElementWithContexMenu.locators.Workbench.constructor);
16
+ const menus = await workbench.findElements(ElementWithContexMenu.locators.ContextMenu.contextView);
17
+ if (menus.length < 1) {
18
+ await this.getDriver().actions().contextClick(this).perform();
19
+ await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(ElementWithContexMenu.locators.ContextMenu.contextView), 2000);
20
+ return new __1.ContextMenu(workbench).wait();
21
+ }
22
+ else if ((await workbench.findElements(ElementWithContexMenu.locators.ContextMenu.viewBlock)).length > 0) {
23
+ await this.getDriver().actions().contextClick(this).perform();
24
+ try {
25
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(this), 1000);
26
+ }
27
+ catch (err) {
28
+ if (!(err instanceof selenium_webdriver_1.error.StaleElementReferenceError)) {
29
+ throw err;
30
+ }
31
+ }
32
+ }
33
+ await this.getDriver().actions().contextClick(this).perform();
34
+ return new __1.ContextMenu(workbench).wait();
35
+ }
36
+ }
37
+ exports.ElementWithContexMenu = ElementWithContexMenu;
38
+ //# sourceMappingURL=ElementWithContextMenu.js.map
@@ -0,0 +1,29 @@
1
+ import { Locator, WebElement } from "selenium-webdriver";
2
+ import { AbstractElement } from "./AbstractElement";
3
+ /**
4
+ * Heavily inspired by https://stackoverflow.com/a/65418734
5
+ */
6
+ type Constructor<T = {}> = new (...args: any[]) => T;
7
+ /**
8
+ * The interface that a class is required to have in order to use the Webview mixin.
9
+ */
10
+ interface WebviewMixable extends AbstractElement {
11
+ getViewToSwitchTo(handle: string): Promise<WebElement | undefined>;
12
+ }
13
+ /**
14
+ * The interface that is exposed by applying this mixin.
15
+ */
16
+ export interface WebviewMixinType {
17
+ findWebElement(locator: Locator): Promise<WebElement>;
18
+ findWebElements(locator: Locator): Promise<WebElement[]>;
19
+ switchToFrame(timeout?: number): Promise<void>;
20
+ switchBack(): Promise<void>;
21
+ }
22
+ /**
23
+ * Returns a class that has the ability to access a webview.
24
+ *
25
+ * @param Base the class to mixin
26
+ * @returns a class that has the ability to access a webview
27
+ */
28
+ export default function <TBase extends Constructor<WebviewMixable>>(Base: TBase): Constructor<InstanceType<TBase> & WebviewMixinType>;
29
+ export {};
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const selenium_webdriver_1 = require("selenium-webdriver");
4
+ const AbstractElement_1 = require("./AbstractElement");
5
+ /**
6
+ * Returns a class that has the ability to access a webview.
7
+ *
8
+ * @param Base the class to mixin
9
+ * @returns a class that has the ability to access a webview
10
+ */
11
+ function default_1(Base) {
12
+ return class extends Base {
13
+ /**
14
+ * Cannot use static element, since this class is unnamed.
15
+ */
16
+ handle;
17
+ /**
18
+ * Search for an element inside the webview iframe.
19
+ * Requires webdriver being switched to the webview iframe first.
20
+ * (Will attempt to search from the main DOM root otherwise)
21
+ *
22
+ * @param locator webdriver locator to search by
23
+ * @returns promise resolving to WebElement when found
24
+ */
25
+ async findWebElement(locator) {
26
+ return await this.getDriver().findElement(locator);
27
+ }
28
+ /**
29
+ * Search for all element inside the webview iframe by a given locator
30
+ * Requires webdriver being switched to the webview iframe first.
31
+ * (Will attempt to search from the main DOM root otherwise)
32
+ *
33
+ * @param locator webdriver locator to search by
34
+ * @returns promise resolving to a list of WebElement objects
35
+ */
36
+ async findWebElements(locator) {
37
+ return await this.getDriver().findElements(locator);
38
+ }
39
+ /**
40
+ * Switch the underlying webdriver context to the webview iframe.
41
+ * This allows using the findWebElement methods.
42
+ * Note that only elements inside the webview iframe will be accessible.
43
+ * Use the switchBack method to switch to the original context.
44
+ */
45
+ async switchToFrame(timeout = 5000) {
46
+ if (!this.handle) {
47
+ this.handle = await this.getDriver().getWindowHandle();
48
+ }
49
+ const view = await this.getViewToSwitchTo(this.handle);
50
+ if (!view) {
51
+ return;
52
+ }
53
+ await this.getDriver().switchTo().frame(view);
54
+ await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(AbstractElement_1.AbstractElement.locators.WebView.activeFrame), timeout);
55
+ const frame = await this.getDriver().findElement(AbstractElement_1.AbstractElement.locators.WebView.activeFrame);
56
+ await this.getDriver().switchTo().frame(frame);
57
+ }
58
+ /**
59
+ * Switch the underlying webdriver back to the original window
60
+ */
61
+ async switchBack() {
62
+ if (!this.handle) {
63
+ this.handle = await this.getDriver().getWindowHandle();
64
+ }
65
+ return await this.getDriver().switchTo().window(this.handle);
66
+ }
67
+ };
68
+ }
69
+ exports.default = default_1;
70
+ //# sourceMappingURL=WebviewMixin.js.map
@@ -0,0 +1,18 @@
1
+ import { WebElement } from "selenium-webdriver";
2
+ import { ActivityBar, ContextMenu } from "../..";
3
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
4
+ /**
5
+ * Page object representing the global action controls on the bottom of the action bar
6
+ */
7
+ export declare class ActionsControl extends ElementWithContexMenu {
8
+ constructor(element: WebElement, bar: ActivityBar);
9
+ /**
10
+ * Open the context menu bound to this global action
11
+ * @returns Promise resolving to ContextMenu object representing the action's menu
12
+ */
13
+ openActionMenu(): Promise<ContextMenu>;
14
+ /**
15
+ * Returns the title of the associated action
16
+ */
17
+ getTitle(): Promise<string>;
18
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionsControl = void 0;
4
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
5
+ /**
6
+ * Page object representing the global action controls on the bottom of the action bar
7
+ */
8
+ class ActionsControl extends ElementWithContextMenu_1.ElementWithContexMenu {
9
+ constructor(element, bar) {
10
+ super(element, bar);
11
+ }
12
+ /**
13
+ * Open the context menu bound to this global action
14
+ * @returns Promise resolving to ContextMenu object representing the action's menu
15
+ */
16
+ async openActionMenu() {
17
+ return await this.openContextMenu();
18
+ }
19
+ /**
20
+ * Returns the title of the associated action
21
+ */
22
+ async getTitle() {
23
+ return await this.getAttribute('aria-label');
24
+ }
25
+ }
26
+ exports.ActionsControl = ActionsControl;
27
+ //# sourceMappingURL=ActionsControl.js.map
@@ -0,0 +1,30 @@
1
+ import { ActionsControl, ViewControl } from "../..";
2
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
3
+ /**
4
+ * Page object representing the left side activity bar in VS Code
5
+ */
6
+ export declare class ActivityBar extends ElementWithContexMenu {
7
+ constructor();
8
+ /**
9
+ * Find all view containers displayed in the activity bar
10
+ * @returns Promise resolving to array of ViewControl objects
11
+ */
12
+ getViewControls(): Promise<ViewControl[]>;
13
+ /**
14
+ * Find a view container with a given title
15
+ * @param name title of the view
16
+ * @returns Promise resolving to ViewControl object representing the view selector, undefined if not found
17
+ */
18
+ getViewControl(name: string): Promise<ViewControl | undefined>;
19
+ /**
20
+ * Find all global action controls displayed on the bottom of the activity bar
21
+ * @returns Promise resolving to array of ActionsControl objects
22
+ */
23
+ getGlobalActions(): Promise<ActionsControl[]>;
24
+ /**
25
+ * Find an action control with a given title
26
+ * @param name title of the global action
27
+ * @returns Promise resolving to ActionsControl object representing the action selector, undefined if not found
28
+ */
29
+ getGlobalAction(name: string): Promise<ActionsControl | undefined>;
30
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivityBar = void 0;
4
+ const __1 = require("../..");
5
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
6
+ /**
7
+ * Page object representing the left side activity bar in VS Code
8
+ */
9
+ class ActivityBar extends ElementWithContextMenu_1.ElementWithContexMenu {
10
+ constructor() {
11
+ super(ActivityBar.locators.ActivityBar.constructor, ActivityBar.locators.Workbench.constructor);
12
+ }
13
+ /**
14
+ * Find all view containers displayed in the activity bar
15
+ * @returns Promise resolving to array of ViewControl objects
16
+ */
17
+ async getViewControls() {
18
+ const views = [];
19
+ const viewContainer = await this.findElement(ActivityBar.locators.ActivityBar.viewContainer);
20
+ for (const element of await viewContainer.findElements(ActivityBar.locators.ActivityBar.actionItem)) {
21
+ views.push(await new __1.ViewControl(element, this).wait());
22
+ }
23
+ return views;
24
+ }
25
+ /**
26
+ * Find a view container with a given title
27
+ * @param name title of the view
28
+ * @returns Promise resolving to ViewControl object representing the view selector, undefined if not found
29
+ */
30
+ async getViewControl(name) {
31
+ const controls = await this.getViewControls();
32
+ const names = await Promise.all(controls.map(async (item) => {
33
+ return await item.getTitle();
34
+ }));
35
+ const index = names.findIndex((value) => value.indexOf(name) > -1);
36
+ if (index > -1) {
37
+ return controls[index];
38
+ }
39
+ return undefined;
40
+ }
41
+ /**
42
+ * Find all global action controls displayed on the bottom of the activity bar
43
+ * @returns Promise resolving to array of ActionsControl objects
44
+ */
45
+ async getGlobalActions() {
46
+ const actions = [];
47
+ const actionContainer = await this.findElement(ActivityBar.locators.ActivityBar.actionsContainer);
48
+ for (const element of await actionContainer.findElements(ActivityBar.locators.ActivityBar.actionItem)) {
49
+ actions.push(await new __1.ActionsControl(element, this).wait());
50
+ }
51
+ return actions;
52
+ }
53
+ /**
54
+ * Find an action control with a given title
55
+ * @param name title of the global action
56
+ * @returns Promise resolving to ActionsControl object representing the action selector, undefined if not found
57
+ */
58
+ async getGlobalAction(name) {
59
+ const actions = await this.getGlobalActions();
60
+ const names = await Promise.all(actions.map(async (item) => {
61
+ return await item.getTitle();
62
+ }));
63
+ const index = names.findIndex((value) => value.indexOf(name) > -1);
64
+ if (index > -1) {
65
+ return actions[index];
66
+ }
67
+ return undefined;
68
+ }
69
+ }
70
+ exports.ActivityBar = ActivityBar;
71
+ //# sourceMappingURL=ActivityBar.js.map
@@ -0,0 +1,23 @@
1
+ import { ActivityBar, SideBarView } from "../..";
2
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
3
+ import { WebElement } from "selenium-webdriver";
4
+ /**
5
+ * Page object representing a view container item in the activity bar
6
+ */
7
+ export declare class ViewControl extends ElementWithContexMenu {
8
+ constructor(element: WebElement, bar: ActivityBar);
9
+ /**
10
+ * Opens the associated view if not already open
11
+ * @returns Promise resolving to SideBarView object representing the opened view
12
+ */
13
+ openView(): Promise<SideBarView>;
14
+ /**
15
+ * Closes the associated view if not already closed
16
+ * @returns Promise resolving when the view closes
17
+ */
18
+ closeView(): Promise<void>;
19
+ /**
20
+ * Returns the title of the associated view
21
+ */
22
+ getTitle(): Promise<string>;
23
+ }