appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
79 lines • 4.03 kB
TypeScript
import type { XCUITestDriver } from '../driver';
import type { StartRecordingScreenOptions, StopRecordingScreenOptions } from './types';
/**
* Optional execute-script keys for `mobile: startScreenRecording`, in Appium flattened-arg order.
* Keep in sync with `lib/execute-method-map.ts` (`mobile: startScreenRecording` optional keys).
*/
export declare const START_SCREEN_RECORDING_EXECUTE_OPTIONALS: readonly ["videoType", "videoQuality", "videoFps", "videoFilters", "videoScale", "pixelFormat", "forceRestart", "timeLimit", "hardwareAcceleration", "remotePath", "user", "pass", "headers", "fileFieldName", "formFields", "method"];
/**
* Optional execute-script keys for `mobile: stopScreenRecording`, in Appium flattened-arg order.
* Keep in sync with `lib/execute-method-map.ts` (`mobile: stopScreenRecording` optional keys).
*/
export declare const STOP_SCREEN_RECORDING_EXECUTE_OPTIONALS: readonly ["remotePath", "user", "pass", "headers", "fileFieldName", "formFields", "method"];
interface ScreenRecorderOptions {
hardwareAcceleration?: string;
remotePort: number;
remoteUrl: string;
videoFps?: number;
videoType?: string;
videoScale?: string;
videoFilters?: string;
pixelFormat?: string;
}
export declare class ScreenRecorder {
private readonly videoPath;
private readonly log;
private readonly opts;
private readonly udid;
private mainProcess;
private timeoutHandler;
constructor(udid: string, log: any, videoPath: string, opts: ScreenRecorderOptions);
start(timeoutMs: number): Promise<void>;
interrupt(force?: boolean): Promise<boolean>;
finish(): Promise<string>;
cleanup(): Promise<void>;
}
/**
* Direct Appium to start recording the device screen
*
* Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
* (ffmpeg utility is required: 'brew install ffmpeg').
* It records screen activity to a MPEG-4 file. Audio is not recorded with the video file.
* If screen recording has been already started then the command will stop it forcefully and start a new one.
* The previously recorded video file will be deleted.
*
* @param options - The available options.
* @returns Base64-encoded content of the recorded media file if
* any screen recording is currently running or an empty string.
* @throws {Error} If screen recording has failed to start.
*/
export declare function startRecordingScreen(this: XCUITestDriver, options?: StartRecordingScreenOptions): Promise<string>;
/**
* Direct Appium to stop screen recording and return the video
*
* If no screen recording process is running then the endpoint will try to get
* the recently recorded file. If no previously recorded file is found and no
* active screen recording processes are running then the method returns an
* empty string.
*
* @param options - The available options.
* @returns Base64-encoded content of the recorded media
* file if `remotePath` parameter is empty or null or an empty string.
* @throws {Error} If there was an error while getting the name of a media
* file or the file content cannot be uploaded to the remote
* location.
*/
export declare function stopRecordingScreen(this: XCUITestDriver, options?: StopRecordingScreenOptions): Promise<string | null>;
/**
* Execute-script entry for `mobile: startScreenRecording`. Appium passes one positional argument
* per optional key (see `START_SCREEN_RECORDING_EXECUTE_OPTIONALS`); this wrapper collapses
* them into the options object for `startRecordingScreen`.
*/
export declare function mobileStartScreenRecording(this: XCUITestDriver, ...args: unknown[]): Promise<string>;
/**
* Execute-script entry for `mobile: stopScreenRecording`. Collapses flattened args into the
* options object for `stopRecordingScreen`.
*/
export declare function mobileStopScreenRecording(this: XCUITestDriver, ...args: unknown[]): Promise<string | null>;
export {};
//# sourceMappingURL=recordscreen.d.ts.map