@redhat-developer/page-objects 1.6.2 → 1.8.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.
@@ -34,7 +34,7 @@ class AbstractElement extends selenium_webdriver_1.WebElement {
34
34
  * this will be used to narrow down the search for the underlying DOM element
35
35
  */
36
36
  constructor(base, enclosingItem) {
37
- let item = AbstractElement.driver.findElement(selenium_webdriver_1.By.css('html'));
37
+ let item = AbstractElement.driver.findElement(AbstractElement.locators.AbstractElement.tag);
38
38
  if (!enclosingItem) {
39
39
  enclosingItem = item;
40
40
  }
@@ -108,7 +108,7 @@ class BottomBarPanel extends AbstractElement_1.AbstractElement {
108
108
  await tabs[0].click();
109
109
  }
110
110
  else {
111
- const label = await tabContainer.findElement(selenium_webdriver_1.By.xpath(`.//a[starts-with(@aria-label, '${title}')]`));
111
+ const label = await tabContainer.findElement(BottomBarPanel.locators.BottomBarPanel.openTabElement(title));
112
112
  await label.click();
113
113
  }
114
114
  }
@@ -34,7 +34,7 @@ exports.EditorAction = EditorAction;
34
34
  class EditorActionDropdown extends EditorAction {
35
35
  async open() {
36
36
  await this.click();
37
- const shadowRootHost = await this.enclosingItem.findElements(__1.By.className('shadow-root-host'));
37
+ const shadowRootHost = await this.enclosingItem.findElements(EditorAction.locators.EditorAction.shadowRootHost);
38
38
  const actions = this.getDriver().actions();
39
39
  await actions.clear();
40
40
  await actions.sendKeys(__1.Key.ESCAPE).perform();
@@ -49,7 +49,7 @@ class EditorActionDropdown extends EditorAction {
49
49
  const chromiumVersion = webdriverCapabilities.getBrowserVersion();
50
50
  if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
51
51
  shadowRoot = await shadowRootHost[0].getShadowRoot();
52
- return new __1.ContextMenu(await shadowRoot.findElement(__1.By.className('monaco-menu-container'))).wait();
52
+ return new __1.ContextMenu(await shadowRoot.findElement(EditorAction.locators.EditorAction.monacoMenuContainer)).wait();
53
53
  }
54
54
  else {
55
55
  shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
@@ -350,7 +350,7 @@ class ArraySetting extends Setting {
350
350
  */
351
351
  async add() {
352
352
  // click 'Add Item' button
353
- const button = await this.findElement(SettingsEditor.locators.SettingsEditor.arrayNewRow).findElement(selenium_webdriver_1.By.className('monaco-button'));
353
+ const button = await this.findElement(SettingsEditor.locators.SettingsEditor.arrayNewRow).findElement(SettingsEditor.locators.SettingsEditor.button);
354
354
  await button.click();
355
355
  await new Promise((sleep) => setTimeout(sleep, 1_000)); // need to force some time to allow DOM rerender elements
356
356
  // get item row switched to 'edit' mode
@@ -483,14 +483,14 @@ class TextEditor extends Editor_1.Editor {
483
483
  }
484
484
  async openContextMenu() {
485
485
  await this.getDriver().actions().contextClick(this).perform();
486
- const shadowRootHost = await this.enclosingItem.findElements(selenium_webdriver_1.By.className('shadow-root-host'));
486
+ const shadowRootHost = await this.enclosingItem.findElements(TextEditor.locators.TextEditor.shadowRootHost);
487
487
  if (shadowRootHost.length > 0) {
488
488
  let shadowRoot;
489
489
  const webdriverCapabilities = await this.getDriver().getCapabilities();
490
490
  const chromiumVersion = webdriverCapabilities.getBrowserVersion();
491
491
  if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
492
492
  shadowRoot = await shadowRootHost[0].getShadowRoot();
493
- return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
493
+ return new __1.ContextMenu(await shadowRoot.findElement(TextEditor.locators.TextEditor.monacoMenuContainer)).wait();
494
494
  }
495
495
  else {
496
496
  shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
@@ -524,7 +524,7 @@ class TextEditor extends Editor_1.Editor {
524
524
  const lineNum = await margin.findElement(TextEditor.locators.TextEditor.lineNumber(line));
525
525
  await this.getDriver().actions().move({ origin: lineNum }).perform();
526
526
  const lineOverlay = await margin.findElement(TextEditor.locators.TextEditor.lineOverlay(line));
527
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : lineOverlay;
527
+ const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : lineOverlay;
528
528
  const breakPoint = await breakpointContainer.findElements(TextEditor.locators.TextEditor.breakpoint.generalSelector);
529
529
  if (breakPoint.length > 0) {
530
530
  if (this.breakPoints.indexOf(line) !== -1) {
@@ -549,7 +549,7 @@ class TextEditor extends Editor_1.Editor {
549
549
  */
550
550
  async getPausedBreakpoint() {
551
551
  const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint;
552
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : this;
552
+ const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this;
553
553
  const breakpoints = await breakpointContainer.findElements(breakpointLocators.pauseSelector);
554
554
  if (breakpoints.length === 0) {
555
555
  return undefined;
@@ -561,10 +561,10 @@ class TextEditor extends Editor_1.Editor {
561
561
  let lineElement;
562
562
  if (TextEditor.versionInfo.version >= '1.80.0') {
563
563
  const styleTopAttr = await breakpoints[0].getCssValue('top');
564
- lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(selenium_webdriver_1.By.xpath(`.//div[contains(@style, "${styleTopAttr}")]`));
564
+ lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr));
565
565
  }
566
566
  else {
567
- lineElement = await breakpoints[0].findElement(selenium_webdriver_1.By.xpath('./..'));
567
+ lineElement = await breakpoints[0].findElement(TextEditor.locators.TextEditor.elementLevelBack);
568
568
  }
569
569
  return new Breakpoint_1.Breakpoint(breakpoints[0], lineElement);
570
570
  }
@@ -589,16 +589,16 @@ class TextEditor extends Editor_1.Editor {
589
589
  async getBreakpoints() {
590
590
  const breakpoints = [];
591
591
  const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint;
592
- const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : this;
592
+ const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this;
593
593
  const breakpointsSelectors = await breakpointContainer.findElements(breakpointLocators.generalSelector);
594
594
  for (const breakpointSelector of breakpointsSelectors) {
595
595
  let lineElement;
596
596
  if (TextEditor.versionInfo.version >= '1.80.0') {
597
597
  const styleTopAttr = await breakpointSelector.getCssValue('top');
598
- lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(selenium_webdriver_1.By.xpath(`.//div[contains(@style, "${styleTopAttr}")]`));
598
+ lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr));
599
599
  }
600
600
  else {
601
- lineElement = await breakpointSelector.findElement(selenium_webdriver_1.By.xpath('./..'));
601
+ lineElement = await breakpointSelector.findElement(TextEditor.locators.TextEditor.elementLevelBack);
602
602
  }
603
603
  breakpoints.push(new Breakpoint_1.Breakpoint(breakpointSelector, lineElement));
604
604
  }
@@ -610,8 +610,8 @@ class TextEditor extends Editor_1.Editor {
610
610
  */
611
611
  async getCodeLenses() {
612
612
  const lenses = [];
613
- const widgets = await this.findElement(selenium_webdriver_1.By.className('contentWidgets'));
614
- const items = await widgets.findElements(selenium_webdriver_1.By.xpath(`.//span[contains(@widgetid, 'codelens.widget')]/a[@id]`));
613
+ const widgets = await this.findElement(TextEditor.locators.TextEditor.contentWidgets);
614
+ const items = await widgets.findElements(TextEditor.locators.TextEditor.contentWidgetsElements);
615
615
  for (const item of items) {
616
616
  lenses.push(await new CodeLens(item, this).wait());
617
617
  }
@@ -651,14 +651,14 @@ class Selection extends ElementWithContextMenu_1.ElementWithContextMenu {
651
651
  async openContextMenu() {
652
652
  const ed = this.getEnclosingElement();
653
653
  await this.getDriver().actions().contextClick(this).perform();
654
- const shadowRootHost = await ed.getEnclosingElement().findElements(selenium_webdriver_1.By.className('shadow-root-host'));
654
+ const shadowRootHost = await ed.getEnclosingElement().findElements(TextEditor.locators.TextEditor.shadowRootHost);
655
655
  if (shadowRootHost.length > 0) {
656
656
  let shadowRoot;
657
657
  const webdriverCapabilities = await this.getDriver().getCapabilities();
658
658
  const chromiumVersion = webdriverCapabilities.getBrowserVersion();
659
659
  if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
660
660
  shadowRoot = await shadowRootHost[0].getShadowRoot();
661
- return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
661
+ return new __1.ContextMenu(await shadowRoot.findElement(TextEditor.locators.TextEditor.monacoMenuContainer)).wait();
662
662
  }
663
663
  else {
664
664
  shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
@@ -743,15 +743,13 @@ class FindWidget extends AbstractElement_1.AbstractElement {
743
743
  * Click 'Next match'
744
744
  */
745
745
  async nextMatch() {
746
- const name = TextEditor.versionInfo.version < '1.59.0' ? 'Next match' : 'Next Match';
747
- await this.clickButton(name, 'find');
746
+ await this.clickButton(FindWidget.locators.FindWidget.nextMatch, 'find');
748
747
  }
749
748
  /**
750
749
  * Click 'Previous match'
751
750
  */
752
751
  async previousMatch() {
753
- const name = TextEditor.versionInfo.version < '1.59.0' ? 'Previous match' : 'Previous Match';
754
- await this.clickButton(name, 'find');
752
+ await this.clickButton(FindWidget.locators.FindWidget.previousMatch, 'find');
755
753
  }
756
754
  /**
757
755
  * Click 'Replace'. Only works in replace mode.
@@ -769,7 +767,7 @@ class FindWidget extends AbstractElement_1.AbstractElement {
769
767
  * Close the widget.
770
768
  */
771
769
  async close() {
772
- const part = TextEditor.versionInfo.version >= '1,80.0' ? 'close' : 'find';
770
+ const part = TextEditor.versionInfo.version >= '1.80.0' ? 'close' : 'find';
773
771
  await this.clickButton('Close', part);
774
772
  }
775
773
  /**
@@ -133,14 +133,14 @@ class ViewSection extends AbstractElement_1.AbstractElement {
133
133
  const btn = new (class extends ElementWithContextMenu_1.ElementWithContextMenu {
134
134
  async openContextMenu() {
135
135
  await this.click();
136
- const shadowRootHost = await section.findElements(selenium_webdriver_1.By.className('shadow-root-host'));
136
+ const shadowRootHost = await section.findElements(ViewSection.locators.ViewSection.shadowRootHost);
137
137
  if (shadowRootHost.length > 0) {
138
138
  let shadowRoot;
139
139
  const webdriverCapabilities = await this.getDriver().getCapabilities();
140
140
  const chromiumVersion = webdriverCapabilities.getBrowserVersion();
141
141
  if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
142
142
  shadowRoot = await shadowRootHost[0].getShadowRoot();
143
- return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
143
+ return new __1.ContextMenu(await shadowRoot.findElement(ViewSection.locators.ViewSection.monacoMenuContainer)).wait();
144
144
  }
145
145
  else {
146
146
  shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
@@ -18,6 +18,7 @@ import { SideBarView } from '../SideBarView';
18
18
  import { DebugBreakpointSection } from '../tree/debug/DebugBreakpointSection';
19
19
  import { DebugCallStackSection } from '../tree/debug/DebugCallStackSection';
20
20
  import { DebugVariableSection } from '../tree/debug/DebugVariablesSection';
21
+ import { WatchSection } from '../tree/debug/WatchSection';
21
22
  /**
22
23
  * Page object representing the Run/Debug view in the side bar
23
24
  */
@@ -53,4 +54,9 @@ export declare class DebugView extends SideBarView {
53
54
  * @returns CallStackSection page object
54
55
  */
55
56
  getCallStackSection(): Promise<DebugCallStackSection>;
57
+ /**
58
+ * Get Watch section
59
+ * @returns WatchSection page object
60
+ */
61
+ getWatchSection(): Promise<WatchSection>;
56
62
  }
@@ -21,6 +21,7 @@ const SideBarView_1 = require("../SideBarView");
21
21
  const DebugBreakpointSection_1 = require("../tree/debug/DebugBreakpointSection");
22
22
  const DebugCallStackSection_1 = require("../tree/debug/DebugCallStackSection");
23
23
  const DebugVariablesSection_1 = require("../tree/debug/DebugVariablesSection");
24
+ const WatchSection_1 = require("../tree/debug/WatchSection");
24
25
  /**
25
26
  * Page object representing the Run/Debug view in the side bar
26
27
  */
@@ -91,6 +92,14 @@ class DebugView extends SideBarView_1.SideBarView {
91
92
  const content = this.getContent();
92
93
  return content.getSection(DebugCallStackSection_1.DebugCallStackSection.locators.DebugCallStackSection.predicate, DebugCallStackSection_1.DebugCallStackSection);
93
94
  }
95
+ /**
96
+ * Get Watch section
97
+ * @returns WatchSection page object
98
+ */
99
+ async getWatchSection() {
100
+ const content = this.getContent();
101
+ return content.getSection(WatchSection_1.WatchSection.locators.WatchSection.predicate, WatchSection_1.WatchSection);
102
+ }
94
103
  }
95
104
  exports.DebugView = DebugView;
96
105
  //# sourceMappingURL=DebugView.js.map
@@ -62,7 +62,7 @@ class SingleScmProvider extends ScmView_1.ScmProvider {
62
62
  let names = [];
63
63
  const buttons = [];
64
64
  if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') {
65
- const header = await view.findElement(selenium_webdriver_1.By.xpath(`.//div[@aria-label='Source Control Section']`));
65
+ const header = await view.findElement(ScmView_1.ScmView.locators.ScmView.sourceControlSection);
66
66
  actions = await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action);
67
67
  names = await Promise.all(actions.map(async (action) => await action.getAttribute(ScmView_1.ScmProvider.locators.ScmView.actionLabel)));
68
68
  }
@@ -257,7 +257,7 @@ class MoreAction extends ElementWithContextMenu_1.ElementWithContextMenu {
257
257
  }
258
258
  async openContextMenu() {
259
259
  await this.click();
260
- const shadowRootHost = await this.enclosingItem.findElements(selenium_webdriver_1.By.className('shadow-root-host'));
260
+ const shadowRootHost = await this.enclosingItem.findElements(ScmView.locators.ScmView.shadowRootHost);
261
261
  const actions = this.getDriver().actions();
262
262
  await actions.clear();
263
263
  await actions.sendKeys(selenium_webdriver_1.Key.ESCAPE).perform();
@@ -272,7 +272,7 @@ class MoreAction extends ElementWithContextMenu_1.ElementWithContextMenu {
272
272
  const chromiumVersion = webdriverCapabilities.getBrowserVersion();
273
273
  if (chromiumVersion && parseInt(chromiumVersion.split('.')[0]) >= 96) {
274
274
  shadowRoot = await shadowRootHost[0].getShadowRoot();
275
- return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait();
275
+ return new __1.ContextMenu(await shadowRoot.findElement(ScmView.locators.ScmView.monacoMenuContainer)).wait();
276
276
  }
277
277
  else {
278
278
  shadowRoot = (await this.getDriver().executeScript('return arguments[0].shadowRoot', shadowRootHost[0]));
@@ -0,0 +1,40 @@
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 { WebElement } from 'selenium-webdriver';
18
+ import { ViewContent } from '../../ViewContent';
19
+ import { GenericCustomTreeSection } from '../custom/CustomTreeSection';
20
+ import { WatchSectionItem } from './WatchSectionItem';
21
+ export declare class WatchSection extends GenericCustomTreeSection<WatchSectionItem> {
22
+ constructor(panel: WebElement, viewContent: ViewContent);
23
+ /**
24
+ * Add item to Watch section.
25
+ * @param name
26
+ */
27
+ addItem(name: string): Promise<void>;
28
+ /**
29
+ * Click on 'Refresh' button.
30
+ */
31
+ refresh(): Promise<void>;
32
+ /**
33
+ * Remove all items in Watch seection by using 'Remove All Expression' button.
34
+ */
35
+ removeAllExpressions(): Promise<void>;
36
+ /**
37
+ * Collapse all items in Watch section by using 'Collapse All' button.
38
+ */
39
+ collapseAll(): Promise<void>;
40
+ }
@@ -0,0 +1,58 @@
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.WatchSection = void 0;
20
+ const selenium_webdriver_1 = require("selenium-webdriver");
21
+ const CustomTreeSection_1 = require("../custom/CustomTreeSection");
22
+ const WatchSectionItem_1 = require("./WatchSectionItem");
23
+ class WatchSection extends CustomTreeSection_1.GenericCustomTreeSection {
24
+ constructor(panel, viewContent) {
25
+ super(panel, viewContent, WatchSectionItem_1.WatchSectionItem);
26
+ }
27
+ /**
28
+ * Add item to Watch section.
29
+ * @param name
30
+ */
31
+ async addItem(name) {
32
+ await (await this.getAction(WatchSection.locators.WatchSection.addExpression))?.click();
33
+ await new Promise((res) => setTimeout(res, 1000));
34
+ const textInput = await this.findElement(WatchSection.locators.WatchSection.input);
35
+ await textInput.clear();
36
+ await textInput.sendKeys(name + selenium_webdriver_1.Key.ENTER);
37
+ }
38
+ /**
39
+ * Click on 'Refresh' button.
40
+ */
41
+ async refresh() {
42
+ await (await this.getAction(WatchSection.locators.WatchSection.refresh))?.click();
43
+ }
44
+ /**
45
+ * Remove all items in Watch seection by using 'Remove All Expression' button.
46
+ */
47
+ async removeAllExpressions() {
48
+ await (await this.getAction(WatchSection.locators.WatchSection.removeAll))?.click();
49
+ }
50
+ /**
51
+ * Collapse all items in Watch section by using 'Collapse All' button.
52
+ */
53
+ async collapseAll() {
54
+ await (await this.getAction(WatchSection.locators.WatchSection.collapseAll))?.click();
55
+ }
56
+ }
57
+ exports.WatchSection = WatchSection;
58
+ //# sourceMappingURL=WatchSection.js.map
@@ -0,0 +1,36 @@
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 { WebElement } from 'selenium-webdriver';
18
+ import { TreeSection } from '../TreeSection';
19
+ import { CustomTreeItem } from '../custom/CustomTreeItem';
20
+ export declare class WatchSectionItem extends CustomTreeItem {
21
+ constructor(element: WebElement, viewPart: TreeSection);
22
+ /**
23
+ * Get label of the Watch section item.
24
+ * @returns a promise resolving to Watch section item label string
25
+ */
26
+ getLabel(): Promise<string>;
27
+ /**
28
+ * Get value of the Watch section item.
29
+ * @returns a promise resolving to Watch section value label string
30
+ */
31
+ getValue(): Promise<string>;
32
+ /**
33
+ * Remove item from Watch section.
34
+ */
35
+ remove(): Promise<void>;
36
+ }
@@ -0,0 +1,50 @@
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.WatchSectionItem = void 0;
20
+ const CustomTreeItem_1 = require("../custom/CustomTreeItem");
21
+ class WatchSectionItem extends CustomTreeItem_1.CustomTreeItem {
22
+ constructor(element, viewPart) {
23
+ super(element, viewPart);
24
+ }
25
+ /**
26
+ * Get label of the Watch section item.
27
+ * @returns a promise resolving to Watch section item label string
28
+ */
29
+ async getLabel() {
30
+ const name = await this.findElement(WatchSectionItem.locators.WatchSectionItem.label);
31
+ return await name?.getAttribute('textContent');
32
+ }
33
+ /**
34
+ * Get value of the Watch section item.
35
+ * @returns a promise resolving to Watch section value label string
36
+ */
37
+ async getValue() {
38
+ const value = await this.findElement(WatchSectionItem.locators.WatchSectionItem.value);
39
+ return await value.getText();
40
+ }
41
+ /**
42
+ * Remove item from Watch section.
43
+ */
44
+ async remove() {
45
+ const button = await this.getActionButton(WatchSectionItem.locators.WatchSectionItem.remove);
46
+ await button?.click();
47
+ }
48
+ }
49
+ exports.WatchSectionItem = WatchSectionItem;
50
+ //# sourceMappingURL=WatchSectionItem.js.map
@@ -168,7 +168,7 @@ class StatusBar extends AbstractElement_1.AbstractElement {
168
168
  }
169
169
  }
170
170
  async getPartText(locator) {
171
- return await this.findElement(locator).findElement(selenium_webdriver_1.By.css('a')).getAttribute('innerHTML');
171
+ return await this.findElement(locator).findElement(StatusBar.locators.StatusBar.aTag).getAttribute('innerHTML');
172
172
  }
173
173
  }
174
174
  exports.StatusBar = StatusBar;
@@ -15,6 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { AbstractElement } from '../../AbstractElement';
18
+ import { WebElement } from 'selenium-webdriver';
18
19
  /**
19
20
  * Abstract page object for input fields
20
21
  */
@@ -125,4 +126,25 @@ export declare class QuickPickItem extends AbstractElement {
125
126
  * @returns Promise resolving to true/false.
126
127
  */
127
128
  isSelected(): Promise<boolean>;
129
+ /**
130
+ * Retrieve the actions on QuickPickItem.
131
+ * @returns Promise resolving to array of QuickInputAction objects.
132
+ */
133
+ getActions(): Promise<QuickInputAction[]>;
134
+ /**
135
+ * Retrieve the specific action on QuickPickItem.
136
+ * @param label Name of QuickPickItem.
137
+ * @returns Promise resolving QuickInputAction if item exists or undefined.
138
+ */
139
+ getAction(label: string): Promise<QuickInputAction | undefined>;
140
+ }
141
+ /**
142
+ * Action bound to a QuickPickItem.
143
+ */
144
+ export declare class QuickInputAction extends AbstractElement {
145
+ constructor(element: WebElement, viewPart: QuickPickItem);
146
+ /**
147
+ * Get label of the action button.
148
+ */
149
+ getLabel(): Promise<string>;
128
150
  }
@@ -16,7 +16,7 @@
16
16
  * limitations under the License.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.QuickPickItem = exports.Input = void 0;
19
+ exports.QuickInputAction = exports.QuickPickItem = exports.Input = void 0;
20
20
  const AbstractElement_1 = require("../../AbstractElement");
21
21
  const selenium_webdriver_1 = require("selenium-webdriver");
22
22
  const __1 = require("../../..");
@@ -264,6 +264,50 @@ class QuickPickItem extends AbstractElement_1.AbstractElement {
264
264
  }
265
265
  return false;
266
266
  }
267
+ /**
268
+ * Retrieve the actions on QuickPickItem.
269
+ * @returns Promise resolving to array of QuickInputAction objects.
270
+ */
271
+ async getActions() {
272
+ const actions = [];
273
+ const elements = await this.findElements(Input.locators.Input.button);
274
+ for (const element of elements) {
275
+ actions.push(await new QuickInputAction(element, this).wait());
276
+ }
277
+ return actions;
278
+ }
279
+ /**
280
+ * Retrieve the specific action on QuickPickItem.
281
+ * @param label Name of QuickPickItem.
282
+ * @returns Promise resolving QuickInputAction if item exists or undefined.
283
+ */
284
+ async getAction(label) {
285
+ const actions = await this.getActions();
286
+ for (const action of actions) {
287
+ if ((await action.getLabel()) === label) {
288
+ return action;
289
+ }
290
+ }
291
+ }
267
292
  }
268
293
  exports.QuickPickItem = QuickPickItem;
294
+ /**
295
+ * Action bound to a QuickPickItem.
296
+ */
297
+ class QuickInputAction extends AbstractElement_1.AbstractElement {
298
+ constructor(element, viewPart) {
299
+ super(element, viewPart);
300
+ }
301
+ /**
302
+ * Get label of the action button.
303
+ */
304
+ async getLabel() {
305
+ const value = await this.getAttribute(Input.locators.ViewSection.buttonLabel);
306
+ if (value === null) {
307
+ throw new __1.NullAttributeError(`${this.constructor.name}.getLabel returned null`);
308
+ }
309
+ return value;
310
+ }
311
+ }
312
+ exports.QuickInputAction = QuickInputAction;
269
313
  //# sourceMappingURL=Input.js.map
package/out/index.d.ts CHANGED
@@ -44,6 +44,8 @@ export * from './components/sidebar/tree/debug/DebugVariablesSection';
44
44
  export * from './components/sidebar/tree/debug/VariableSectionItem';
45
45
  export * from './components/sidebar/tree/debug/CallStackItem';
46
46
  export * from './components/sidebar/tree/debug/DebugCallStackSection';
47
+ export * from './components/sidebar/tree/debug/WatchSection';
48
+ export * from './components/sidebar/tree/debug/WatchSectionItem';
47
49
  export * from './components/sidebar/extensions/ExtensionsViewSection';
48
50
  export * from './components/sidebar/extensions/ExtensionsViewItem';
49
51
  export { ScmView, ScmProvider, ScmChange } from './components/sidebar/scm/ScmView';
package/out/index.js CHANGED
@@ -63,6 +63,8 @@ __exportStar(require("./components/sidebar/tree/debug/DebugVariablesSection"), e
63
63
  __exportStar(require("./components/sidebar/tree/debug/VariableSectionItem"), exports);
64
64
  __exportStar(require("./components/sidebar/tree/debug/CallStackItem"), exports);
65
65
  __exportStar(require("./components/sidebar/tree/debug/DebugCallStackSection"), exports);
66
+ __exportStar(require("./components/sidebar/tree/debug/WatchSection"), exports);
67
+ __exportStar(require("./components/sidebar/tree/debug/WatchSectionItem"), exports);
66
68
  __exportStar(require("./components/sidebar/extensions/ExtensionsViewSection"), exports);
67
69
  __exportStar(require("./components/sidebar/extensions/ExtensionsViewItem"), exports);
68
70
  var ScmView_1 = require("./components/sidebar/scm/ScmView");
@@ -26,6 +26,7 @@ export interface Locators {
26
26
  AbstractElement: {
27
27
  enabled: WebElementFunction<WebElement, boolean>;
28
28
  selected: WebElementFunction<WebElement, boolean>;
29
+ tag: By;
29
30
  };
30
31
  ActivityBar: {
31
32
  constructor: By;
@@ -56,6 +57,7 @@ export interface Locators {
56
57
  globalActions: By;
57
58
  action: (label: string) => By;
58
59
  closeAction: By;
60
+ openTabElement: (title: string) => By;
59
61
  };
60
62
  BottomBarViews: {
61
63
  actionsContainer: (label: string) => By;
@@ -144,6 +146,13 @@ export interface Locators {
144
146
  debugHint: By;
145
147
  selection: By;
146
148
  findWidget: By;
149
+ shadowRootHost: By;
150
+ monacoMenuContainer: By;
151
+ glyphMarginWidget: By;
152
+ lineElement: (styleTopAttr: string) => By;
153
+ contentWidgets: By;
154
+ contentWidgetsElements: By;
155
+ elementLevelBack: By;
147
156
  };
148
157
  FindWidget: {
149
158
  toggleReplace: By;
@@ -154,6 +163,8 @@ export interface Locators {
154
163
  content: By;
155
164
  button: (title: string) => By;
156
165
  checkbox: (title: string) => By;
166
+ nextMatch: string;
167
+ previousMatch: string;
157
168
  };
158
169
  ContentAssist: {
159
170
  constructor: By;
@@ -194,6 +205,7 @@ export interface Locators {
194
205
  arraySettingItem: {
195
206
  btnConstructor: (label: string) => By;
196
207
  };
208
+ button: By;
197
209
  };
198
210
  DiffEditor: {
199
211
  originalEditor: By;
@@ -226,6 +238,10 @@ export interface Locators {
226
238
  moreInfo: By;
227
239
  moreInfoElements: By;
228
240
  };
241
+ EditorAction: {
242
+ shadowRootHost: By;
243
+ monacoMenuContainer: By;
244
+ };
229
245
  ContextMenu: {
230
246
  contextView: By;
231
247
  constructor: By;
@@ -279,6 +295,8 @@ export interface Locators {
279
295
  level: string;
280
296
  index: string;
281
297
  welcomeContent: By;
298
+ shadowRootHost: By;
299
+ monacoMenuContainer: By;
282
300
  };
283
301
  TreeItem: {
284
302
  actions: By;
@@ -365,6 +383,19 @@ export interface Locators {
365
383
  label: By;
366
384
  text: By;
367
385
  };
386
+ WatchSection: {
387
+ predicate: WebElementFunction<ViewSection, boolean>;
388
+ input: By;
389
+ addExpression: string;
390
+ refresh: string;
391
+ removeAll: string;
392
+ collapseAll: string;
393
+ };
394
+ WatchSectionItem: {
395
+ label: By;
396
+ value: By;
397
+ remove: string;
398
+ };
368
399
  ExtensionsViewSection: {
369
400
  items: By;
370
401
  itemRow: By;
@@ -406,6 +437,9 @@ export interface Locators {
406
437
  multiProviderItem: By;
407
438
  itemLevel: (level: number) => By;
408
439
  itemIndex: (index: number) => By;
440
+ shadowRootHost: By;
441
+ monacoMenuContainer: By;
442
+ sourceControlSection: By;
409
443
  };
410
444
  DebugView: {
411
445
  launchCombo: By;
@@ -429,6 +463,7 @@ export interface Locators {
429
463
  bell: By;
430
464
  item: By;
431
465
  itemTitle: string;
466
+ aTag: By;
432
467
  };
433
468
  Workbench: {
434
469
  constructor: By;
@@ -471,6 +506,8 @@ export interface Locators {
471
506
  title: By;
472
507
  backButton: By;
473
508
  multiSelectIndex: (index: number) => By;
509
+ button: By;
510
+ buttonLabel: string;
474
511
  };
475
512
  InputBox: {
476
513
  constructor: By;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-developer/page-objects",
3
- "version": "1.6.2",
3
+ "version": "1.8.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",
@@ -41,11 +41,11 @@
41
41
  "clone-deep": "^4.0.1",
42
42
  "compare-versions": "^6.1.1",
43
43
  "fs-extra": "^11.2.0",
44
- "type-fest": "^4.26.1"
44
+ "type-fest": "^4.27.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "selenium-webdriver": ">=4.6.1",
48
48
  "typescript": ">=4.6.2"
49
49
  },
50
- "gitHead": "a9144c9ea4658d99a0eb32d9a371de8d0feff256"
50
+ "gitHead": "6e684d06e92ee59f19e28f96158f8798045114c3"
51
51
  }