@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,35 @@
1
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
2
+ import { AbstractElement } from "../AbstractElement";
3
+ import { By, SideBarView } from "../..";
4
+ /**
5
+ * Page object representing the top (title) part of a side bar view
6
+ */
7
+ export declare class ViewTitlePart extends ElementWithContexMenu {
8
+ constructor(view?: SideBarView);
9
+ /**
10
+ * Returns the displayed title of the view
11
+ * @returns Promise resolving to displayed title
12
+ */
13
+ getTitle(): Promise<string>;
14
+ /**
15
+ * Finds action buttons inside the view title part
16
+ * @returns Promise resolving to array of TitleActionButton objects
17
+ */
18
+ getActions(): Promise<TitleActionButton[]>;
19
+ /**
20
+ * Finds an action button by title
21
+ * @param title title of the button to search for
22
+ * @returns Promise resolving to TitleActionButton object
23
+ */
24
+ getAction(title: string): Promise<TitleActionButton>;
25
+ }
26
+ /**
27
+ * Page object representing a button inside the view title part
28
+ */
29
+ export declare class TitleActionButton extends AbstractElement {
30
+ constructor(actionConstructor: By, viewTitle: ViewTitlePart);
31
+ /**
32
+ * Get title of the button
33
+ */
34
+ getTitle(): Promise<string>;
35
+ }
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TitleActionButton = exports.ViewTitlePart = void 0;
4
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const __1 = require("../..");
7
+ /**
8
+ * Page object representing the top (title) part of a side bar view
9
+ */
10
+ class ViewTitlePart extends ElementWithContextMenu_1.ElementWithContexMenu {
11
+ constructor(view = new __1.SideBarView()) {
12
+ super(ViewTitlePart.locators.ViewTitlePart.constructor, view);
13
+ }
14
+ /**
15
+ * Returns the displayed title of the view
16
+ * @returns Promise resolving to displayed title
17
+ */
18
+ async getTitle() {
19
+ return await this.findElement(ViewTitlePart.locators.ViewTitlePart.title).getText();
20
+ }
21
+ /**
22
+ * Finds action buttons inside the view title part
23
+ * @returns Promise resolving to array of TitleActionButton objects
24
+ */
25
+ async getActions() {
26
+ const actions = [];
27
+ const elements = await this.findElements(ViewTitlePart.locators.ViewTitlePart.action);
28
+ for (const element of elements) {
29
+ const title = await element.getAttribute(ViewTitlePart.locators.ViewTitlePart.actionLabel);
30
+ actions.push(await new TitleActionButton(TitleActionButton.locators.ViewTitlePart.actionConstructor(title), this).wait());
31
+ }
32
+ return actions;
33
+ }
34
+ /**
35
+ * Finds an action button by title
36
+ * @param title title of the button to search for
37
+ * @returns Promise resolving to TitleActionButton object
38
+ */
39
+ async getAction(title) {
40
+ return new TitleActionButton(TitleActionButton.locators.ViewTitlePart.actionConstructor(title), this);
41
+ }
42
+ }
43
+ exports.ViewTitlePart = ViewTitlePart;
44
+ /**
45
+ * Page object representing a button inside the view title part
46
+ */
47
+ class TitleActionButton extends AbstractElement_1.AbstractElement {
48
+ constructor(actionConstructor, viewTitle) {
49
+ super(actionConstructor, viewTitle);
50
+ }
51
+ /**
52
+ * Get title of the button
53
+ */
54
+ async getTitle() {
55
+ return await this.getAttribute(TitleActionButton.locators.ViewTitlePart.actionLabel);
56
+ }
57
+ }
58
+ exports.TitleActionButton = TitleActionButton;
59
+ //# sourceMappingURL=ViewTitlePart.js.map
@@ -0,0 +1,47 @@
1
+ import { WebElement } from "selenium-webdriver";
2
+ import { AbstractElement } from "../AbstractElement";
3
+ import { ViewSection } from "../..";
4
+ /**
5
+ * A button that appears in the welcome content and can be clicked to execute a command.
6
+ *
7
+ * To execute the command bound to this button simply run: `await button.click();`.
8
+ */
9
+ export declare class WelcomeContentButton extends AbstractElement {
10
+ /**
11
+ * @param panel The panel containing the button in the welcome section
12
+ * @param welcomeSection The enclosing welcome section
13
+ */
14
+ constructor(panel: WebElement, welcomeSection: WelcomeContentSection);
15
+ /** Return the title displayed on this button */
16
+ getTitle(): Promise<string>;
17
+ }
18
+ /**
19
+ * A section in an empty custom view, see:
20
+ * https://code.visualstudio.com/api/extension-guides/tree-view#welcome-content
21
+ *
22
+ * The welcome section contains two types of elements: text entries and buttons that can be bound to commands.
23
+ * The text sections can be accessed via [[getTextSections]], the buttons on the
24
+ * other hand via [[getButtons]].
25
+ * This however looses the information of the order of the buttons and lines
26
+ * with respect to each other. This can be remedied by using [[getContents]],
27
+ * which returns both in the order that they are found (at the expense, that you
28
+ * now must use typechecks to find out what you got).
29
+ */
30
+ export declare class WelcomeContentSection extends AbstractElement {
31
+ /**
32
+ * @param panel The panel containing the welcome content.
33
+ * @param parent The webelement in which the welcome content is embedded.
34
+ */
35
+ constructor(panel: WebElement, parent: ViewSection);
36
+ /**
37
+ * Combination of [[getButtons]] and [[getTextSections]]: returns all entries in the welcome view in the order that they appear.
38
+ */
39
+ getContents(): Promise<(WelcomeContentButton | string)[]>;
40
+ /** Finds all buttons in the welcome content */
41
+ getButtons(): Promise<WelcomeContentButton[]>;
42
+ /**
43
+ * Finds all text entries in the welcome content and returns each line as an
44
+ * element in an array.
45
+ */
46
+ getTextSections(): Promise<string[]>;
47
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WelcomeContentSection = exports.WelcomeContentButton = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ /**
6
+ * A button that appears in the welcome content and can be clicked to execute a command.
7
+ *
8
+ * To execute the command bound to this button simply run: `await button.click();`.
9
+ */
10
+ class WelcomeContentButton extends AbstractElement_1.AbstractElement {
11
+ /**
12
+ * @param panel The panel containing the button in the welcome section
13
+ * @param welcomeSection The enclosing welcome section
14
+ */
15
+ constructor(panel, welcomeSection) {
16
+ super(panel, welcomeSection);
17
+ }
18
+ /** Return the title displayed on this button */
19
+ async getTitle() {
20
+ return await this.getText();
21
+ }
22
+ }
23
+ exports.WelcomeContentButton = WelcomeContentButton;
24
+ /**
25
+ * A section in an empty custom view, see:
26
+ * https://code.visualstudio.com/api/extension-guides/tree-view#welcome-content
27
+ *
28
+ * The welcome section contains two types of elements: text entries and buttons that can be bound to commands.
29
+ * The text sections can be accessed via [[getTextSections]], the buttons on the
30
+ * other hand via [[getButtons]].
31
+ * This however looses the information of the order of the buttons and lines
32
+ * with respect to each other. This can be remedied by using [[getContents]],
33
+ * which returns both in the order that they are found (at the expense, that you
34
+ * now must use typechecks to find out what you got).
35
+ */
36
+ class WelcomeContentSection extends AbstractElement_1.AbstractElement {
37
+ /**
38
+ * @param panel The panel containing the welcome content.
39
+ * @param parent The webelement in which the welcome content is embedded.
40
+ */
41
+ constructor(panel, parent) {
42
+ super(panel, parent);
43
+ }
44
+ /**
45
+ * Combination of [[getButtons]] and [[getTextSections]]: returns all entries in the welcome view in the order that they appear.
46
+ */
47
+ async getContents() {
48
+ const elements = await this.findElements(WelcomeContentSection.locators.WelcomeContent.buttonOrText);
49
+ return Promise.all(elements.map(async (e) => {
50
+ const tagName = await e.getTagName();
51
+ if (tagName === "p") {
52
+ return await e.getText();
53
+ }
54
+ else {
55
+ return new WelcomeContentButton(e, this);
56
+ }
57
+ }));
58
+ }
59
+ /** Finds all buttons in the welcome content */
60
+ async getButtons() {
61
+ return (await this.findElements(WelcomeContentSection.locators.WelcomeContent.button)).map((elem) => new WelcomeContentButton(elem, this));
62
+ }
63
+ /**
64
+ * Finds all text entries in the welcome content and returns each line as an
65
+ * element in an array.
66
+ */
67
+ async getTextSections() {
68
+ return await Promise.all((await this.findElements(WelcomeContentSection.locators.WelcomeContent.text)).map(async (elem) => await elem.getText()));
69
+ }
70
+ }
71
+ exports.WelcomeContentSection = WelcomeContentSection;
72
+ //# sourceMappingURL=WelcomeContent.js.map
@@ -0,0 +1,33 @@
1
+ import { SideBarView } from "../SideBarView";
2
+ import { DebugBreakpointSection } from "../tree/debug/DebugBreakpointSection";
3
+ import { DebugVariableSection } from "../tree/debug/DebugVariablesSection";
4
+ /**
5
+ * Page object representing the Run/Debug view in the side bar
6
+ */
7
+ export declare class DebugView extends SideBarView {
8
+ /**
9
+ * Get the title of the selected launch configuration
10
+ * @returns Promise resolving to the title
11
+ */
12
+ getLaunchConfiguration(): Promise<string>;
13
+ /**
14
+ * Get titles of all available launch configurations
15
+ * @returns Promise resolving to list of titles
16
+ */
17
+ getLaunchConfigurations(): Promise<string[]>;
18
+ getVariablesSection(): Promise<DebugVariableSection>;
19
+ /**
20
+ * Get section which holds information about breakpoints.
21
+ * @returns DebugBreakpointSection page object
22
+ */
23
+ getBreakpointSection(): Promise<DebugBreakpointSection>;
24
+ /**
25
+ * Select a given launch configuration
26
+ * @param title title of the configuration to select
27
+ */
28
+ selectLaunchConfiguration(title: string): Promise<void>;
29
+ /**
30
+ * Start Debugging using the current launch configuration
31
+ */
32
+ start(): Promise<void>;
33
+ }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DebugView = void 0;
4
+ const SideBarView_1 = require("../SideBarView");
5
+ const DebugBreakpointSection_1 = require("../tree/debug/DebugBreakpointSection");
6
+ const DebugVariablesSection_1 = require("../tree/debug/DebugVariablesSection");
7
+ /**
8
+ * Page object representing the Run/Debug view in the side bar
9
+ */
10
+ class DebugView extends SideBarView_1.SideBarView {
11
+ /**
12
+ * Get the title of the selected launch configuration
13
+ * @returns Promise resolving to the title
14
+ */
15
+ async getLaunchConfiguration() {
16
+ if (DebugView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') {
17
+ throw Error(`The 'DebugView.getLaunchConfiguration' method is broken! Read more information in 'Known Issues > Limitations in testing with VS Code 1.87+' - https://github.com/microsoft/vscode/issues/206897.`);
18
+ }
19
+ const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
20
+ const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
21
+ return await combo.getAttribute('title');
22
+ }
23
+ /**
24
+ * Get titles of all available launch configurations
25
+ * @returns Promise resolving to list of titles
26
+ */
27
+ async getLaunchConfigurations() {
28
+ const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
29
+ const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
30
+ const configs = [];
31
+ const options = await combo.findElements(DebugView.locators.DebugView.launchOption);
32
+ for (const option of options) {
33
+ if (await option.isEnabled()) {
34
+ configs.push(await option.getAttribute('value'));
35
+ }
36
+ }
37
+ return configs;
38
+ }
39
+ async getVariablesSection() {
40
+ const content = this.getContent();
41
+ return content.getSection(DebugVariablesSection_1.DebugVariableSection.locators.DebugVariableSection.predicate, DebugVariablesSection_1.DebugVariableSection);
42
+ }
43
+ /**
44
+ * Get section which holds information about breakpoints.
45
+ * @returns DebugBreakpointSection page object
46
+ */
47
+ async getBreakpointSection() {
48
+ const content = this.getContent();
49
+ return content.getSection(DebugBreakpointSection_1.DebugBreakpointSection.locators.DebugBreakpointSection.predicate, DebugBreakpointSection_1.DebugBreakpointSection);
50
+ }
51
+ /**
52
+ * Select a given launch configuration
53
+ * @param title title of the configuration to select
54
+ */
55
+ async selectLaunchConfiguration(title) {
56
+ const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
57
+ const combo = await action.findElement(DebugView.locators.DebugView.launchSelect);
58
+ const option = await combo.findElement(DebugView.locators.DebugView.optionByName(title));
59
+ await option.click();
60
+ }
61
+ /**
62
+ * Start Debugging using the current launch configuration
63
+ */
64
+ async start() {
65
+ const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
66
+ await action.findElement(DebugView.locators.DebugView.startButton).click();
67
+ }
68
+ }
69
+ exports.DebugView = DebugView;
70
+ //# sourceMappingURL=DebugView.js.map
@@ -0,0 +1,48 @@
1
+ import { ViewItem } from "../ViewItem";
2
+ import { WebElement } from "selenium-webdriver";
3
+ import { ContextMenu } from "../../menu/ContextMenu";
4
+ import { ExtensionsViewSection } from "./ExtensionsViewSection";
5
+ /**
6
+ * Page object representing an extension in the extensions view
7
+ */
8
+ export declare class ExtensionsViewItem extends ViewItem {
9
+ constructor(extensionElement: WebElement, section: ExtensionsViewSection);
10
+ /**
11
+ * Get title of the extension
12
+ */
13
+ getTitle(): Promise<string>;
14
+ /**
15
+ * Get version of the extension
16
+ * @returns Promise resolving to version string
17
+ */
18
+ getVersion(): Promise<string>;
19
+ /**
20
+ * Get the author of the extension
21
+ * @returns Promise resolving to displayed author
22
+ */
23
+ getAuthor(): Promise<string>;
24
+ /**
25
+ * Get the description of the extension
26
+ * @returns Promise resolving to description
27
+ */
28
+ getDescription(): Promise<string>;
29
+ /**
30
+ * Find if the extension is installed
31
+ * @returns Promise resolving to true/false
32
+ */
33
+ isInstalled(): Promise<boolean>;
34
+ /**
35
+ * Open the management context menu if the extension is installed
36
+ * @returns Promise resolving to ContextMenu object
37
+ */
38
+ manage(): Promise<ContextMenu>;
39
+ /**
40
+ * Install the extension if not installed already.
41
+ *
42
+ * Will wait for the extension to finish installing. To skip the wait, set timeout to 0.
43
+ *
44
+ * @param timeout timeout to wait for the installation in milliseconds, default unlimited, set to 0 to skip waiting
45
+ * @returns Promise resolving when the installation finishes or is skipped
46
+ */
47
+ install(timeout?: number): Promise<void>;
48
+ }
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtensionsViewItem = void 0;
4
+ const ViewItem_1 = require("../ViewItem");
5
+ const selenium_webdriver_1 = require("selenium-webdriver");
6
+ /**
7
+ * Page object representing an extension in the extensions view
8
+ */
9
+ class ExtensionsViewItem extends ViewItem_1.ViewItem {
10
+ constructor(extensionElement, section) {
11
+ super(extensionElement, section);
12
+ }
13
+ /**
14
+ * Get title of the extension
15
+ */
16
+ async getTitle() {
17
+ const title = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewSection.itemTitle);
18
+ return await title.getText();
19
+ }
20
+ /**
21
+ * Get version of the extension
22
+ * @returns Promise resolving to version string
23
+ */
24
+ async getVersion() {
25
+ const version = await this.findElements(ExtensionsViewItem.locators.ExtensionsViewItem.version);
26
+ if (version.length > 0) {
27
+ return await version[0].getText();
28
+ }
29
+ const label = await this.getAttribute('aria-label');
30
+ const ver = label.split(',')[1].trim();
31
+ return ver;
32
+ }
33
+ /**
34
+ * Get the author of the extension
35
+ * @returns Promise resolving to displayed author
36
+ */
37
+ async getAuthor() {
38
+ const author = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.author);
39
+ return await author.getText();
40
+ }
41
+ /**
42
+ * Get the description of the extension
43
+ * @returns Promise resolving to description
44
+ */
45
+ async getDescription() {
46
+ const description = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.description);
47
+ return await description.getText();
48
+ }
49
+ /**
50
+ * Find if the extension is installed
51
+ * @returns Promise resolving to true/false
52
+ */
53
+ async isInstalled() {
54
+ const button = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.install);
55
+ if ((await button.getAttribute('class')).indexOf('disabled') > -1) {
56
+ return true;
57
+ }
58
+ return false;
59
+ }
60
+ /**
61
+ * Open the management context menu if the extension is installed
62
+ * @returns Promise resolving to ContextMenu object
63
+ */
64
+ async manage() {
65
+ await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(ExtensionsViewItem.locators.ExtensionsViewItem.manage), 1000);
66
+ const button = await this.enclosingItem.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.manage);
67
+ if ((await button.getAttribute('class')).indexOf('disabled') > -1) {
68
+ throw new Error(`Extension '${await this.getTitle()}' is not installed`);
69
+ }
70
+ return await this.openContextMenu();
71
+ }
72
+ /**
73
+ * Install the extension if not installed already.
74
+ *
75
+ * Will wait for the extension to finish installing. To skip the wait, set timeout to 0.
76
+ *
77
+ * @param timeout timeout to wait for the installation in milliseconds, default unlimited, set to 0 to skip waiting
78
+ * @returns Promise resolving when the installation finishes or is skipped
79
+ */
80
+ async install(timeout = 300000) {
81
+ if (await this.isInstalled()) {
82
+ return;
83
+ }
84
+ const button = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.install);
85
+ const manage = await this.findElement(ExtensionsViewItem.locators.ExtensionsViewItem.manage);
86
+ await button.click();
87
+ if (timeout > 0) {
88
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(manage), timeout);
89
+ }
90
+ }
91
+ }
92
+ exports.ExtensionsViewItem = ExtensionsViewItem;
93
+ //# sourceMappingURL=ExtensionsViewItem.js.map
@@ -0,0 +1,33 @@
1
+ import { ViewSection } from "../ViewSection";
2
+ import { ExtensionsViewItem } from "./ExtensionsViewItem";
3
+ /**
4
+ * View section containing extensions
5
+ */
6
+ export declare class ExtensionsViewSection extends ViewSection {
7
+ getVisibleItems(): Promise<ExtensionsViewItem[]>;
8
+ /**
9
+ * Search for an extension by title. This utilizes the search bar
10
+ * in the Extensions view, which switches the perspective to the
11
+ * section representing the chosen category and temporarily hides all other sections.
12
+ * If you wish to continue working with the initial view section
13
+ * (i.e. Enabled), use the clearSearch method to reset it back to default
14
+ *
15
+ * @param title title to search for in '@category name' format,
16
+ * e.g '@installed extension'. If no @category is present, marketplace will be searched
17
+ *
18
+ * @returns Promise resolving to ExtensionsViewItem if such item exists, undefined otherwise
19
+ */
20
+ findItem(title: string): Promise<ExtensionsViewItem | undefined>;
21
+ /**
22
+ * Clears the search bar on top of the view
23
+ * @returns Promise resolving when the search box is cleared
24
+ */
25
+ clearSearch(): Promise<void>;
26
+ /**
27
+ * Find and open an extension item
28
+ * @param title title of the extension
29
+ * @returns Promise resolving when the item is clicked
30
+ */
31
+ openItem(title: string): Promise<never[]>;
32
+ private getSectionForCategory;
33
+ }
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExtensionsViewSection = void 0;
4
+ const ViewSection_1 = require("../ViewSection");
5
+ const ExtensionsViewItem_1 = require("./ExtensionsViewItem");
6
+ const selenium_webdriver_1 = require("selenium-webdriver");
7
+ /**
8
+ * Categories of extensions to search for
9
+ */
10
+ var ExtensionCategory;
11
+ (function (ExtensionCategory) {
12
+ ExtensionCategory["Installed"] = "@installed";
13
+ ExtensionCategory["Enabled"] = "@enabled";
14
+ ExtensionCategory["Disabled"] = "@disabled";
15
+ ExtensionCategory["Outdated"] = "@outdated";
16
+ ExtensionCategory["Recommended"] = "@recommended";
17
+ })(ExtensionCategory || (ExtensionCategory = {}));
18
+ /**
19
+ * View section containing extensions
20
+ */
21
+ class ExtensionsViewSection extends ViewSection_1.ViewSection {
22
+ async getVisibleItems() {
23
+ const extensionTable = await this.findElement(ExtensionsViewSection.locators.ExtensionsViewSection.items);
24
+ const extensionRows = await extensionTable.findElements(ExtensionsViewSection.locators.ExtensionsViewSection.itemRow);
25
+ return await Promise.all(extensionRows.map(async (row) => new ExtensionsViewItem_1.ExtensionsViewItem(row, this).wait()));
26
+ }
27
+ /**
28
+ * Search for an extension by title. This utilizes the search bar
29
+ * in the Extensions view, which switches the perspective to the
30
+ * section representing the chosen category and temporarily hides all other sections.
31
+ * If you wish to continue working with the initial view section
32
+ * (i.e. Enabled), use the clearSearch method to reset it back to default
33
+ *
34
+ * @param title title to search for in '@category name' format,
35
+ * e.g '@installed extension'. If no @category is present, marketplace will be searched
36
+ *
37
+ * @returns Promise resolving to ExtensionsViewItem if such item exists, undefined otherwise
38
+ */
39
+ async findItem(title) {
40
+ await this.clearSearch();
41
+ const progress = await this.enclosingItem.findElement(ExtensionsViewSection.locators.ViewContent.progress);
42
+ const searchField = await this.enclosingItem.findElement(ExtensionsViewSection.locators.ExtensionsViewSection.searchBox);
43
+ await searchField.sendKeys(title);
44
+ try {
45
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(progress), 1000);
46
+ }
47
+ catch (err) {
48
+ if (err.name !== "TimeoutError") {
49
+ throw err;
50
+ }
51
+ }
52
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(progress));
53
+ const parent = this.enclosingItem;
54
+ let sectionTitle = this.getSectionForCategory(title);
55
+ const section = await parent.getSection(sectionTitle);
56
+ const titleParts = title.split(' ');
57
+ if (titleParts[0].startsWith('@')) {
58
+ title = titleParts.slice(1).join(' ');
59
+ }
60
+ const extensions = await section.getVisibleItems();
61
+ for (const extension of extensions) {
62
+ if (await extension.getTitle() === title) {
63
+ return extension;
64
+ }
65
+ }
66
+ return undefined;
67
+ }
68
+ /**
69
+ * Clears the search bar on top of the view
70
+ * @returns Promise resolving when the search box is cleared
71
+ */
72
+ async clearSearch() {
73
+ const progress = await this.enclosingItem.findElement(ExtensionsViewSection.locators.ViewContent.progress);
74
+ const searchField = await this.enclosingItem.findElement(ExtensionsViewSection.locators.ExtensionsViewSection.searchBox);
75
+ const textField = await this.enclosingItem.findElement(ExtensionsViewSection.locators.ExtensionsViewSection.textContainer);
76
+ try {
77
+ await textField.findElement(ExtensionsViewSection.locators.ExtensionsViewSection.textField);
78
+ await searchField.sendKeys(selenium_webdriver_1.Key.chord(ExtensionsViewItem_1.ExtensionsViewItem.ctlKey, 'a'), selenium_webdriver_1.Key.BACK_SPACE);
79
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsVisible(progress));
80
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(progress));
81
+ }
82
+ catch (err) {
83
+ // do nothing, the text field is empty
84
+ }
85
+ }
86
+ /**
87
+ * Find and open an extension item
88
+ * @param title title of the extension
89
+ * @returns Promise resolving when the item is clicked
90
+ */
91
+ async openItem(title) {
92
+ const item = await this.findItem(title);
93
+ if (item) {
94
+ await item.click();
95
+ }
96
+ return [];
97
+ }
98
+ getSectionForCategory(title) {
99
+ const category = title.split(' ')[0].toLowerCase();
100
+ switch (category) {
101
+ case ExtensionCategory.Disabled:
102
+ return 'Disabled';
103
+ case ExtensionCategory.Enabled:
104
+ return 'Enabled';
105
+ case ExtensionCategory.Installed:
106
+ return 'Installed';
107
+ case ExtensionCategory.Outdated:
108
+ return 'Outdated';
109
+ case ExtensionCategory.Recommended:
110
+ return 'Other Recommendations';
111
+ default:
112
+ return 'Marketplace';
113
+ }
114
+ }
115
+ }
116
+ exports.ExtensionsViewSection = ExtensionsViewSection;
117
+ //# sourceMappingURL=ExtensionsViewSection.js.map
@@ -0,0 +1,34 @@
1
+ import { ScmView, ScmProvider, ScmChange } from "./ScmView";
2
+ import { ContextMenu } from "../../menu/ContextMenu";
3
+ /**
4
+ * New SCM view for code 1.47 onwards
5
+ */
6
+ export declare class NewScmView extends ScmView {
7
+ getProviders(): Promise<ScmProvider[]>;
8
+ }
9
+ /**
10
+ * Implementation for a single SCM provider
11
+ */
12
+ export declare class SingleScmProvider extends ScmProvider {
13
+ /**
14
+ * There is no title available for a single provider
15
+ */
16
+ getTitle(): Promise<string>;
17
+ /**
18
+ * No title available for single provider
19
+ */
20
+ getType(): Promise<string>;
21
+ takeAction(title: string): Promise<boolean>;
22
+ openMoreActions(): Promise<ContextMenu>;
23
+ getChanges(staged?: boolean): Promise<ScmChange[]>;
24
+ }
25
+ /**
26
+ * Implementation of an SCM provider when multiple providers are available
27
+ */
28
+ export declare class MultiScmProvider extends ScmProvider {
29
+ takeAction(title: string): Promise<boolean>;
30
+ openMoreActions(): Promise<ContextMenu>;
31
+ commitChanges(message: string): Promise<void>;
32
+ getChanges(staged?: boolean): Promise<ScmChange[]>;
33
+ getChangeCount(staged?: boolean): Promise<number>;
34
+ }