@redhat-developer/page-objects
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -37,3 +37,3 @@ "use strict"; | ||
constructor(base, enclosingItem) { | ||
let item = AbstractElement.driver.findElement(selenium_webdriver_1.By.css('html')); | ||
let item = AbstractElement.driver.findElement(AbstractElement.locators.AbstractElement.tag); | ||
if (!enclosingItem) { | ||
@@ -40,0 +40,0 @@ enclosingItem = item; |
@@ -111,3 +111,3 @@ "use strict"; | ||
else { | ||
const label = await tabContainer.findElement(selenium_webdriver_1.By.xpath(`.//a[starts-with(@aria-label, '${title}')]`)); | ||
const label = await tabContainer.findElement(BottomBarPanel.locators.BottomBarPanel.openTabElement(title)); | ||
await label.click(); | ||
@@ -114,0 +114,0 @@ } |
@@ -37,3 +37,3 @@ "use strict"; | ||
await this.click(); | ||
const shadowRootHost = await this.enclosingItem.findElements(__1.By.className('shadow-root-host')); | ||
const shadowRootHost = await this.enclosingItem.findElements(EditorAction.locators.EditorAction.shadowRootHost); | ||
const actions = this.getDriver().actions(); | ||
@@ -53,3 +53,3 @@ await actions.clear(); | ||
shadowRoot = await shadowRootHost[0].getShadowRoot(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(__1.By.className('monaco-menu-container'))).wait(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(EditorAction.locators.EditorAction.monacoMenuContainer)).wait(); | ||
} | ||
@@ -56,0 +56,0 @@ else { |
@@ -353,3 +353,3 @@ "use strict"; | ||
// click 'Add Item' button | ||
const button = await this.findElement(SettingsEditor.locators.SettingsEditor.arrayNewRow).findElement(selenium_webdriver_1.By.className('monaco-button')); | ||
const button = await this.findElement(SettingsEditor.locators.SettingsEditor.arrayNewRow).findElement(SettingsEditor.locators.SettingsEditor.button); | ||
await button.click(); | ||
@@ -356,0 +356,0 @@ await new Promise((sleep) => setTimeout(sleep, 1_000)); // need to force some time to allow DOM rerender elements |
@@ -486,3 +486,3 @@ "use strict"; | ||
await this.getDriver().actions().contextClick(this).perform(); | ||
const shadowRootHost = await this.enclosingItem.findElements(selenium_webdriver_1.By.className('shadow-root-host')); | ||
const shadowRootHost = await this.enclosingItem.findElements(TextEditor.locators.TextEditor.shadowRootHost); | ||
if (shadowRootHost.length > 0) { | ||
@@ -494,3 +494,3 @@ let shadowRoot; | ||
shadowRoot = await shadowRootHost[0].getShadowRoot(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(TextEditor.locators.TextEditor.monacoMenuContainer)).wait(); | ||
} | ||
@@ -529,3 +529,3 @@ else { | ||
const lineOverlay = await margin.findElement(TextEditor.locators.TextEditor.lineOverlay(line)); | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : lineOverlay; | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : lineOverlay; | ||
const breakPoint = await breakpointContainer.findElements(TextEditor.locators.TextEditor.breakpoint.generalSelector); | ||
@@ -555,3 +555,3 @@ if (breakPoint.length > 0) { | ||
const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint; | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : this; | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this; | ||
const breakpoints = await breakpointContainer.findElements(breakpointLocators.pauseSelector); | ||
@@ -568,6 +568,6 @@ if (breakpoints.length === 0) { | ||
const styleTopAttr = await breakpoints[0].getCssValue('top'); | ||
lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(selenium_webdriver_1.By.xpath(`.//div[contains(@style, "${styleTopAttr}")]`)); | ||
lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr)); | ||
} | ||
else { | ||
lineElement = await breakpoints[0].findElement(selenium_webdriver_1.By.xpath('./..')); | ||
lineElement = await breakpoints[0].findElement(TextEditor.locators.TextEditor.elementLevelBack); | ||
} | ||
@@ -597,3 +597,3 @@ return new Breakpoint_1.Breakpoint(breakpoints[0], lineElement); | ||
const breakpointLocators = Breakpoint_1.Breakpoint.locators.TextEditor.breakpoint; | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(selenium_webdriver_1.By.className('glyph-margin-widgets')) : this; | ||
const breakpointContainer = TextEditor.versionInfo.version >= '1.80.0' ? await this.findElement(TextEditor.locators.TextEditor.glyphMarginWidget) : this; | ||
const breakpointsSelectors = await breakpointContainer.findElements(breakpointLocators.generalSelector); | ||
@@ -604,6 +604,6 @@ for (const breakpointSelector of breakpointsSelectors) { | ||
const styleTopAttr = await breakpointSelector.getCssValue('top'); | ||
lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(selenium_webdriver_1.By.xpath(`.//div[contains(@style, "${styleTopAttr}")]`)); | ||
lineElement = await this.findElement(TextEditor.locators.TextEditor.marginArea).findElement(TextEditor.locators.TextEditor.lineElement(styleTopAttr)); | ||
} | ||
else { | ||
lineElement = await breakpointSelector.findElement(selenium_webdriver_1.By.xpath('./..')); | ||
lineElement = await breakpointSelector.findElement(TextEditor.locators.TextEditor.elementLevelBack); | ||
} | ||
@@ -620,4 +620,4 @@ breakpoints.push(new Breakpoint_1.Breakpoint(breakpointSelector, lineElement)); | ||
const lenses = []; | ||
const widgets = await this.findElement(selenium_webdriver_1.By.className('contentWidgets')); | ||
const items = await widgets.findElements(selenium_webdriver_1.By.xpath(`.//span[contains(@widgetid, 'codelens.widget')]/a[@id]`)); | ||
const widgets = await this.findElement(TextEditor.locators.TextEditor.contentWidgets); | ||
const items = await widgets.findElements(TextEditor.locators.TextEditor.contentWidgetsElements); | ||
for (const item of items) { | ||
@@ -662,3 +662,3 @@ lenses.push(await new CodeLens(item, this).wait()); | ||
await this.getDriver().actions().contextClick(this).perform(); | ||
const shadowRootHost = await ed.getEnclosingElement().findElements(selenium_webdriver_1.By.className('shadow-root-host')); | ||
const shadowRootHost = await ed.getEnclosingElement().findElements(TextEditor.locators.TextEditor.shadowRootHost); | ||
if (shadowRootHost.length > 0) { | ||
@@ -670,3 +670,3 @@ let shadowRoot; | ||
shadowRoot = await shadowRootHost[0].getShadowRoot(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(TextEditor.locators.TextEditor.monacoMenuContainer)).wait(); | ||
} | ||
@@ -756,4 +756,3 @@ else { | ||
async nextMatch() { | ||
const name = TextEditor.versionInfo.version < '1.59.0' ? 'Next match' : 'Next Match'; | ||
await this.clickButton(name, 'find'); | ||
await this.clickButton(FindWidget.locators.FindWidget.nextMatch, 'find'); | ||
} | ||
@@ -764,4 +763,3 @@ /** | ||
async previousMatch() { | ||
const name = TextEditor.versionInfo.version < '1.59.0' ? 'Previous match' : 'Previous Match'; | ||
await this.clickButton(name, 'find'); | ||
await this.clickButton(FindWidget.locators.FindWidget.previousMatch, 'find'); | ||
} | ||
@@ -784,3 +782,3 @@ /** | ||
async close() { | ||
const part = TextEditor.versionInfo.version >= '1,80.0' ? 'close' : 'find'; | ||
const part = TextEditor.versionInfo.version >= '1.80.0' ? 'close' : 'find'; | ||
await this.clickButton('Close', part); | ||
@@ -787,0 +785,0 @@ } |
@@ -65,3 +65,3 @@ "use strict"; | ||
if (ScmView_1.ScmProvider.versionInfo.version >= '1.93.0') { | ||
const header = await view.findElement(selenium_webdriver_1.By.xpath(`.//div[@aria-label='Source Control Section']`)); | ||
const header = await view.findElement(ScmView_1.ScmView.locators.ScmView.sourceControlSection); | ||
actions = await header.findElements(ScmView_1.ScmProvider.locators.ScmView.action); | ||
@@ -68,0 +68,0 @@ names = await Promise.all(actions.map(async (action) => await action.getAttribute(ScmView_1.ScmProvider.locators.ScmView.actionLabel))); |
@@ -260,3 +260,3 @@ "use strict"; | ||
await this.click(); | ||
const shadowRootHost = await this.enclosingItem.findElements(selenium_webdriver_1.By.className('shadow-root-host')); | ||
const shadowRootHost = await this.enclosingItem.findElements(ScmView.locators.ScmView.shadowRootHost); | ||
const actions = this.getDriver().actions(); | ||
@@ -276,3 +276,3 @@ await actions.clear(); | ||
shadowRoot = await shadowRootHost[0].getShadowRoot(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(ScmView.locators.ScmView.monacoMenuContainer)).wait(); | ||
} | ||
@@ -279,0 +279,0 @@ else { |
@@ -136,3 +136,3 @@ "use strict"; | ||
await this.click(); | ||
const shadowRootHost = await section.findElements(selenium_webdriver_1.By.className('shadow-root-host')); | ||
const shadowRootHost = await section.findElements(ViewSection.locators.ViewSection.shadowRootHost); | ||
if (shadowRootHost.length > 0) { | ||
@@ -144,3 +144,3 @@ let shadowRoot; | ||
shadowRoot = await shadowRootHost[0].getShadowRoot(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(selenium_webdriver_1.By.className('monaco-menu-container'))).wait(); | ||
return new __1.ContextMenu(await shadowRoot.findElement(ViewSection.locators.ViewSection.monacoMenuContainer)).wait(); | ||
} | ||
@@ -147,0 +147,0 @@ else { |
@@ -171,3 +171,3 @@ "use strict"; | ||
async getPartText(locator) { | ||
return await this.findElement(locator).findElement(selenium_webdriver_1.By.css('a')).getAttribute('innerHTML'); | ||
return await this.findElement(locator).findElement(StatusBar.locators.StatusBar.aTag).getAttribute('innerHTML'); | ||
} | ||
@@ -174,0 +174,0 @@ } |
@@ -18,2 +18,3 @@ /** | ||
import { AbstractElement } from '../../AbstractElement'; | ||
import { WebElement } from 'selenium-webdriver'; | ||
/** | ||
@@ -129,2 +130,23 @@ * Abstract page object for input fields | ||
isSelected(): Promise<boolean>; | ||
/** | ||
* Retrieve the actions on QuickPickItem. | ||
* @returns Promise resolving to array of QuickInputAction objects. | ||
*/ | ||
getActions(): Promise<QuickInputAction[]>; | ||
/** | ||
* Retrieve the specific action on QuickPickItem. | ||
* @param label Name of QuickPickItem. | ||
* @returns Promise resolving QuickInputAction if item exists or undefined. | ||
*/ | ||
getAction(label: string): Promise<QuickInputAction | undefined>; | ||
} | ||
/** | ||
* Action bound to a QuickPickItem. | ||
*/ | ||
export declare class QuickInputAction extends AbstractElement { | ||
constructor(element: WebElement, viewPart: QuickPickItem); | ||
/** | ||
* Get label of the action button. | ||
*/ | ||
getLabel(): Promise<string>; | ||
} |
@@ -19,3 +19,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.QuickPickItem = exports.Input = void 0; | ||
exports.QuickInputAction = exports.QuickPickItem = exports.Input = void 0; | ||
const AbstractElement_1 = require("../../AbstractElement"); | ||
@@ -268,4 +268,48 @@ const selenium_webdriver_1 = require("selenium-webdriver"); | ||
} | ||
/** | ||
* Retrieve the actions on QuickPickItem. | ||
* @returns Promise resolving to array of QuickInputAction objects. | ||
*/ | ||
async getActions() { | ||
const actions = []; | ||
const elements = await this.findElements(Input.locators.Input.button); | ||
for (const element of elements) { | ||
actions.push(await new QuickInputAction(element, this).wait()); | ||
} | ||
return actions; | ||
} | ||
/** | ||
* Retrieve the specific action on QuickPickItem. | ||
* @param label Name of QuickPickItem. | ||
* @returns Promise resolving QuickInputAction if item exists or undefined. | ||
*/ | ||
async getAction(label) { | ||
const actions = await this.getActions(); | ||
for (const action of actions) { | ||
if ((await action.getLabel()) === label) { | ||
return action; | ||
} | ||
} | ||
} | ||
} | ||
exports.QuickPickItem = QuickPickItem; | ||
/** | ||
* Action bound to a QuickPickItem. | ||
*/ | ||
class QuickInputAction extends AbstractElement_1.AbstractElement { | ||
constructor(element, viewPart) { | ||
super(element, viewPart); | ||
} | ||
/** | ||
* Get label of the action button. | ||
*/ | ||
async getLabel() { | ||
const value = await this.getAttribute(Input.locators.ViewSection.buttonLabel); | ||
if (value === null) { | ||
throw new __1.NullAttributeError(`${this.constructor.name}.getLabel returned null`); | ||
} | ||
return value; | ||
} | ||
} | ||
exports.QuickInputAction = QuickInputAction; | ||
//# sourceMappingURL=Input.js.map |
@@ -29,2 +29,3 @@ /** | ||
selected: WebElementFunction<WebElement, boolean>; | ||
tag: By; | ||
}; | ||
@@ -60,2 +61,3 @@ ActivityBar: { | ||
closeAction: By; | ||
openTabElement: (title: string) => By; | ||
}; | ||
@@ -149,2 +151,9 @@ BottomBarViews: { | ||
findWidget: By; | ||
shadowRootHost: By; | ||
monacoMenuContainer: By; | ||
glyphMarginWidget: By; | ||
lineElement: (styleTopAttr: string) => By; | ||
contentWidgets: By; | ||
contentWidgetsElements: By; | ||
elementLevelBack: By; | ||
}; | ||
@@ -160,2 +169,4 @@ FindWidget: { | ||
checkbox: (title: string) => By; | ||
nextMatch: string; | ||
previousMatch: string; | ||
}; | ||
@@ -201,2 +212,3 @@ ContentAssist: { | ||
}; | ||
button: By; | ||
}; | ||
@@ -234,2 +246,6 @@ DiffEditor: { | ||
}; | ||
EditorAction: { | ||
shadowRootHost: By; | ||
monacoMenuContainer: By; | ||
}; | ||
ContextMenu: { | ||
@@ -288,2 +304,4 @@ contextView: By; | ||
welcomeContent: By; | ||
shadowRootHost: By; | ||
monacoMenuContainer: By; | ||
}; | ||
@@ -429,2 +447,5 @@ TreeItem: { | ||
itemIndex: (index: number) => By; | ||
shadowRootHost: By; | ||
monacoMenuContainer: By; | ||
sourceControlSection: By; | ||
}; | ||
@@ -453,2 +474,3 @@ DebugView: { | ||
itemTitle: string; | ||
aTag: By; | ||
}; | ||
@@ -496,2 +518,4 @@ Workbench: { | ||
multiSelectIndex: (index: number) => By; | ||
button: By; | ||
buttonLabel: string; | ||
}; | ||
@@ -498,0 +522,0 @@ InputBox: { |
{ | ||
"name": "@redhat-developer/page-objects", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"description": "Page Object API implementation for a VS Code editor used by ExTester framework.", | ||
@@ -44,3 +44,3 @@ "main": "out/index.js", | ||
"fs-extra": "^11.2.0", | ||
"type-fest": "^4.26.1" | ||
"type-fest": "^4.27.0" | ||
}, | ||
@@ -51,3 +51,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "f45222ba83c369def4e95fefaa1ceba5a96e181e" | ||
"gitHead": "6e684d06e92ee59f19e28f96158f8798045114c3" | ||
} |
509420
12250
Updatedtype-fest@^4.27.0