Package not found. Please check the package name and try again.

@redhat-developer/page-objects 1.9.0 → 1.11.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.
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License", destination); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * https://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ContextMenu } from './menu/ContextMenu';
18
+ import { AbstractElement } from './AbstractElement';
19
+ export declare abstract class ActionButtonElementDropdown extends AbstractElement {
20
+ open(): Promise<ContextMenu>;
21
+ }
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License", destination); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * https://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ActionButtonElementDropdown = void 0;
20
+ const ElementWithContextMenu_1 = require("./ElementWithContextMenu");
21
+ const ContextMenu_1 = require("./menu/ContextMenu");
22
+ const selenium_webdriver_1 = require("selenium-webdriver");
23
+ const AbstractElement_1 = require("./AbstractElement");
24
+ class ActionButtonElementDropdown extends AbstractElement_1.AbstractElement {
25
+ async open() {
26
+ await this.click();
27
+ const shadowRootHost = await this.enclosingItem.findElements(selenium_webdriver_1.By.className('shadow-root-host'));
28
+ const actions = this.getDriver().actions();
29
+ await actions.clear();
30
+ await actions.sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
31
+ if (shadowRootHost.length > 0) {
32
+ if ((await this.getAttribute('aria-expanded')) !== 'true') {
33
+ await this.click();
34
+ }
35
+ const shadowRoot = await shadowRootHost[0].getShadowRoot();
36
+ return new ContextMenu_1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
37
+ }
38
+ else {
39
+ await this.click();
40
+ const workbench = await this.getDriver().findElement(ElementWithContextMenu_1.ElementWithContextMenu.locators.Workbench.constructor);
41
+ return new ContextMenu_1.ContextMenu(workbench).wait();
42
+ }
43
+ }
44
+ }
45
+ exports.ActionButtonElementDropdown = ActionButtonElementDropdown;
46
+ //# sourceMappingURL=ActionButtonElementDropdown.js.map
@@ -20,6 +20,7 @@ exports.ViewControl = void 0;
20
20
  const __1 = require("../..");
21
21
  const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
22
22
  const NewScmView_1 = require("../sidebar/scm/NewScmView");
23
+ const compare_versions_1 = require("compare-versions");
23
24
  /**
24
25
  * Page object representing a view container item in the activity bar
25
26
  */
@@ -40,7 +41,7 @@ class ViewControl extends ElementWithContextMenu_1.ElementWithContextMenu {
40
41
  }
41
42
  const view = await new __1.SideBarView().wait();
