appium-ios-simulator
Version:
iOS Simulator interface for Appium.
256 lines • 10.7 kB
TypeScript
import EventEmitter from 'events';
import { Simctl } from 'node-simctl';
import * as appExtensions from './extensions/applications';
import * as biometricExtensions from './extensions/biometric';
import * as safariExtensions from './extensions/safari';
import * as keychainExtensions from './extensions/keychain';
import * as settingsExtensions from './extensions/settings';
import * as permissionsExtensions from './extensions/permissions';
import * as miscExtensions from './extensions/misc';
import * as geolocationExtensions from './extensions/geolocation';
import type { CoreSimulator, HasSettings, InteractsWithApps, InteractsWithKeychain, SupportsGeolocation, HasMiscFeatures, InteractsWithSafariBrowser, SupportsBiometric, DeviceStat, ShutdownOptions, RunOptions, StartUiClientOptions, KillUiClientOptions, ProcessInfo } from './types';
import type { XcodeVersion } from 'appium-xcode';
import type { AppiumLogger, StringRecord } from '@appium/types';
export declare class SimulatorXcode14 extends EventEmitter implements CoreSimulator, HasSettings, InteractsWithApps, InteractsWithKeychain, SupportsGeolocation, HasMiscFeatures, InteractsWithSafariBrowser, SupportsBiometric {
_keychainsBackupPath: string | null | undefined;
_platformVersion: string | null | undefined;
_webInspectorSocket: string | null | undefined;
private readonly _udid;
private readonly _simctl;
private readonly _xcodeVersion;
private readonly _log;
/**
* Constructs the object with the `udid` and version of Xcode.
* Use the exported `getSimulator(udid)` method instead.
*
* @param udid - The Simulator ID.
* @param xcodeVersion - The target Xcode version in format {major, minor, build}.
* @param log - Optional logger instance.
*/
constructor(udid: string, xcodeVersion: XcodeVersion, log?: AppiumLogger | null);
/**
* @returns The unique device identifier (UDID) of the simulator.
*/
get udid(): string;
/**
* @returns The Simctl instance for interacting with the simulator.
*/
get simctl(): Simctl;
/**
* @returns The Xcode version information.
*/
get xcodeVersion(): XcodeVersion;
/**
* @returns The full path to the keychain directory for this simulator.
*/
get keychainPath(): string;
/**
* @returns The logger instance used by this simulator.
*/
get log(): AppiumLogger;
/**
* @returns The bundle identifier of the Simulator UI client.
*/
get uiClientBundleId(): string;
/**
* @returns The maximum number of milliseconds to wait until Simulator booting is completed.
*/
get startupTimeout(): number;
/**
* @returns The full path to the devices set where the current simulator is located.
* `null` value means that the default path is used.
*/
get devicesSetPath(): string | null;
/**
* Set the full path to the devices set. It is recommended to set this value
* once right after Simulator instance is created and to not change it during
* the instance lifecycle.
*
* @param value - The full path to the devices set root on the local file system.
*/
set devicesSetPath(value: string | null);
/**
* Retrieve the full path to the directory where Simulator stuff is located.
*
* @returns The path string.
*/
getRootDir(): string;
/**
* Retrieve the full path to the directory where Simulator applications data is located.
*
* @returns The path string.
*/
getDir(): string;
/**
* Retrieve the full path to the directory where Simulator logs are stored.
*
* @returns The path string.
*/
getLogDir(): string;
/**
* Get the state and specifics of this simulator.
*
* @returns Simulator stats mapping, for example:
* { name: 'iPhone 4s',
* udid: 'C09B34E5-7DCB-442E-B79C-AB6BC0357417',
* state: 'Shutdown',
* sdk: '8.3'
* }
*/
stat(): Promise<DeviceStat | StringRecord<never>>;
/**
* Check if the Simulator has been booted at least once
* and has not been erased before.
*
* @returns True if the current Simulator has never been started before.
*/
isFresh(): Promise<boolean>;
/**
* Retrieves the state of the current Simulator. One should distinguish the
* states of Simulator UI and the Simulator itself.
*
* @returns True if the current Simulator is running.
*/
isRunning(): Promise<boolean>;
/**
* Checks if the simulator is in shutdown state.
* This method is necessary, because Simulator might also be
* in the transitional Shutting Down state right after the `shutdown`
* command has been issued.
*
* @returns True if the current Simulator is shut down.
*/
isShutdown(): Promise<boolean>;
/**
* Retrieves the current process id of the UI client.
*
* @returns The process ID or null if the UI client is not running.
*/
getUIClientPid(): Promise<string | null>;
/**
* Check the state of Simulator UI client.
*
* @returns True if UI client is running or false otherwise.
*/
isUIClientRunning(): Promise<boolean>;
/**
* Get the platform version of the current Simulator.
*
* @returns SDK version, for example '18.3'.
*/
getPlatformVersion(): Promise<string>;
/**
* Boots Simulator if not already booted.
* Does nothing if it is already running.
* This API does NOT wait until Simulator is fully booted.
*
* @throws {Error} If there was a failure while booting the Simulator.
*/
boot(): Promise<void>;
/**
* Verify whether the Simulator booting is completed and/or wait for it
* until the timeout expires.
*
* @param startupTimeout - The number of milliseconds to wait until booting is completed.
*/
waitForBoot(startupTimeout: number): Promise<void>;
/**
* Reset the current Simulator to the clean state.
* It is expected the simulator is in shutdown state when this API is called.
*/
clean(): Promise<void>;
/**
* Delete the particular Simulator from devices list.
*/
delete(): Promise<void>;
/**
* Shut down the current Simulator.
*
* @param opts - Shutdown options including timeout.
* @throws {Error} If Simulator fails to transition into Shutdown state after
* the given timeout.
*/
shutdown(opts?: ShutdownOptions): Promise<void>;
/**
* Boots simulator and opens simulators UI Client if not already opened.
* In xcode 11.4, UI Client must be first launched, otherwise
* sim window stays minimized
*
* @param isUiClientRunning - whether the simulator UI client is already running.
* @param opts - arguments to start simulator UI client with.
*/
launchWindow(isUiClientRunning: boolean, opts?: RunOptions): Promise<void>;
/**
* Start the Simulator UI client with the given arguments.
*
* @param opts - Simulator startup options.
*/
startUIClient(opts?: StartUiClientOptions): Promise<void>;
/**
* Executes given Simulator with options. The Simulator will not be restarted if
* it is already running and the current UI state matches to `isHeadless` option.
*
* @param opts - One or more of available Simulator options.
*/
run(opts?: RunOptions): Promise<void>;
/**
* Kill the UI client if it is running.
*
* @param opts - Options including process ID and signal number.
* @returns True if the UI client was successfully killed or false
* if it is not running.
* @throws {Error} If sending the signal to the client process fails.
*/
killUIClient(opts?: KillUiClientOptions): Promise<boolean>;
/**
* Lists processes that are currently running on the given Simulator.
* The simulator must be in running state in order for this
* method to work properly.
*
* @returns The list of retrieved process information.
* @throws {Error} If no process information could be retrieved.
*/
ps(): Promise<ProcessInfo[]>;
/**
* @returns The full path to the LaunchDaemons directory.
*/
getLaunchDaemonsRoot(): Promise<string>;
installApp: typeof appExtensions.installApp;
getUserInstalledBundleIdsByBundleName: typeof appExtensions.getUserInstalledBundleIdsByBundleName;
isAppInstalled: typeof appExtensions.isAppInstalled;
removeApp: typeof appExtensions.removeApp;
launchApp: typeof appExtensions.launchApp;
terminateApp: typeof appExtensions.terminateApp;
isAppRunning: typeof appExtensions.isAppRunning;
scrubApp: typeof appExtensions.scrubApp;
openUrl: typeof safariExtensions.openUrl;
scrubSafari: typeof safariExtensions.scrubSafari;
updateSafariSettings: typeof safariExtensions.updateSafariSettings;
getWebInspectorSocket: () => Promise<string | null>;
isBiometricEnrolled: typeof biometricExtensions.isBiometricEnrolled;
enrollBiometric: typeof biometricExtensions.enrollBiometric;
sendBiometricMatch: typeof biometricExtensions.sendBiometricMatch;
backupKeychains: () => Promise<boolean>;
restoreKeychains: (excludePatterns: string[]) => Promise<boolean>;
clearKeychains: typeof keychainExtensions.clearKeychains;
setGeolocation: typeof geolocationExtensions.setGeolocation;
shake: typeof miscExtensions.shake;
addCertificate: typeof miscExtensions.addCertificate;
pushNotification: typeof miscExtensions.pushNotification;
setPermission: typeof permissionsExtensions.setPermission;
setPermissions: typeof permissionsExtensions.setPermissions;
getPermission: typeof permissionsExtensions.getPermission;
updateSettings: typeof settingsExtensions.updateSettings;
setAppearance: typeof settingsExtensions.setAppearance;
getAppearance: typeof settingsExtensions.getAppearance;
setIncreaseContrast: typeof settingsExtensions.setIncreaseContrast;
getIncreaseContrast: typeof settingsExtensions.getIncreaseContrast;
setContentSize: typeof settingsExtensions.setContentSize;
getContentSize: typeof settingsExtensions.getContentSize;
configureLocalization: typeof settingsExtensions.configureLocalization;
setAutoFillPasswords: typeof settingsExtensions.setAutoFillPasswords;
setReduceMotion: typeof settingsExtensions.setReduceMotion;
setReduceTransparency: typeof settingsExtensions.setReduceTransparency;
disableKeyboardIntroduction: typeof settingsExtensions.disableKeyboardIntroduction;
}
//# sourceMappingURL=simulator-xcode-14.d.ts.map