@flood/chrome
Advanced tools
Comparing version 0.1.6 to 0.1.7
219
index.d.ts
@@ -125,39 +125,64 @@ // Type definitions for @flood/browser-test 0.1.0 | ||
/** | ||
* Creates a waiter which will pause the test until a condition is met or a timeout is reached. | ||
* | ||
* You can use either a numeric value in seconds to wait for a specific time, | ||
* or a {@linkcode Condition}, for more flexible conditions. | ||
*/ | ||
public wait(timeoutOrCondition: Condition | number): Promise<boolean> | ||
/** | ||
* Sends a click event to the element located at `selector`. If the element is | ||
* currently outside the viewport it will first scroll to that element. | ||
* | ||
* @param {string} selector | ||
*/ | ||
public click(selector: string): Promise<void> | ||
public click(selectorOrLocator: string | Locator, options?: ClickOptions): Promise<void> | ||
public rightClick(selector: string): Promise<void> | ||
/** | ||
* Sends a double-click event to the element located by the supplied Locator or `selector`. If the element is | ||
* currently outside the viewport it will first scroll to that element. | ||
*/ | ||
public doubleClick(locatable: Locatable, options?: ClickOptions): Promise<void> | ||
public middleClick(selector: string): Promise<void> | ||
/** | ||
* Selects an option within a <select> tag using the value of the <option> element. | ||
*/ | ||
public selectByValue(locatable: Locatable, value: string): Promise<void> | ||
public selectByValue(locatorOrSelector: Locator | string, value: string): Promise<void> | ||
/** | ||
* Selects an option within a <select> tag by its index in the list. | ||
*/ | ||
public selectByIndex(locatable: Locatable, index: string): Promise<void> | ||
public selectByIndex(locatorOrSelector: Locator | string, index: string): Promise<void> | ||
/** | ||
* Selects an option within a <select> tag by matching its visible text. | ||
*/ | ||
public selectByText(locatable: Locatable, text: string): Promise<void> | ||
public selectByText(locatorOrSelector: Locator | string, text: string): Promise<void> | ||
/** | ||
* Clears the selected value of an input or select control. | ||
*/ | ||
public clear(locatable: Locatable): Promise<void> | ||
public clearSelect(locatorOrSelector: Locator | string): Promise<void> | ||
/** | ||
* Types a string into an <input> control, key press by key press. | ||
*/ | ||
public type(locatable: Locatable, text: string, options?: { delay: number }): Promise<void> | ||
public fillIn(selector: string, text: string, options?: { delay: number }): Promise<void> | ||
public blur(locator: Locatable): Promise<void> | ||
public blur(selector: string): Promise<void> | ||
public focus(locator: Locatable): Promise<void> | ||
public focus(selector: string): Promise<void> | ||
public press( | ||
keyCode: string, | ||
options?: { | ||
/** | ||
* A string of text to type | ||
*/ | ||
text?: string /** | ||
* Delay between key presses, in milliseconds. | ||
*/ | ||
delay?: number | ||
}, | ||
): Promise<void> | ||
public pressKey(keyCode: string, options?: { text: string }): Promise<void> | ||
public keyboardDown(keyCode: string, options?: { text: string }): Promise<void> | ||
/** | ||
* @deprecated | ||
* @param selector | ||
* @param options | ||
*/ | ||
public waitForElement(selector: string, options?: {}): Promise<any> | ||
/** | ||
* Uses the provided locator to find the first element it matches, returning an ElementHandle. | ||
@@ -171,10 +196,2 @@ */ | ||
public findAllElements(locator: string | Locator): Promise<ElementHandle[]> | ||
/** | ||
* Creates a waiter which will pause the test until a condition is met or a timeout is reached. | ||
* | ||
* You can use either a numeric value in milliseconds to wait for a specific time, | ||
* or a {@linkcode Condition}, for more advanced capabilities. | ||
*/ | ||
public wait(timeoutOrCondition: Condition | number): Promise<boolean> | ||
} | ||
@@ -190,3 +207,3 @@ | ||
*/ | ||
attr(name: string): Promise<string> | ||
public getAttribute(name: string): Promise<string> | ||
@@ -197,47 +214,62 @@ /** | ||
*/ | ||
public click(): Promise<void> | ||
public click(options?: ClickOptions): Promise<void> | ||
/** | ||
* Sends a right click event to the element attached to this handle. If the element is | ||
* currently outside the viewport it will first scroll to that element. | ||
* Schedules a command to clear the value of this element. | ||
* This command has no effect if the underlying DOM element is neither a text | ||
* INPUT, SELECT, or a TEXTAREA element. | ||
*/ | ||
public rightClick(): Promise<void> | ||
public clear(): Promise<void> | ||
public sendKeys(...keys: string[]): Promise<void> | ||
public type(text: string): Promise<void> | ||
/** | ||
* Sends a middle click event to the element attached to this handle. If the element is | ||
* currently outside the viewport it will first scroll to that element. | ||
* Sends focus to this element so that it receives keyboard inputs. | ||
*/ | ||
public middleClick(): Promise<void> | ||
public focus(): Promise<void> | ||
/** | ||
* Takes a screenshot of this element and saves it to the results folder with a random name. | ||
* Clears focus from this element so that it will no longer receive keyboard inputs. | ||
*/ | ||
public screenshot(options?): Promise<void> | ||
public blur(): Promise<void> | ||
/** | ||
* Retrieves the text content of this element excluding leading and trailing whitespace. | ||
* Takes a screenshot of this element and saves it to the results folder with a random name. | ||
*/ | ||
public text(): Promise<string> | ||
public takeScreenshot(options?: ScreenshotOptions): Promise<void> | ||
/** | ||
* Sends a sequence of key presses to this element. | ||
* Locates an element using the supplied {@linkcode Locator}, returning an {@linkcode ElementHandle} | ||
*/ | ||
public press(...keys: Array<Key | string>): Promise<void> | ||
public findElement(locator: Locator | string): Promise<ElementHandle> | ||
/** | ||
* Schedules a command to clear the value of this element. | ||
* This command has no effect if the underlying DOM element is neither a text | ||
* INPUT, SELECT, or a TEXTAREA element. | ||
* Locates all elements using the supplied {@linkcode Locator}, returning an array of {@linkcode ElementHandle}'s | ||
*/ | ||
public clear(): Promise<void> | ||
public findElements(locator: Locator | string): Promise<ElementHandle[]> | ||
public tagName(): Promise<string> | ||
public getId(): Promise<string> | ||
public getAttribute(key: string): Promise<string> | ||
public isSelected(): Promise<boolean> | ||
public isSelectable(): Promise<boolean> | ||
public isDisplayed(): Promise<boolean> | ||
public isEnabled(): Promise<boolean> | ||
/** | ||
* Locates an element using the supplied {@linkcode Locator}, returning an {@linkcode ElementHandle} | ||
* Retrieves the text content of this element excluding leading and trailing whitespace. | ||
*/ | ||
public findElement(Locator: Locator): Promise<ElementHandle> | ||
public text(): Promise<string> | ||
/** | ||
* Locates all elements using the supplied {@linkcode Locator}, returning an array of {@linkcode ElementHandle}'s | ||
*/ | ||
public findElements(Locator: Locator): Promise<ElementHandle[]> | ||
public size(): Promise<{ width: number; height: number }> | ||
public location(): Promise<{ x: number; y: number }> | ||
} | ||
@@ -280,2 +312,18 @@ | ||
/** | ||
* Locates all elements whose `textContent` equals the given | ||
* substring and is not hidden by CSS. | ||
* | ||
* @param {string} text The string to check for in a elements's visible text. | ||
*/ | ||
static visibleText(text: string): Locator | ||
/** | ||
* Locates all elements whose `textContent` contains the given | ||
* substring and is not hidden by CSS. | ||
* | ||
* @param {string} text The substring to check for in a elements's visible text. | ||
*/ | ||
static partialVisibleText(text: string): Locator | ||
/** | ||
* Finds an element containing a specified attribute value | ||
@@ -378,2 +426,4 @@ * @param tagName TagName to scope selection to | ||
export type Locatable = Locator | ElementHandle | string | ||
export enum Key { | ||
@@ -458,1 +508,60 @@ NULL, | ||
} | ||
export enum MouseButtons { | ||
LEFT = 'left', | ||
RIGHT = 'right', | ||
MIDDLE = 'middle', | ||
} | ||
export interface ClickOptions { | ||
/** defaults to left */ | ||
button?: MouseButtons | ||
/** defaults to 1 */ | ||
clickCount?: number | ||
/** | ||
* Time to wait between mousedown and mouseup in milliseconds. | ||
* Defaults to 0. | ||
*/ | ||
delay?: number | ||
} | ||
/** Defines the screenshot options. */ | ||
export interface ScreenshotOptions { | ||
/** | ||
* The file path to save the image to. The screenshot type will be inferred from file extension. | ||
* If `path` is a relative path, then it is resolved relative to current working directory. | ||
* If no path is provided, the image won't be saved to the disk. | ||
*/ | ||
path?: string | ||
/** | ||
* The screenshot type. | ||
* @default png | ||
*/ | ||
type?: 'jpeg' | 'png' | ||
/** The quality of the image, between 0-100. Not applicable to png images. */ | ||
quality?: number | ||
/** | ||
* When true, takes a screenshot of the full scrollable page. | ||
* @default false | ||
*/ | ||
fullPage?: boolean | ||
/** | ||
* An object which specifies clipping region of the page. | ||
*/ | ||
clip?: BoundingBox | ||
/** | ||
* Hides default white background and allows capturing screenshots with transparency. | ||
* @default false | ||
*/ | ||
omitBackground?: boolean | ||
} | ||
export interface BoundingBox { | ||
/** The x-coordinate of top-left corner. */ | ||
x: number | ||
/** The y-coordinate of top-left corner. */ | ||
y: number | ||
/** The width. */ | ||
width: number | ||
/** The height. */ | ||
height: number | ||
} |
{ | ||
"name": "@flood/chrome", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Flood Chrome provides an API for scripting Browser Level Load Tests", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30149
481