@openfin/automation-helpers
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "@openfin/automation-helpers", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Helper methods for automation testing in the OpenFin ecosystem", | ||
@@ -5,0 +5,0 @@ "authors": [ |
export * from "./globals"; | ||
export * from "./models/elementReference"; | ||
export * from "./models/IWebDriver"; | ||
@@ -4,0 +3,0 @@ export * from "./models/IWebDriverElement"; |
@@ -55,3 +55,3 @@ import type { IWebDriverElement } from "./IWebDriverElement"; | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -58,0 +58,0 @@ * Find elements. |
@@ -12,3 +12,3 @@ import type { LocatorTypes } from "./locatorTypes"; | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -15,0 +15,0 @@ * Find elements. |
@@ -19,4 +19,5 @@ import type { IWebDriverElement } from "../models/IWebDriverElement"; | ||
* @param searchInput The input to search for. | ||
* @param timeoutMs The timeout to wait for results. | ||
*/ | ||
static search(searchInput: string): Promise<void>; | ||
static search(searchInput: string, timeoutMs?: number): Promise<void>; | ||
/** | ||
@@ -32,3 +33,3 @@ * Clear the search on the home page. | ||
*/ | ||
static searchResultByIndex(index: number, operation?: "open" | "select"): Promise<IWebDriverElement>; | ||
static searchResultByIndex(index: number, operation?: "open" | "select"): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -40,3 +41,3 @@ * Select a search result from the home page by id. | ||
*/ | ||
static searchResultById(id: string, operation?: "open" | "select"): Promise<IWebDriverElement>; | ||
static searchResultById(id: string, operation?: "open" | "select"): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -43,0 +44,0 @@ * Get a list of the search results ids. |
import type { ApplicationInfo } from "@openfin/core/src/api/system/application"; | ||
import type { WindowInfo } from "@openfin/core/src/api/system/window"; | ||
import type { WindowDetail, WindowInfo } from "@openfin/core/src/api/system/window"; | ||
/** | ||
@@ -33,2 +33,15 @@ * Methods for OpenFin System object handling. | ||
static getWindowsInfo(): Promise<WindowInfo[]>; | ||
/** | ||
* Find window details by name. | ||
* @param name The name of the window. | ||
* @returns The window details if the window exists. | ||
*/ | ||
static getWindowDetail(name: string): Promise<WindowDetail | undefined>; | ||
/** | ||
* Wait for a window to be shown. | ||
* @param name The name of the window. | ||
* @param timeoutMs The timeout in ms to wait. | ||
* @returns True if the window is showing. | ||
*/ | ||
static waitForWindow(name: string, timeoutMs: number): Promise<boolean>; | ||
} |
@@ -66,3 +66,3 @@ import { type Client } from "webdriver"; | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -69,0 +69,0 @@ * Find elements. |
import type { Client } from "webdriver"; | ||
import type { ElementReference } from "../models/elementReference"; | ||
import type { IWebDriverElement } from "../models/IWebDriverElement"; | ||
@@ -16,10 +15,16 @@ import type { LocatorTypes } from "../models/locatorTypes"; | ||
*/ | ||
private readonly _reference; | ||
private readonly _elementId; | ||
/** | ||
* Create a new instance of NodeWebDriverElement. | ||
* @param client The client to use for chromedriver calls. | ||
* @param reference The reference to the element. | ||
* @param elementId The reference to the element. | ||
*/ | ||
constructor(client: Client, reference: ElementReference); | ||
constructor(client: Client, elementId: string); | ||
/** | ||
* Get an element id from an element reference. | ||
* @param elementReference The element reference to get the element id from. | ||
* @returns The element id. | ||
*/ | ||
static elementIdFromReference(elementReference: Record<"element-6066-11e4-a52e-4f735466cecf", string | undefined>): string | undefined; | ||
/** | ||
* Find an element. | ||
@@ -30,3 +35,3 @@ * @param locator The locator to use when finding the element. | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -56,8 +61,2 @@ * Find elements. | ||
getAttribute(attribute: string): Promise<string>; | ||
/** | ||
* Get an element id from an element reference. | ||
* @param elementReference The element reference to get the element id from. | ||
* @returns The element id. | ||
*/ | ||
elementIdFromReference(elementReference: ElementReference): string; | ||
} |
@@ -66,3 +66,3 @@ import { type ThenableWebDriver } from "selenium-webdriver"; | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -69,0 +69,0 @@ * Find elements. |
@@ -28,3 +28,3 @@ import type { ThenableWebDriver, WebElement } from "selenium-webdriver"; | ||
*/ | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement>; | ||
findElement(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -31,0 +31,0 @@ * Find elements. |
import type { IWebDriverElement } from "../models/IWebDriverElement"; | ||
import type { LocatorTypes } from "../models/locatorTypes"; | ||
/** | ||
@@ -15,2 +16,12 @@ * Global webdriver wrapper with non driver specific code. | ||
/** | ||
* Call a JavaScript method until a condition is met, or timed out. | ||
* @param method The method to call on the OpenFin object. | ||
* @param params Parameters to call the object with. | ||
* @param callAsync Call the method as async. | ||
* @param condition Condition to test before returning. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The result from the call. | ||
*/ | ||
static callMethodUntilCondition<T>(method: string, params: (string | object | number | boolean | undefined)[] | undefined, callAsync: boolean, condition: (result: T | Error) => boolean, timeoutMs: number): Promise<T | Error | unknown>; | ||
/** | ||
* Wait for an object to exist in the windows namespace. | ||
@@ -56,3 +67,3 @@ * @param objectPath The name of the object to wait for. | ||
*/ | ||
static waitForWindow(title: string, timeoutMs: number): Promise<boolean>; | ||
static waitForWindowByTitle(title: string, timeoutMs: number): Promise<boolean>; | ||
/** | ||
@@ -75,4 +86,11 @@ * Wait for a window by its URL. | ||
*/ | ||
static findElementByPath(path: string): Promise<IWebDriverElement>; | ||
static findElementByPath(path: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Wait for an element by its xpath. | ||
* @param path The path the element to find. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static waitForElementByPath(path: string, timeoutMs: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find elements by their xpath. | ||
@@ -84,2 +102,8 @@ * @param path The path the element to find. | ||
/** | ||
* Find an element by its tag. | ||
* @param tag The tag of the element to find. | ||
* @returns The element if found. | ||
*/ | ||
static findElementByTag(tag: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find all elements by their tag. | ||
@@ -91,2 +115,9 @@ * @param tag The tag of the element to find. | ||
/** | ||
* Wait for an element by its tag. | ||
* @param tag The tag of the element to find. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static waitForElementByTag(tag: string, timeoutMs: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find an element by css selector. | ||
@@ -96,3 +127,3 @@ * @param cssSelector The css selector of the element to find. | ||
*/ | ||
static findElementByCssSelector(cssSelector: string): Promise<IWebDriverElement>; | ||
static findElementByCssSelector(cssSelector: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -105,2 +136,9 @@ * Find all elements by their css selector. | ||
/** | ||
* Wait for an element by its css selector. | ||
* @param cssSelector The css selector of the element to find. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static waitForElementByCssSelector(cssSelector: string, timeoutMs: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find an element by its id. | ||
@@ -110,9 +148,10 @@ * @param id The id of the element to find. | ||
*/ | ||
static findElementById(id: string): Promise<IWebDriverElement>; | ||
static findElementById(id: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find an element by its tag. | ||
* @param tag The tag of the element to find. | ||
* @returns The element if found. | ||
* Wait for an element by its id. | ||
* @param id The id of the element to find. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static findElementByTag(tag: string): Promise<IWebDriverElement>; | ||
static waitForElementById(id: string, timeoutMs: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -124,3 +163,3 @@ * Find an element by its class. | ||
*/ | ||
static findElementByClass(className: string, tag?: string): Promise<IWebDriverElement>; | ||
static findElementByClass(className: string, tag?: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
@@ -134,2 +173,32 @@ * Find all elements by their class. | ||
/** | ||
* Wait for an element by its class. | ||
* @param className The class of the element to find. | ||
* @param tag The tag of the element to find defaults to all. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static waitForElementByClass(className: string, tag?: string, timeoutMs?: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find an element. | ||
* @param locator The locator to use when finding the element. | ||
* @param value The value to use with the locator. | ||
* @returns The element if found. | ||
*/ | ||
static findElementByLocator(locator: LocatorTypes, value: string): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Find elements. | ||
* @param locator The locator to use when finding the elements. | ||
* @param value The value to use with the locator. | ||
* @returns The elements if found. | ||
*/ | ||
static findElementsByLocator(locator: LocatorTypes, value: string): Promise<IWebDriverElement[]>; | ||
/** | ||
* Wait for an element by its locator. | ||
* @param locator The locator to use when finding the elements. | ||
* @param value The value to use with the locator. | ||
* @param timeoutMs The amount of time to wait for the object. | ||
* @returns The element if found or undefined if not found within timeout. | ||
*/ | ||
static waitForElementByLocator(locator: LocatorTypes, value: string, timeoutMs: number): Promise<IWebDriverElement | undefined>; | ||
/** | ||
* Set an element attribute by xpath. | ||
@@ -136,0 +205,0 @@ * @param path The path of the element to set. |
Sorry, the diff of this file is too big to display
216428
2492
16