42
43
  if ((await view.findElements(ViewControl.locators.ViewControl.scmId)).length > 0) {
43
- if (ViewControl.versionInfo.browser === 'vscode' && ViewControl.versionInfo.version >= '1.47.0') {
44
+ if (ViewControl.versionInfo.browser === 'vscode' && (0, compare_versions_1.satisfies)(ViewControl.versionInfo.version, '>=1.47.0')) {
44
45
  return new NewScmView_1.NewScmView().wait();
45
46
  }
46
47
  return new __1.ScmView().wait();
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.TextView = exports.ChannelView = void 0;
20
20
  const selenium_webdriver_1 = require("selenium-webdriver");
21
21
  const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
22
+ const compare_versions_1 = require("compare-versions");
22
23
  /**
23
24
  * View with channel selector
24
25
  */
@@ -45,7 +46,7 @@ class ChannelView extends ElementWithContextMenu_1.ElementWithContextMenu {
45
46
  * @deprecated For VS Code 1.88+ this method won't be working any more
46
47
  */
47
48
  async getCurrentChannel() {
48
- if (ChannelView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') {
49
+ if ((0, compare_versions_1.compareVersions)(ChannelView.versionInfo.version, '1.87.0') >= 0 && process.platform !== 'darwin') {
49
50
  throw Error(`DEPRECATED METHOD! 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.`);
50
51
  }
51
52
  const combo = await this.enclosingItem.findElement(ChannelView.locators.BottomBarViews.channelCombo);
@@ -57,7 +57,13 @@ export declare class BottomBarPanel extends AbstractElement {
57
57
  * @returns Promise resolving when the restore button is pressed
58
58
  */
59
59
  restore(): Promise<void>;
60
- private openTab;
60
+ /**
61
+ * Opens (or focuses) a tab in the bottom bar panel by its title.
62
+ *
63
+ * @param title The exact name of the tab to be opened or focused.
64
+ * @returns A promise that resolves when the tab is opened or focused.
65
+ */
66
+ openTab(title: string): Promise<void>;
61
67
  private resize;
62
68
  closePanel(): Promise<void>;
63
69
  }
@@ -99,6 +99,12 @@ class BottomBarPanel extends AbstractElement_1.AbstractElement {
99
99
  async restore() {
100
100
  await this.resize(BottomBarPanel.locators.BottomBarPanel.restore);
101
101
  }
102
+ /**
103
+ * Opens (or focuses) a tab in the bottom bar panel by its title.
104
+ *
105
+ * @param title The exact name of the tab to be opened or focused.
106
+ * @returns A promise that resolves when the tab is opened or focused.
107
+ */
102
108
  async openTab(title) {
103
109
  await this.toggle(true);
104
110
  const tabContainer = await this.findElement(BottomBarPanel.locators.BottomBarPanel.tabContainer);
@@ -14,16 +14,18 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { EditorGroup } from './EditorView';
18
- import { ContextMenu, WebElement } from '../..';
19
- import { ElementWithContextMenu } from '../ElementWithContextMenu';
20
- export declare class EditorAction extends ElementWithContextMenu {
21
- constructor(element: WebElement, parent: EditorGroup);
17
+ import { ActionButtonElementDropdown } from '../ActionButtonElementDropdown';
18
+ /**
19
+ * Base class for editor actions that provides a common method to get the title.
20
+ */
21
+ declare abstract class BaseEditorAction extends ActionButtonElementDropdown {
22
22
  /**
23
23
  * Get text description of the action.
24
24
  */
25
25
  getTitle(): Promise<string>;
26
26
  }
27
- export declare class EditorActionDropdown extends EditorAction {
28
- open(): Promise<ContextMenu>;
27
+ export declare class EditorAction extends BaseEditorAction {
28
+ }
29
+ export declare class EditorActionDropdown extends BaseEditorAction {
29
30
  }
31
+ export {};
@@ -17,52 +17,22 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.EditorActionDropdown = exports.EditorAction = void 0;
20
- const __1 = require("../..");
21
- const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
22
- class EditorAction extends ElementWithContextMenu_1.ElementWithContextMenu {
23
- constructor(element, parent) {
24
- super(element, parent);
25
- }
20
+ const ActionButtonElementDropdown_1 = require("../ActionButtonElementDropdown");
21
+ /**
22
+ * Base class for editor actions that provides a common method to get the title.
23
+ */
24
+ class BaseEditorAction extends ActionButtonElementDropdown_1.ActionButtonElementDropdown {
26
25
  /**
27
26
  * Get text description of the action.
28
27
  */
29
28
  async getTitle() {
30
- return await this.getAttribute(EditorAction.locators.EditorView.attribute);
29
+ return await this.getAttribute(BaseEditorAction.locators.EditorView.attribute);
31
30
  }
32
31
  }
32
+ class EditorAction extends BaseEditorAction {
33
+ }
33
34
  exports.EditorAction = EditorAction;
34
- class EditorActionDropdown extends EditorAction {
35
- async open() {
36
- await this.click();
37
- const shadowRootHost = await this.enclosingItem.findElements(EditorAction.locators.EditorAction.shadowRootHost);
38
- const actions = this.getDriver().actions();
39
- await actions.clear();
40
- await actions.sendKeys(__1.Key.ESCAPE).perform();
41
- const webdriverCapabilities = await this.getDriver().getCapabilities();
42
- const chromiumVersion = webdriverCapabilities.getBrowserVersion();
43
- if (shadowRootHost.length > 0) {
44
- if ((await this.getAttribute('aria-expanded')) !== 'true') {
45
- await this.click();
46
- }
47
- let shadowRoot;
48
- const webdriverCapabilities = await this.getDriver().getCapabilities();
49
- const chromiumVersion = webdriverCapabilities.getBrowserVersion();
50
- if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
51
- shadowRoot = await shadowRootHost[0].getShadowRoot();
52
- return new __1.ContextMenu(await shadowRoot.findElement(EditorAction.locators.EditorAction.monacoMenuContainer)).wait();
53
- }
54
- else {
55
- shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
56
- return new __1.ContextMenu(shadowRoot).wait();
57
- }
58
- }
59
- else if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 100) {
60
- await this.click();
61
- const workbench = await this.getDriver().findElement(ElementWithContextMenu_1.ElementWithContextMenu.locators.Workbench.constructor);
62
- return new __1.ContextMenu(workbench).wait();
63
- }
64
- return await super.openContextMenu();
65
- }
35
+ class EditorActionDropdown extends BaseEditorAction {
66
36
  }
67
37
  exports.EditorActionDropdown = EditorActionDropdown;
68
38
  //# sourceMappingURL=EditorAction.js.map
@@ -21,11 +21,12 @@ const Editor_1 = require("./Editor");
21
21
  const selenium_webdriver_1 = require("selenium-webdriver");
22
22
  const AbstractElement_1 = require("../AbstractElement");
23
23
  const __1 = require("../..");
24
+ const compare_versions_1 = require("compare-versions");
24
25
  /**
25
26
  * Page object representing the internal VS Code settings editor
26
27
  */
27
28
  class SettingsEditor extends Editor_1.Editor {
28
- divider = SettingsEditor.versionInfo.version >= '1.83.0' ? '›' : ' › ';
29
+ divider = (0, compare_versions_1.satisfies)(SettingsEditor.versionInfo.version, '>=1.83.0') ? '›' : ' › ';
29
30
  constructor(view = new __1.EditorView()) {
30
31
  super(view);
31
32
  }
@@ -25,6 +25,7 @@ const Editor_1 = require("./Editor");
25
25
  const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
26
26
  const AbstractElement_1 = require("../AbstractElement");
27
27
  const Breakpoint_1 = require("./Breakpoint");
28
+ const compare_versions_1 = require("compare-versions");
28
29
  class BreakpointError extends Error {
29
30
  }
30
31
  exports.BreakpointError = BreakpointError;
@@ -524,7 +525,9 @@ class TextEditor extends Editor_1.Editor {
524
525
  const lineNum = await margin.findElement(TextEditor.locators.TextEditor.lineNumber(line));
525
526
  await this.getDriver().actions().move({ origin: lineNum }).perform();
526
527
  const lineOverlay = await margin.findElement(TextEditor.locators.TextEditor.lineOverlay(line));
527
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : lineOverlay;
528
+ const breakpointContainer = (0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0')
529
+ ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget)
530
+ : lineOverlay;
528
531
  const breakPoint = await breakpointContainer.findElements(TextEditor.locators.TextEditor.breakpoint.generalSelector);
529
532
  if (breakPoint.length > 0) {
530
533
  if (this.breakPoints.indexOf(line) !== -1) {
@@ -549,7 +552,9 @@ class TextEditor extends Editor_1.Editor {
549
552
  */
550
553
  async getPausedBreakpoint() {
551
554
  const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint;
552
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this;
555
+ const breakpointContainer = (0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0')
556
+ ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget)
557
+ : this;
553
558
  const breakpoints = await breakpointContainer.findElements(breakpointLocators.pauseSelector);
554
559
  if (breakpoints.length === 0) {
555
560
  return undefined;
@@ -559,7 +564,7 @@ class TextEditor extends Editor_1.Editor {
559
564
  }
560
565
  // get parent
561
566
  let lineElement;
562
- if (TextEditor.versionInfo.version >= '1.80.0') {
567
+ if ((0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0')) {
563
568
  const styleTopAttr = await breakpoints[0].getCssValue('top');
564
569
  lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr));
565
570
  }
@@ -589,11 +594,13 @@ class TextEditor extends Editor_1.Editor {
589
594
  async getBreakpoints() {
590
595
  const breakpoints = [];
591
596
  const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint;
592
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this;
597
+ const breakpointContainer = (0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0')
598
+ ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget)
599
+ : this;
593
600
  const breakpointsSelectors = await breakpointContainer.findElements(breakpointLocators.generalSelector);
594
601
  for (const breakpointSelector of breakpointsSelectors) {
595
602
  let lineElement;
596
- if (TextEditor.versionInfo.version >= '1.80.0') {
603
+ if ((0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0')) {
597
604
  const styleTopAttr = await breakpointSelector.getCssValue('top');
598
605
  lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr));
599
606
  }
@@ -767,7 +774,7 @@ class FindWidget extends AbstractElement_1.AbstractElement {
767
774
  * Close the widget.
768
775
  */
769
776
  async close() {
770
- const part = TextEditor.versionInfo.version >= '1.80.0' ? 'close' : 'find';
777
+ const part = (0, compare_versions_1.satisfies)(TextEditor.versionInfo.version, '>=1.80.0') ? 'close' : 'find';
771
778
  await this.clickButton('Close', part);
772
779
  }
773
780
  /**
@@ -17,6 +17,7 @@
17
17
  import { WebElement } from 'selenium-webdriver';
18
18
  import { ContextMenu, ViewContent, ViewItem, WelcomeContentSection } from '../..';
19
19
  import { AbstractElement } from '../AbstractElement';
20
+ import { ActionButtonElementDropdown } from '../ActionButtonElementDropdown';
20
21
  export type ViewSectionConstructor<T extends ViewSection> = {
21
22
  new (rootElement: WebElement, tree: ViewContent): T;
22
23
  };
@@ -34,12 +35,12 @@ export declare abstract class ViewSection extends AbstractElement {
34
35
  * Expand the section if collapsed
35
36
  * @returns Promise resolving when the section is expanded
36
37
  */
37
- expand(): Promise<void>;
38
+ expand(timeout?: number): Promise<void>;
38
39
  /**
39
40
  * Collapse the section if expanded
40
41
  * @returns Promise resolving when the section is collapsed
41
42
  */
42
- collapse(): Promise<void>;
43
+ collapse(timeout?: number): Promise<void>;
43
44
  /**
44
45
  * Finds whether the section is expanded
45
46
  * @returns Promise resolving to true/false
@@ -102,13 +103,23 @@ export declare abstract class ViewSection extends AbstractElement {
102
103
  private isHeaderHidden;
103
104
  }
104
105
  /**
105
- * Action button on the header of a view section
106
+ * Base class for action buttons on view sections.
107
+ * Provides shared functionality for both standard and dropdown actions.
106
108
  */
107
- export declare class ViewPanelAction extends AbstractElement {
109
+ declare abstract class BaseViewPanelAction extends ActionButtonElementDropdown {
108
110
  constructor(element: WebElement, viewPart: ViewSection);
109
111
  /**
110
112
  * Get label of the action button
111
113
  */
112
114
  getLabel(): Promise<string>;
115
+ /**
116
+ * Wait for the action button to be located within a given timeout.
117
+ * @param timeout Time in milliseconds (default: 1000ms)
118
+ */
113
119
  wait(timeout?: number): Promise<this>;
114
120
  }
121
+ export declare class ViewPanelAction extends BaseViewPanelAction {
122
+ }
123
+ export declare class ViewPanelActionDropdown extends BaseViewPanelAction {
124
+ }
125
+ export {};
@@ -16,11 +16,12 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ViewPanelAction = exports.ViewSection = void 0;
19
+ exports.ViewPanelActionDropdown = exports.ViewPanelAction = exports.ViewSection = void 0;
20
20
  const selenium_webdriver_1 = require("selenium-webdriver");
21
21
  const __1 = require("../..");
22
22
  const AbstractElement_1 = require("../AbstractElement");
23
23
  const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
24
+ const ActionButtonElementDropdown_1 = require("../ActionButtonElementDropdown");
24
25
  /**
25
26
  * Page object representing a collapsible content section of the side bar view
26
27
  */
@@ -40,28 +41,32 @@ class ViewSection extends AbstractElement_1.AbstractElement {
40
41
  * Expand the section if collapsed
41
42
  * @returns Promise resolving when the section is expanded
42
43
  */
43
- async expand() {
44
+ async expand(timeout = 1_000) {
44
45
  if (await this.isHeaderHidden()) {
45
46
  return;
46
47
  }
47
48
  if (!(await this.isExpanded())) {
48
- const panel = await this.findElement(ViewSection.locators.ViewSection.header);
49
- await panel.click();
50
- await this.getDriver().wait((0, __1.waitForAttributeValue)(panel, ViewSection.locators.ViewSection.headerExpanded, 'true'), 1000);
49
+ const header = await this.findElement(ViewSection.locators.ViewSection.header);
50
+ const collapseExpandButton = await header.findElement(ViewSection.locators.ViewSection.headerCollapseExpandButton);
51
+ await collapseExpandButton.click();
52
+ await this.getDriver().wait((0, __1.waitForAttributeValue)(header, ViewSection.locators.ViewSection.headerExpanded, 'true'), timeout);
53
+ await this.getDriver().sleep(500);
51
54
  }
52
55
  }
53
56
  /**
54
57
  * Collapse the section if expanded
55
58
  * @returns Promise resolving when the section is collapsed
56
59
  */
57
- async collapse() {
60
+ async collapse(timeout = 1_000) {
58
61
  if (await this.isHeaderHidden()) {
59
62
  return;
60
63
  }
61
64
  if (await this.isExpanded()) {
62
- const panel = await this.findElement(ViewSection.locators.ViewSection.header);
63
- await panel.click();
64
- await this.getDriver().wait((0, __1.waitForAttributeValue)(panel, ViewSection.locators.ViewSection.headerExpanded, 'false'), 1000);
65
+ const header = await this.findElement(ViewSection.locators.ViewSection.header);
66
+ const collapseExpandButton = await header.findElement(ViewSection.locators.ViewSection.headerCollapseExpandButton);
67
+ await collapseExpandButton.click();
68
+ await this.getDriver().wait((0, __1.waitForAttributeValue)(header, ViewSection.locators.ViewSection.headerExpanded, 'false'), timeout);
69
+ await this.getDriver().sleep(500);
65
70
  }
66
71
  }
67
72
  /**
@@ -95,16 +100,16 @@ class ViewSection extends AbstractElement_1.AbstractElement {
95
100
  * @returns Promise resolving to array of ViewPanelAction objects
96
101
  */
97
102
  async getActions() {
98
- const actions = [];
99
- if (!(await this.isHeaderHidden())) {
100
- const header = await this.findElement(ViewSection.locators.ViewSection.header);
101
- const act = await header.findElement(ViewSection.locators.ViewSection.actions);
102
- const elements = await act.findElements(ViewSection.locators.ViewSection.button);
103
- for (const element of elements) {
104
- actions.push(await new ViewPanelAction(element, this).wait());
103
+ const actions = await this.findElement(ViewSection.locators.ViewSection.actions).findElements(ViewSection.locators.ViewSection.button);
104
+ return Promise.all(actions.map(async (action) => {
105
+ const dropdown = await action.getAttribute('aria-haspopup');
106
+ if (dropdown) {
107
+ return new ViewPanelActionDropdown(action, this);
105
108
  }
106
- }
107
- return actions;
109
+ else {
110
+ return new ViewPanelAction(action, this);
111
+ }
112
+ }));
108
113
  }
109
114
  /**
110
115
  * Retrieve an action button on the sections's header by its label
@@ -159,9 +164,10 @@ class ViewSection extends AbstractElement_1.AbstractElement {
159
164
  }
160
165
  exports.ViewSection = ViewSection;
161
166
  /**
162
- * Action button on the header of a view section
167
+ * Base class for action buttons on view sections.
168
+ * Provides shared functionality for both standard and dropdown actions.
163
169
  */
164
- class ViewPanelAction extends AbstractElement_1.AbstractElement {
170
+ class BaseViewPanelAction extends ActionButtonElementDropdown_1.ActionButtonElementDropdown {
165
171
  constructor(element, viewPart) {
166
172
  super(element, viewPart);
167
173
  }
@@ -169,12 +175,21 @@ class ViewPanelAction extends AbstractElement_1.AbstractElement {
169
175
  * Get label of the action button
170
176
  */
171
177
  async getLabel() {
172
- return await this.getAttribute(ViewSection.locators.ViewSection.buttonLabel);
178
+ return await this.getAttribute(BaseViewPanelAction.locators.ViewSection.buttonLabel);
173
179
  }
174
- async wait(timeout = 1000) {
175
- await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(ViewSection.locators.ViewSection.actions), timeout);
180
+ /**
181
+ * Wait for the action button to be located within a given timeout.
182
+ * @param timeout Time in milliseconds (default: 1000ms)
183
+ */
184
+ async wait(timeout = 1_000) {
185
+ await this.getDriver().wait(selenium_webdriver_1.until.elementLocated(BaseViewPanelAction.locators.ViewSection.actions), timeout);
176
186
  return this;
177
187
  }
178
188
  }
189
+ class ViewPanelAction extends BaseViewPanelAction {
190
+ }
179
191
  exports.ViewPanelAction = ViewPanelAction;
192
+ class ViewPanelActionDropdown extends BaseViewPanelAction {
193
+ }
194
+ exports.ViewPanelActionDropdown = ViewPanelActionDropdown;
180
195
  //# sourceMappingURL=ViewSection.js.map
@@ -46,13 +46,19 @@ export declare class WelcomeContentButton extends AbstractElement {
46
46
  export declare class WelcomeContentSection extends AbstractElement {
47
47
  /**
48
48
  * @param panel The panel containing the welcome content.
49
- * @param parent The webelement in which the welcome content is embedded.
49
+ * @param parent The webElement in which the welcome content is embedded.
50
50
  */
51
51
  constructor(panel: WebElement, parent: ViewSection);
52
52
  /**
53
53
  * Combination of [[getButtons]] and [[getTextSections]]: returns all entries in the welcome view in the order that they appear.
54
54
  */
55
55
  getContents(): Promise<(WelcomeContentButton | string)[]>;
56
+ /**
57
+ * Returns a specific button from the welcome view that matches the given title.
58
+ * @param title The title of the button to search for.
59
+ * @returns A `WelcomeContentButton` if found, otherwise `undefined`.
60
+ */
61
+ getButton(title: string): Promise<WelcomeContentButton | undefined>;
56
62
  /** Finds all buttons in the welcome content */
57
63
  getButtons(): Promise<WelcomeContentButton[]>;
58
64
  /**
@@ -52,7 +52,7 @@ exports.WelcomeContentButton = WelcomeContentButton;
52
52
  class WelcomeContentSection extends AbstractElement_1.AbstractElement {
53
53
  /**
54
54
  * @param panel The panel containing the welcome content.
55
- * @param parent The webelement in which the welcome content is embedded.
55
+ * @param parent The webElement in which the welcome content is embedded.
56
56
  */
57
57
  constructor(panel, parent) {
58
58
  super(panel, parent);
@@ -72,6 +72,20 @@ class WelcomeContentSection extends AbstractElement_1.AbstractElement {
72
72
  }
73
73
  }));
74
74
  }
75
+ /**
76
+ * Returns a specific button from the welcome view that matches the given title.
77
+ * @param title The title of the button to search for.
78
+ * @returns A `WelcomeContentButton` if found, otherwise `undefined`.
79
+ */
80
+ async getButton(title) {
81
+ const buttons = await this.getButtons();
82
+ for (const btn of buttons) {
83
+ if ((await btn.getTitle()) === title) {
84
+ return btn;
85
+ }
86
+ }
87
+ return undefined;
88
+ }
75
89
  /** Finds all buttons in the welcome content */
76
90
  async getButtons() {
77
91
  return (await this.findElements(WelcomeContentSection.locators.WelcomeContent.button)).map((elem) => new WelcomeContentButton(elem, this));
@@ -17,6 +17,7 @@
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.DebugView = void 0;
20
+ const compare_versions_1 = require("compare-versions");
20
21
  const SideBarView_1 = require("../SideBarView");
21
22
  const DebugBreakpointSection_1 = require("../tree/debug/DebugBreakpointSection");
22
23
  const DebugCallStackSection_1 = require("../tree/debug/DebugCallStackSection");
@@ -32,7 +33,7 @@ class DebugView extends SideBarView_1.SideBarView {
32
33
  * @deprecated For VS Code 1.88+ this method won't be working any more
33
34
  */
34
35
  async getLaunchConfiguration() {
35
- if (DebugView.versionInfo.version >= '1.87.0' && process.platform !== 'darwin') {
36
+ if ((0, compare_versions_1.satisfies)(DebugView.versionInfo.version, '>=1.87.0') && process.platform !== 'darwin') {
36
37
  throw Error(`DEPRECATED METHOD! 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.`);
37
38
  }
38
39
  const action = await this.getTitlePart().findElement(DebugView.locators.DebugView.launchCombo);
@@ -21,6 +21,7 @@ const ScmView_1 = require("./ScmView");
21
21
  const selenium_webdriver_1 = require("selenium-webdriver");
22
22
  const ElementWithContextMenu_1 = require("../../ElementWithContextMenu");
23
23
  const ViewTitlePart_1 = require("../ViewTitlePart");
24
+ const compare_versions_1 = require("compare-versions");
24
25
  /**
25
26
  * New SCM view for code 1.47 onwards
26
27
  */
@@ -61,7 +62,7 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
61
62
  let actions = [];
62
63
  let names = [];
63
64
  const buttons = [];
64
- if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') {
65
+ if ((0, compare_versions_1.satisfies)(ScmView_1.ScmProvider.versionInfo.version, '>=1.93.0')) {
65
66
  const header = await view.findElement(ScmView_1.ScmView.locators.ScmView.sourceControlSection);
66
67
  actions = await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action);
67
68
  names = await Promise.all(actions.map(async (action) => await action.getAttribute(ScmView_1.ScmProvider.locators.ScmView.actionLabel)));
@@ -77,7 +78,7 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
77
78
  }
78
79
  const index = names.findIndex((item) => item === title);
79
80
  if (index > -1) {
80
- if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') {
81
+ if ((0, compare_versions_1.satisfies)(ScmView_1.ScmProvider.versionInfo.version, '>=1.93.0')) {
81
82
  await actions[index].click();
82
83
  }
83
84
  else {
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.VariableSectionItem = void 0;
20
20
  const selenium_webdriver_1 = require("selenium-webdriver");
21
21
  const CustomTreeItem_1 = require("../custom/CustomTreeItem");
22
+ const compare_versions_1 = require("compare-versions");
22
23
  class VariableSectionItem extends CustomTreeItem_1.CustomTreeItem {
23
24
  constructor(element, viewPart) {
24
25
  super(element, viewPart);
@@ -45,7 +46,7 @@ class VariableSectionItem extends CustomTreeItem_1.CustomTreeItem {
45
46
  * @deprecated For VS Code 1.88+ this method won't be working any more
46
47
  */
47
48
  async getVariableNameTooltip() {
48
- if (VariableSectionItem.versionInfo.version >= '1.88.0') {
49
+ if ((0, compare_versions_1.satisfies)(VariableSectionItem.versionInfo.version, '>=1.88.0')) {
49
50
  throw Error(`DEPRECATED METHOD! For VS Code 1.88+ this method won't be working any more.`);
50
51
  }
51
52
  const name = await this.findElement(VariableSectionItem.locators.VariableSectionItem.name.constructor);
@@ -57,7 +58,7 @@ class VariableSectionItem extends CustomTreeItem_1.CustomTreeItem {
57
58
  * @deprecated For VS Code 1.89+ this method won't be working any more
58
59
  */
59
60
  async getVariableValueTooltip() {
60
- if (VariableSectionItem.versionInfo.version >= '1.89.0') {
61
+ if ((0, compare_versions_1.satisfies)(VariableSectionItem.versionInfo.version, '>=1.89.0')) {
61
62
  throw Error(`DEPRECATED METHOD! For VS Code 1.89+ this method won't be working any more.`);
62
63
  }
63
64
  const value = await this.findElement(VariableSectionItem.locators.VariableSectionItem.value.constructor);
@@ -20,6 +20,7 @@ exports.CenterNotification = exports.StandaloneNotification = exports.Notificati
20
20
  const ElementWithContextMenu_1 = require("../ElementWithContextMenu");
21
21
  const AbstractElement_1 = require("../AbstractElement");
22
22
  const selenium_webdriver_1 = require("selenium-webdriver");
23
+ const compare_versions_1 = require("compare-versions");
23
24
  /**
24
25
  * Available types of notifications
25
26
  */
@@ -63,7 +64,7 @@ class Notification extends ElementWithContextMenu_1.ElementWithContextMenu {
63
64
  * @deprecated For VS Code 1.88+ this method won't be working any more
64
65
  */
65
66
  async getSource() {
66
- if (Notification.versionInfo.version >= '1.88.0') {
67
+ if ((0, compare_versions_1.satisfies)(Notification.versionInfo.version, '>=1.88.0')) {
67
68
  throw Error(`DEPRECATED METHOD! For VS Code 1.88+ this method won't be working any more.`);
68
69
  }
69
70
  await this.expand();
@@ -29,6 +29,7 @@ const Notification_1 = require("./Notification");
29
29
  const QuickOpenBox_1 = require("./input/QuickOpenBox");
30
30
  const SettingsEditor_1 = require("../editor/SettingsEditor");
31
31
  const InputBox_1 = require("./input/InputBox");
32
+ const compare_versions_1 = require("compare-versions");
32
33
  /**
33
34
  * Handler for general workbench related actions
34
35
  */
@@ -125,7 +126,7 @@ class Workbench extends AbstractElement_1.AbstractElement {
125
126
  }
126
127
  const driver = this.getDriver();
127
128
  await driver.actions().keyDown(Workbench.ctlKey).keyDown(selenium_webdriver_1.Key.SHIFT).sendKeys('p').perform();
128
- if (Workbench.versionInfo.version >= '1.44.0') {
129
+ if ((0, compare_versions_1.satisfies)(Workbench.versionInfo.version, '>=1.44.0')) {
129
130
  return await InputBox_1.InputBox.create();
130
131
  }
131
132
  return await QuickOpenBox_1.QuickOpenBox.create();
@@ -288,6 +288,7 @@ export interface Locators {
288
288
  titleText: string;
289
289
  header: By;
290
290
  headerExpanded: string;
291
+ headerCollapseExpandButton: By;
291
292
  actions: By;
292
293
  actionConstructor: (label: string) => By;
293
294
  button: By;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-developer/page-objects",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Page Object API implementation for a VS Code editor used by ExTester framework.",
5
5
  "main": "out/index.js",
6
6
  "types": "out/index.d.ts",
@@ -40,12 +40,12 @@
40
40
  "clipboardy": "^4.0.0",
41
41
  "clone-deep": "^4.0.1",
42
42
  "compare-versions": "^6.1.1",
43
- "fs-extra": "^11.2.0",
44
- "type-fest": "^4.31.0"
43
+ "fs-extra": "^11.3.0",
44
+ "type-fest": "^4.35.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "selenium-webdriver": ">=4.6.1",
48
48
  "typescript": ">=4.6.2"
49
49
  },
50
- "gitHead": "ee887332c09744c7446d3182f6ae3946c2b5a050"
50
+ "gitHead": "bf17db769fb699fe9a47325ff6e0c94dc821ae0f"
51
51
  }