appium-mac2-driver
Version:
XCTest-based Appium driver for macOS apps automation
70 lines • 3.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.macosLaunchApp = macosLaunchApp;
exports.macosActivateApp = macosActivateApp;
exports.macosTerminateApp = macosTerminateApp;
exports.macosQueryAppState = macosQueryAppState;
/**
* Start an app with given bundle identifier or activates it
* if the app is already running. An exception is thrown if the
* app with the given identifier cannot be found.
*
* @param bundleId - Bundle identifier of the app to be launched or activated.
* Either this property or `path` must be provided
* @param path - Full path to the app bundle. Either this property or
* `bundleId` must be provided
* @param args - The list of command line arguments for the app to be launched with.
* This parameter is ignored if the app is already running.
* @param environment - Environment variables mapping.
* Custom variables are added to the default process environment.
*/
async function macosLaunchApp(bundleId, path, args, environment) {
return await this.wda.proxy.command('/wda/apps/launch', 'POST', {
arguments: args,
environment,
bundleId,
path,
});
}
/**
* Activate an app with given bundle identifier. An exception is thrown if the
* app cannot be found or is not running.
*
* @param bundleId - Bundle identifier of the app to be activated.
* Either this property or `path` must be provided
* @param path - Full path to the app bundle. Either this property
* or `bundleId` must be provided
*/
async function macosActivateApp(bundleId, path) {
return await this.wda.proxy.command('/wda/apps/activate', 'POST', { bundleId, path });
}
/**
* Terminate an app with given bundle identifier. An exception is thrown if the
* app cannot be found.
*
* @param bundleId - Bundle identifier of the app to be terminated.
* Either this property or `path` must be provided
* @param path - Full path to the app bundle. Either this property
* or `bundleId` must be provided
* @returns `true` if the app was running and has been successfully terminated.
* `false` if the app was not running before.
*/
async function macosTerminateApp(bundleId, path) {
return (await this.wda.proxy.command('/wda/apps/terminate', 'POST', { bundleId, path }));
}
/**
* Query an app state with given bundle identifier. An exception is thrown if the
* app cannot be found.
*
* @param bundleId - Bundle identifier of the app whose state should be queried.
* Either this property or `path` must be provided
* @param path - Full path to the app bundle. Either this property
* or `bundleId` must be provided
* @returns The application state code. See
* https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
* for more details
*/
async function macosQueryAppState(bundleId, path) {
return (await this.wda.proxy.command('/wda/apps/state', 'POST', { bundleId, path }));
}
//# sourceMappingURL=app-management.js.map