@progress/kendo-e2e
Version:
Kendo UI end-to-end test utilities.
69 lines (68 loc) • 3.6 kB
TypeScript
import { Browser, By, WebElement } from "../selenium";
export interface FuzzTestExpectations {
performanceCheck?: (executionTime: number, input: string, targetExecutionTimeMs?: number) => Promise<void>;
consoleErrorCheck?: (errorLogs: string[], input: string) => Promise<void>;
xssAlertCheck?: (browser: Browser, input: string) => Promise<void>;
sanitizationCheck?: (inputValue: string, input: string) => Promise<void>;
domManipulationCheck?: (browser: Browser, input: string) => Promise<void>;
}
export declare const XSS_PAYLOADS: string[];
export declare const SQL_INJECTION_PAYLOADS: string[];
export declare const COMMAND_INJECTION_PAYLOADS: string[];
export declare const PATH_TRAVERSAL_PAYLOADS: string[];
export declare const HTML_INJECTION_PAYLOADS: string[];
export declare const BUFFER_OVERFLOW_PAYLOADS: string[];
export declare const MALICIOUS_INPUT_PAYLOADS: string[][];
export declare const FUZZ_TEST_EXPECTATIONS: {
performanceCheck: (executionTime: number, input: string, targetExecutionTimeMs?: number) => Promise<void>;
consoleErrorCheck: (errorLogs: string[], input: string) => Promise<void>;
xssAlertCheck: (browser: Browser, input: string) => Promise<void>;
domManipulationCheck: (browser: Browser, input: string) => Promise<void>;
};
export declare class UIComponent {
protected browser: Browser;
locator: By | string;
rootElement?: WebElement | By | string;
constructor(browser: Browser, locator: By | string, rootElement?: WebElement | By | string);
root(): Promise<WebElement>;
findChild(selector: By | string, { waitForChild, timeout, pollTimeout }?: {
waitForChild?: boolean;
timeout?: number;
pollTimeout?: number;
}): Promise<WebElement>;
findChildren(selector: By | string, { waitForChild, timeout, pollTimeout }?: {
waitForChild?: boolean;
timeout?: number;
pollTimeout?: number;
}): Promise<WebElement[]>;
waitUntilLoaded({ timeout, pollTimeout }?: {
timeout?: number;
pollTimeout?: number;
}): Promise<void>;
waitForAnimation({ timeout, pollTimeout }?: {
timeout?: number;
pollTimeout?: number;
}): Promise<void>;
/**
* Tests the component with various malicious inputs to ensure its robustness against common security vulnerabilities.
*
* @param {WebElement} [myInputElement] - The input element to be tested.
* @param {string[][]} [maliciousInputArray] - An array of arrays containing malicious input strings. If not provided, the method will use the default `MALICIOUS_INPUT_PAYLOADS`.
* @param {Partial<FuzzTestExpectations>} [expectationsArray] - An object containing custom expectations for the tests. If not provided, the method will use the default `FUZZ_TEST_EXPECTATIONS`.
*
* @example
* // Default usage
* await myComponent.setMaliciousInputs(myInputElement);
*
* @example
* // Partial customization of the expectations
* await myComponent.setMaliciousInputs(myInputElement, undefined, {
* performanceCheck: async (executionTime, input, targetExecutionTimeMs = 4000) => {
* if (executionTime >= targetExecutionTimeMs) {
* throw new Error(`Custom: Execution time exceeded for input: "${input}"`);
* }
* }
* });
*/
setMaliciousInputs(myInputElement: WebElement, maliciousInputArray?: string[][], expectationsArray?: Partial<FuzzTestExpectations>): Promise<void>;
}