@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,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ViewControl = void 0;
4
+ const __1 = require("../..");
5
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
6
+ const NewScmView_1 = require("../sidebar/scm/NewScmView");
7
+ /**
8
+ * Page object representing a view container item in the activity bar
9
+ */
10
+ class ViewControl extends ElementWithContextMenu_1.ElementWithContexMenu {
11
+ constructor(element, bar) {
12
+ super(element, bar);
13
+ }
14
+ /**
15
+ * Opens the associated view if not already open
16
+ * @returns Promise resolving to SideBarView object representing the opened view
17
+ */
18
+ async openView() {
19
+ // Check whether view is already open
20
+ const klass = await this.getAttribute(ViewControl.locators.ViewControl.attribute);
21
+ if (klass.indexOf(ViewControl.locators.ViewControl.klass) < 0) {
22
+ await this.click();
23
+ await ViewControl.driver.sleep(500);
24
+ }
25
+ const view = await new __1.SideBarView().wait();
26
+ if ((await view.findElements(ViewControl.locators.ViewControl.scmId)).length > 0) {
27
+ if (ViewControl.versionInfo.browser === 'vscode' && ViewControl.versionInfo.version >= '1.47.0') {
28
+ return new NewScmView_1.NewScmView().wait();
29
+ }
30
+ return new __1.ScmView().wait();
31
+ }
32
+ if ((await view.findElements(ViewControl.locators.ViewControl.debugId)).length > 0) {
33
+ return new __1.DebugView().wait();
34
+ }
35
+ return view;
36
+ }
37
+ /**
38
+ * Closes the associated view if not already closed
39
+ * @returns Promise resolving when the view closes
40
+ */
41
+ async closeView() {
42
+ const klass = await this.getAttribute(ViewControl.locators.ViewControl.attribute);
43
+ if (klass.indexOf(ViewControl.locators.ViewControl.klass) > -1) {
44
+ await this.click();
45
+ }
46
+ }
47
+ /**
48
+ * Returns the title of the associated view
49
+ */
50
+ async getTitle() {
51
+ const badge = await this.findElement(ViewControl.locators.ViewControl.badge);
52
+ return await badge.getAttribute('aria-label');
53
+ }
54
+ }
55
+ exports.ViewControl = ViewControl;
56
+ //# sourceMappingURL=ViewControl.js.map
@@ -0,0 +1,38 @@
1
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
2
+ /**
3
+ * View with channel selector
4
+ */
5
+ export declare abstract class ChannelView extends ElementWithContexMenu {
6
+ protected actionsLabel: string;
7
+ /**
8
+ * Get names of all selectable channels
9
+ * @returns Promise resolving to array of strings - channel names
10
+ */
11
+ getChannelNames(): Promise<string[]>;
12
+ /**
13
+ * Get name of the current channel
14
+ * @returns Promise resolving to the current channel name
15
+ */
16
+ getCurrentChannel(): Promise<string>;
17
+ /**
18
+ * Select a channel using the selector combo
19
+ * @param name name of the channel to open
20
+ */
21
+ selectChannel(name: string): Promise<void>;
22
+ }
23
+ /**
24
+ * View with channel selection and text area
25
+ */
26
+ export declare abstract class TextView extends ChannelView {
27
+ protected actionsLabel: string;
28
+ /**
29
+ * Get all text from the currently open channel
30
+ * @returns Promise resolving to the view's text
31
+ */
32
+ getText(): Promise<string>;
33
+ /**
34
+ * Clear the text in the current channel
35
+ * @returns Promise resolving when the clear text button is pressed
36
+ */
37
+ clearText(): Promise<void>;
38
+ }
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextView = exports.ChannelView = void 0;
4
+ const selenium_webdriver_1 = require("selenium-webdriver");
5
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
6
+ /**
7
+ * View with channel selector
8
+ */
9
+ class ChannelView extends ElementWithContextMenu_1.ElementWithContexMenu {
10
+ actionsLabel;
11
+ /**
12
+ * Get names of all selectable channels
13
+ * @returns Promise resolving to array of strings - channel names
14
+ */
15
+ async getChannelNames() {
16
+ const names = [];
17
+ const elements = await (await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.actionsContainer(this.actionsLabel)))
18
+ .findElements(ChannelView.locators.BottomBarViews.channelOption);
19
+ await Promise.all(elements.map(async (element) => {
20
+ const disabled = await element.getAttribute('disabled');
21
+ if (!disabled) {
22
+ names.push(await element.getAttribute('value'));
23
+ }
24
+ }));
25
+ return names;
26
+ }
27
+ /**
28
+ * Get name of the current channel
29
+ * @returns Promise resolving to the current channel name
30
+ */
31
+ async getCurrentChannel() {
32
+ if (ChannelView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') {
33
+ throw Error(`The 'ChannelView.getCurrentChannel' method is broken! Read more information in 'Known Issues > Limitations in testing with VS Code 1.87+' - https://github.com/microsoft/vscode/issues/206897.`);
34
+ }
35
+ const combo = await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.channelCombo);
36
+ return await combo.getAttribute('title');
37
+ }
38
+ /**
39
+ * Select a channel using the selector combo
40
+ * @param name name of the channel to open
41
+ */
42
+ async selectChannel(name) {
43
+ const combo = await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.channelCombo);
44
+ const option = await combo.findElement(ChannelView.locators.OutputView.optionByName(name));
45
+ await option.click();
46
+ }
47
+ }
48
+ exports.ChannelView = ChannelView;
49
+ /**
50
+ * View with channel selection and text area
51
+ */
52
+ class TextView extends ChannelView {
53
+ /**
54
+ * Get all text from the currently open channel
55
+ * @returns Promise resolving to the view's text
56
+ */
57
+ async getText() {
58
+ const clipboard = (await import('clipboardy')).default;
59
+ let originalClipboard = '';
60
+ try {
61
+ originalClipboard = clipboard.readSync();
62
+ }
63
+ catch (error) {
64
+ // workaround issue https://github.com/redhat-developer/vscode-extension-tester/issues/835
65
+ // do not fail if clipboard is empty
66
+ }
67
+ let textarea = await this.findElement(ChannelView.locators.BottomBarViews.textArea);
68
+ await textarea.sendKeys(selenium_webdriver_1.Key.chord(TextView.ctlKey, 'a'));
69
+ await textarea.sendKeys(selenium_webdriver_1.Key.chord(TextView.ctlKey, 'c'));
70
+ const text = clipboard.readSync();
71
+ // workaround as we are getting "element click intercepted" during the send keys actions.
72
+ // await textarea.click();
73
+ if (originalClipboard.length > 0) {
74
+ clipboard.writeSync(originalClipboard);
75
+ }
76
+ return text;
77
+ }
78
+ /**
79
+ * Clear the text in the current channel
80
+ * @returns Promise resolving when the clear text button is pressed
81
+ */
82
+ async clearText() {
83
+ await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.actionsContainer(this.actionsLabel))
84
+ .findElement(ChannelView.locators.BottomBarViews.clearText).click();
85
+ }
86
+ }
87
+ exports.TextView = TextView;
88
+ //# sourceMappingURL=AbstractViews.js.map
@@ -0,0 +1,47 @@
1
+ import { AbstractElement } from "../AbstractElement";
2
+ import { ProblemsView, OutputView, DebugConsoleView, TerminalView } from "../..";
3
+ /**
4
+ * Page object for the bottom view panel
5
+ */
6
+ export declare class BottomBarPanel extends AbstractElement {
7
+ constructor();
8
+ /**
9
+ * Open/Close the bottom bar panel
10
+ * @param open true to open. false to close
11
+ * @returns Promise resolving when the view visibility is toggled
12
+ */
13
+ toggle(open: boolean): Promise<void>;
14
+ /**
15
+ * Open the Problems view in the bottom panel
16
+ * @returns Promise resolving to a ProblemsView object
17
+ */
18
+ openProblemsView(): Promise<ProblemsView>;
19
+ /**
20
+ * Open the Output view in the bottom panel
21
+ * @returns Promise resolving to OutputView object
22
+ */
23
+ openOutputView(): Promise<OutputView>;
24
+ /**
25
+ * Open the Debug Console view in the bottom panel
26
+ * @returns Promise resolving to DebugConsoleView object
27
+ */
28
+ openDebugConsoleView(): Promise<DebugConsoleView>;
29
+ /**
30
+ * Open the Terminal view in the bottom panel
31
+ * @returns Promise resolving to TerminalView object
32
+ */
33
+ openTerminalView(): Promise<TerminalView>;
34
+ /**
35
+ * Maximize the the bottom panel if not maximized
36
+ * @returns Promise resolving when the maximize button is pressed
37
+ */
38
+ maximize(): Promise<void>;
39
+ /**
40
+ * Restore the the bottom panel if maximized
41
+ * @returns Promise resolving when the restore button is pressed
42
+ */
43
+ restore(): Promise<void>;
44
+ private openTab;
45
+ private resize;
46
+ closePanel(): Promise<void>;
47
+ }
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BottomBarPanel = void 0;
4
+ const AbstractElement_1 = require("../AbstractElement");
5
+ const selenium_webdriver_1 = require("selenium-webdriver");
6
+ const __1 = require("../..");
7
+ /**
8
+ * Page object for the bottom view panel
9
+ */
10
+ class BottomBarPanel extends AbstractElement_1.AbstractElement {
11
+ constructor() {
12
+ super(BottomBarPanel.locators.BottomBarPanel.constructor, BottomBarPanel.locators.Workbench.constructor);
13
+ }
14
+ /**
15
+ * Open/Close the bottom bar panel
16
+ * @param open true to open. false to close
17
+ * @returns Promise resolving when the view visibility is toggled
18
+ */
19
+ async toggle(open) {
20
+ try {
21
+ const tab = await new __1.EditorView().getActiveTab();
22
+ await tab?.click();
23
+ }
24
+ catch (err) {
25
+ // ignore and move on
26
+ }
27
+ const height = (await this.getRect()).height;
28
+ if ((open && height === 0) || !open && height > 0) {
29
+ if (open) {
30
+ await this.getDriver().actions().clear();
31
+ await this.getDriver().actions().keyDown(BottomBarPanel.ctlKey).sendKeys('j').perform();
32
+ await this.wait();
33
+ }
34
+ else {
35
+ await this.closePanel();
36
+ await this.getDriver().wait(selenium_webdriver_1.until.elementIsNotVisible(this));
37
+ }
38
+ }
39
+ }
40
+ /**
41
+ * Open the Problems view in the bottom panel
42
+ * @returns Promise resolving to a ProblemsView object
43
+ */
44
+ async openProblemsView() {
45
+ await this.openTab(BottomBarPanel.locators.BottomBarPanel.problemsTab);
46
+ return new __1.ProblemsView(this).wait();
47
+ }
48
+ /**
49
+ * Open the Output view in the bottom panel
50
+ * @returns Promise resolving to OutputView object
51
+ */
52
+ async openOutputView() {
53
+ await this.openTab(BottomBarPanel.locators.BottomBarPanel.outputTab);
54
+ return new __1.OutputView(this).wait();
55
+ }
56
+ /**
57
+ * Open the Debug Console view in the bottom panel
58
+ * @returns Promise resolving to DebugConsoleView object
59
+ */
60
+ async openDebugConsoleView() {
61
+ await this.openTab(BottomBarPanel.locators.BottomBarPanel.debugTab);
62
+ return new __1.DebugConsoleView(this).wait();
63
+ }
64
+ /**
65
+ * Open the Terminal view in the bottom panel
66
+ * @returns Promise resolving to TerminalView object
67
+ */
68
+ async openTerminalView() {
69
+ await this.openTab(BottomBarPanel.locators.BottomBarPanel.terminalTab);
70
+ return new __1.TerminalView(this).wait();
71
+ }
72
+ /**
73
+ * Maximize the the bottom panel if not maximized
74
+ * @returns Promise resolving when the maximize button is pressed
75
+ */
76
+ async maximize() {
77
+ await this.resize(BottomBarPanel.locators.BottomBarPanel.maximize);
78
+ }
79
+ /**
80
+ * Restore the the bottom panel if maximized
81
+ * @returns Promise resolving when the restore button is pressed
82
+ */
83
+ async restore() {
84
+ await this.resize(BottomBarPanel.locators.BottomBarPanel.restore);
85
+ }
86
+ async openTab(title) {
87
+ await this.toggle(true);
88
+ const tabContainer = await this.findElement(BottomBarPanel.locators.BottomBarPanel.tabContainer);
89
+ try {
90
+ const tabs = await tabContainer.findElements(BottomBarPanel.locators.BottomBarPanel.tab(title));
91
+ if (tabs.length > 0) {
92
+ await tabs[0].click();
93
+ }
94
+ else {
95
+ const label = await tabContainer.findElement(selenium_webdriver_1.By.xpath(`.//a[starts-with(@aria-label, '${title}')]`));
96
+ await label.click();
97
+ }
98
+ }
99
+ catch (err) {
100
+ await new __1.Workbench().executeCommand(`${title}: Focus on ${title} View`);
101
+ }
102
+ }
103
+ async resize(label) {
104
+ await this.toggle(true);
105
+ let action;
106
+ try {
107
+ action = await this.findElement(BottomBarPanel.locators.BottomBarPanel.globalActions)
108
+ .findElement(BottomBarPanel.locators.BottomBarPanel.action(label));
109
+ }
110
+ catch (err) {
111
+ // the panel is already maximized
112
+ }
113
+ if (action) {
114
+ await action.click();
115
+ }
116
+ }
117
+ async closePanel() {
118
+ let closeButton = await this.findElement(BottomBarPanel.locators.BottomBarPanel.closeAction);
119
+ await closeButton.click();
120
+ }
121
+ }
122
+ exports.BottomBarPanel = BottomBarPanel;
123
+ //# sourceMappingURL=BottomBarPanel.js.map
@@ -0,0 +1,88 @@
1
+ import { BottomBarPanel } from "../..";
2
+ import { AbstractElement } from "../AbstractElement";
3
+ import { WebElement } from 'selenium-webdriver';
4
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
5
+ /**
6
+ * Problems view in the bottom panel
7
+ */
8
+ export declare class ProblemsView extends AbstractElement {
9
+ constructor(panel?: BottomBarPanel);
10
+ /**
11
+ * Set the filter using the input box on the problems view
12
+ * @param pattern filter to use, preferably a glob pattern
13
+ * @returns Promise resolving when the filter pattern is filled in
14
+ */
15
+ setFilter(pattern: string): Promise<void>;
16
+ /**
17
+ * Clear all filters
18
+ * @returns Promise resolving to the filter field WebElement
19
+ */
20
+ clearFilter(): Promise<WebElement>;
21
+ /**
22
+ * Collapse all collapsible markers in the problems view
23
+ * @returns Promise resolving when the collapse all button is pressed
24
+ */
25
+ collapseAll(): Promise<void>;
26
+ /**
27
+ * @deprecated The method should not be used and getAllVisibleMarkers() should be used instead.
28
+ */
29
+ getAllMarkers(type: MarkerType): Promise<Marker[]>;
30
+ /**
31
+ * Get all visible markers from the problems view with the given type.
32
+ * Warning: this only returns the markers that are visible, and not the
33
+ * entire list, so calls to this function may change depending on the
34
+ * environment in which the tests are running in.
35
+ * To get all markers regardless of type, use MarkerType.Any
36
+ * @param type type of markers to retrieve
37
+ * @returns Promise resolving to array of Marker objects
38
+ */
39
+ getAllVisibleMarkers(type: MarkerType): Promise<Marker[]>;
40
+ /**
41
+ * Gets the count badge
42
+ * @returns Promise resolving to the WebElement representing the count badge
43
+ */
44
+ getCountBadge(): Promise<WebElement>;
45
+ }
46
+ /**
47
+ * Page object for a Marker in Problems view
48
+ */
49
+ export declare class Marker extends ElementWithContexMenu {
50
+ constructor(element: WebElement, view: ProblemsView);
51
+ /**
52
+ * Get the type of the marker. Possible types are:
53
+ * - File
54
+ * - Error
55
+ * - Warning
56
+ * @returns Promise resolving to a MarkerType
57
+ */
58
+ getType(): Promise<MarkerType>;
59
+ /**
60
+ * Get the full text of the Marker row
61
+ * @returns Promise resolving to a Marker row text
62
+ */
63
+ getText(): Promise<string>;
64
+ /**
65
+ * Get the Marker label text
66
+ * @returns Promise resolving to a Marker label
67
+ */
68
+ getLabel(): Promise<string>;
69
+ /**
70
+ * Expand/Collapse the Marker if possible
71
+ * @param expand True to expand, False to collapse
72
+ * @returns Promise resolving when the expand/collapse twistie is clicked
73
+ */
74
+ toggleExpand(expand: boolean): Promise<void>;
75
+ }
76
+ /**
77
+ * Possible types of markers
78
+ * - File = expandable item representing a file
79
+ * - Error = an error marker
80
+ * - Warning = a warning marker
81
+ * - Any = any of the above
82
+ */
83
+ export declare enum MarkerType {
84
+ File = "file",
85
+ Error = "error",
86
+ Warning = "warning",
87
+ Any = "any"
88
+ }
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MarkerType = exports.Marker = exports.ProblemsView = void 0;
4
+ const __1 = require("../..");
5
+ const AbstractElement_1 = require("../AbstractElement");
6
+ const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
7
+ /**
8
+ * Problems view in the bottom panel
9
+ */
10
+ class ProblemsView extends AbstractElement_1.AbstractElement {
11
+ constructor(panel = new __1.BottomBarPanel()) {
12
+ super(ProblemsView.locators.ProblemsView.constructor, panel);
13
+ }
14
+ /**
15
+ * Set the filter using the input box on the problems view
16
+ * @param pattern filter to use, preferably a glob pattern
17
+ * @returns Promise resolving when the filter pattern is filled in
18
+ */
19
+ async setFilter(pattern) {
20
+ const filterField = await this.clearFilter();
21
+ await filterField.sendKeys(pattern);
22
+ }
23
+ /**
24
+ * Clear all filters
25
+ * @returns Promise resolving to the filter field WebElement
26
+ */
27
+ async clearFilter() {
28
+ const filterField = await this.enclosingItem.findElement(ProblemsView.locators.BottomBarPanel.actions)
29
+ .findElement(ProblemsView.locators.ProblemsView.markersFilter)
30
+ .findElement(ProblemsView.locators.ProblemsView.input);
31
+ await filterField.clear();
32
+ return filterField;
33
+ }
34
+ /**
35
+ * Collapse all collapsible markers in the problems view
36
+ * @returns Promise resolving when the collapse all button is pressed
37
+ */
38
+ async collapseAll() {
39
+ const button = await this.enclosingItem.findElement(ProblemsView.locators.BottomBarPanel.actions)
40
+ .findElement(ProblemsView.locators.ProblemsView.collapseAll);
41
+ await button.click();
42
+ }
43
+ /**
44
+ * @deprecated The method should not be used and getAllVisibleMarkers() should be used instead.
45
+ */
46
+ async getAllMarkers(type) {
47
+ return this.getAllVisibleMarkers(type);
48
+ }
49
+ /**
50
+ * Get all visible markers from the problems view with the given type.
51
+ * Warning: this only returns the markers that are visible, and not the
52
+ * entire list, so calls to this function may change depending on the
53
+ * environment in which the tests are running in.
54
+ * To get all markers regardless of type, use MarkerType.Any
55
+ * @param type type of markers to retrieve
56
+ * @returns Promise resolving to array of Marker objects
57
+ */
58
+ async getAllVisibleMarkers(type) {
59
+ const markers = [];
60
+ const elements = await this.findElements(ProblemsView.locators.ProblemsView.markerRow);
61
+ for (const element of elements) {
62
+ let marker;
63
+ marker = await new Marker(element, this).wait();
64
+ if (type === MarkerType.Any || type === await marker.getType()) {
65
+ markers.push(marker);
66
+ }
67
+ }
68
+ return markers;
69
+ }
70
+ /**
71
+ * Gets the count badge
72
+ * @returns Promise resolving to the WebElement representing the count badge
73
+ */
74
+ async getCountBadge() {
75
+ return await this.findElement(ProblemsView.locators.ProblemsView.changeCount);
76
+ }
77
+ }
78
+ exports.ProblemsView = ProblemsView;
79
+ /**
80
+ * Page object for a Marker in Problems view
81
+ */
82
+ class Marker extends ElementWithContextMenu_1.ElementWithContexMenu {
83
+ constructor(element, view) {
84
+ super(element, view);
85
+ }
86
+ /**
87
+ * Get the type of the marker. Possible types are:
88
+ * - File
89
+ * - Error
90
+ * - Warning
91
+ * @returns Promise resolving to a MarkerType
92
+ */
93
+ async getType() {
94
+ const twist = await this.findElement(ProblemsView.locators.ProblemsView.markerTwistie);
95
+ if ((await twist.getAttribute('class')).indexOf('collapsible') > -1) {
96
+ return MarkerType.File;
97
+ }
98
+ const text = await this.getText();
99
+ if (text.startsWith('Error')) {
100
+ return MarkerType.Error;
101
+ }
102
+ else {
103
+ return MarkerType.Warning;
104
+ }
105
+ }
106
+ /**
107
+ * Get the full text of the Marker row
108
+ * @returns Promise resolving to a Marker row text
109
+ */
110
+ async getText() {
111
+ return await this.getAttribute(ProblemsView.locators.ProblemsView.rowLabel);
112
+ }
113
+ /**
114
+ * Get the Marker label text
115
+ * @returns Promise resolving to a Marker label
116
+ */
117
+ async getLabel() {
118
+ return await (await this.findElement(ProblemsView.locators.ProblemsView.label)).getText();
119
+ }
120
+ /**
121
+ * Expand/Collapse the Marker if possible
122
+ * @param expand True to expand, False to collapse
123
+ * @returns Promise resolving when the expand/collapse twistie is clicked
124
+ */
125
+ async toggleExpand(expand) {
126
+ if (await this.getType() === MarkerType.File) {
127
+ const klass = await this.findElement(ProblemsView.locators.ProblemsView.markerTwistie).getAttribute('class');
128
+ if ((klass.indexOf('collapsed') > -1) === expand) {
129
+ await this.click();
130
+ }
131
+ }
132
+ }
133
+ }
134
+ exports.Marker = Marker;
135
+ /**
136
+ * Possible types of markers
137
+ * - File = expandable item representing a file
138
+ * - Error = an error marker
139
+ * - Warning = a warning marker
140
+ * - Any = any of the above
141
+ */
142
+ var MarkerType;
143
+ (function (MarkerType) {
144
+ MarkerType["File"] = "file";
145
+ MarkerType["Error"] = "error";
146
+ MarkerType["Warning"] = "warning";
147
+ MarkerType["Any"] = "any";
148
+ })(MarkerType || (exports.MarkerType = MarkerType = {}));
149
+ //# sourceMappingURL=ProblemsView.js.map
@@ -0,0 +1,75 @@
1
+ import { BottomBarPanel, ContentAssist } from "../..";
2
+ import { TextView, ChannelView } from "./AbstractViews";
3
+ import { ElementWithContexMenu } from "../ElementWithContextMenu";
4
+ /**
5
+ * Output view of the bottom panel
6
+ */
7
+ export declare class OutputView extends TextView {
8
+ constructor(panel?: BottomBarPanel);
9
+ /**
10
+ * Select a channel using the selector combo
11
+ * @param name name of the channel to open
12
+ */
13
+ selectChannel(name: string): Promise<void>;
14
+ }
15
+ /**
16
+ * Debug Console view on the bottom panel
17
+ * Most functionality will only be available when a debug session is running
18
+ */
19
+ export declare class DebugConsoleView extends ElementWithContexMenu {
20
+ constructor(panel?: BottomBarPanel);
21
+ /**
22
+ * Clear the console of all text
23
+ */
24
+ clearText(): Promise<void>;
25
+ /**
26
+ * Type an expression into the debug console text area
27
+ * @param expression expression in form of a string
28
+ */
29
+ setExpression(expression: string): Promise<void>;
30
+ /**
31
+ * Evaluate an expression:
32
+ * - if no argument is supplied, evaluate the current expression present in debug console text area
33
+ * - if a string argument is supplied, replace the current expression with the `expression` argument and evaluate
34
+ *
35
+ * @param expression expression to evaluate. To use existing contents of the debug console text area instead, don't define this argument
36
+ */
37
+ evaluateExpression(expression?: string): Promise<void>;
38
+ /**
39
+ * Create a content assist page object
40
+ * @returns promise resolving to ContentAssist object
41
+ */
42
+ getContentAssist(): Promise<ContentAssist>;
43
+ }
44
+ /**
45
+ * Terminal view on the bottom panel
46
+ */
47
+ export declare class TerminalView extends ChannelView {
48
+ constructor(panel?: BottomBarPanel);
49
+ /**
50
+ * Execute command in the internal terminal and wait for results
51
+ * @param command text of the command
52
+ * @param timeout optional maximum time to wait for completion in milliseconds, 0 for unlimited
53
+ * @returns Promise resolving when the command is finished
54
+ */
55
+ executeCommand(command: string, timeout?: number): Promise<void>;
56
+ /**
57
+ * Get all text from the internal terminal
58
+ * Beware, no formatting.
59
+ *
60
+ * @returns Promise resolving to all terminal text
61
+ */
62
+ getText(): Promise<string>;
63
+ /**
64
+ * Destroy the currently open terminal
65
+ * @returns Promise resolving when Kill Terminal button is pressed
66
+ */
67
+ killTerminal(): Promise<void>;
68
+ /**
69
+ * Initiate new terminal creation
70
+ * @returns Promise resolving when New Terminal button is pressed
71
+ */
72
+ newTerminal(): Promise<void>;
73
+ getCurrentChannel(): Promise<string>;
74
+ selectChannel(name: string): Promise<void>;
75
+ }