cumulocity-cypress
Version:
Cypress commands for Cumulocity IoT
55 lines (54 loc) • 2.57 kB
TypeScript
import "../lib/commands";
import "../lib/commands/c8ypact";
import "../lib/commands/screenshot";
import "cypress-file-upload";
import { C8yTestHierarchyTree } from "../shared/types";
import { Action, Screenshot, ScreenshotOptions, ScreenshotSetup, Visit } from "../lib/screenshots/types";
export type C8yScreenshotActionHandler = (action: any, that: C8yScreenshotRunner, item: Screenshot, options: any) => void;
type Workflow = Screenshot & ScreenshotOptions;
type RunOptions = {
tags?: string[];
titles?: string[];
images?: string[];
};
export declare class C8yScreenshotRunner {
readonly config: ScreenshotSetup;
actionHandlers: {
[key: string]: C8yScreenshotActionHandler;
};
private language;
constructor(config?: ScreenshotSetup);
registerActionHandler(key: string, handler: C8yScreenshotActionHandler): void;
private g;
run(screenshot?: Workflow | Workflow[] | RunOptions, options?: RunOptions): void;
/**
* Runs all image workflows as a Cypress suite. Wraps the tests in a `describe` block
* and sets up the environment for each test, including shell version and tenant ID.
*/
runSuite(): void;
protected createTestsFromHierarchy(hierarchy: C8yTestHierarchyTree<Workflow>): void;
protected runTest(item: Workflow, testOptions?: {
language?: string;
}): void;
protected click(action: Action["click"]): void;
protected type(action: Action["type"]): void;
protected highlight(action: Action["highlight"], that: C8yScreenshotRunner): void;
protected scrollTo(action: Action["scrollTo"]): void;
protected text(action: Action["text"]): void;
protected wait(action: Action["wait"]): void;
protected fileUpload(action: Action["fileUpload"]): void;
protected blur(action: Action["blur"]): void;
protected focus(action: Action["focus"]): void;
protected screenshot(action: Action["screenshot"], _that: C8yScreenshotRunner, item: Screenshot, options: Cypress.ScreenshotOptions): void;
protected getVisitObject(visit: string | Visit): Visit | undefined;
protected userId: string | undefined;
protected interceptCurrentUser(user: ScreenshotOptions["user"]): void;
}
/**
* Update c8yctrl pact file to be used for recording or mocking.
* @param titleOrId An id or array of titles with names of suite or titles
*/
export declare function c8yctrl(titleOrId?: string | string[]): Promise<Response>;
export declare function isRecording(): boolean;
export declare function isScreenshotAction(action: Action): boolean;
export {};