node-simctl
Advanced tools
Comparing version 7.3.5 to 7.3.6
@@ -128,3 +128,10 @@ export default Simctl; | ||
get devicesSetPath(): string | null; | ||
requireUdid(commandName?: null): string; | ||
/** | ||
* @param {string?} [commandName=null] | ||
* @returns {string} | ||
*/ | ||
requireUdid(commandName?: string | null | undefined): string; | ||
/** | ||
* @returns {Promise<string>} | ||
*/ | ||
requireXcrun(): Promise<string>; | ||
@@ -143,3 +150,41 @@ /** | ||
exec(subcommand: string, opts?: ExecOpts | undefined): Promise<import("teen_process").TeenProcessExecResult<any> | import('teen_process').SubProcess>; | ||
addMedia: (this: Simctl, filePath: string) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
appInfo: (this: Simctl, bundleId: string) => Promise<string>; | ||
bootDevice: (this: Simctl) => Promise<void>; | ||
startBootMonitor: (this: Simctl, opts?: import("./subcommands/bootstatus").BootMonitorOptions | undefined) => Promise<SubProcess>; | ||
createDevice: (this: Simctl, name: string, deviceTypeId: string, platformVersion: string, opts?: import("./subcommands/create").SimCreationOpts | undefined) => Promise<string>; | ||
deleteDevice: (this: Simctl) => Promise<void>; | ||
eraseDevice: (this: Simctl, timeout?: number | undefined) => Promise<void>; | ||
getAppContainer: (this: Simctl, bundleId: string, containerType?: string | null | undefined) => Promise<string>; | ||
getEnv: (this: Simctl, varName: string) => Promise<string | null>; | ||
installApp: (this: Simctl, appPath: string) => Promise<void>; | ||
getScreenshot: (this: Simctl) => Promise<string>; | ||
addRootCertificate: (this: Simctl, cert: string, opts?: import("./subcommands/keychain").CertOptions | undefined) => Promise<void>; | ||
addCertificate: (this: Simctl, cert: string, opts?: import("./subcommands/keychain").CertOptions | undefined) => Promise<void>; | ||
resetKeychain: (this: Simctl) => Promise<void>; | ||
launchApp: (this: Simctl, bundleId: string, tries?: number | undefined) => Promise<string>; | ||
getDevicesByParsing: (this: Simctl, platform?: string | null | undefined) => Promise<Record<string, any>>; | ||
getDevices: (this: Simctl, forSdk?: string | null | undefined, platform?: string | null | undefined) => Promise<any>; | ||
getRuntimeForPlatformVersionViaJson: (this: Simctl, platformVersion: string, platform?: string | undefined) => Promise<string>; | ||
getRuntimeForPlatformVersion: (this: Simctl, platformVersion: string, platform?: string | undefined) => Promise<string>; | ||
getDeviceTypes: (this: Simctl) => Promise<string[]>; | ||
list: (this: Simctl) => Promise<any>; | ||
setLocation: (this: Simctl, latitude: string | number, longitude: string | number) => Promise<void>; | ||
clearLocation: (this: Simctl) => Promise<void>; | ||
openUrl: (this: Simctl, url: string) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
setPasteboard: (this: Simctl, content: string, encoding?: BufferEncoding | undefined) => Promise<void>; | ||
getPasteboard: (this: Simctl, encoding?: string | undefined) => Promise<string>; | ||
grantPermission: (this: Simctl, bundleId: string, perm: string) => Promise<void>; | ||
revokePermission: (this: Simctl, bundleId: string, perm: string) => Promise<void>; | ||
resetPermission: (this: Simctl, bundleId: string, perm: string) => Promise<void>; | ||
pushNotification: (this: Simctl, payload: any) => Promise<void>; | ||
shutdownDevice: (this: Simctl) => Promise<void>; | ||
spawnProcess: (this: Simctl, args: string | string[], env?: any) => Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
spawnSubProcess: (this: Simctl, args: string | string[], env?: any) => Promise<SubProcess>; | ||
terminateApp: (this: Simctl, bundleId: string) => Promise<void>; | ||
getAppearance: (this: Simctl) => Promise<string>; | ||
setAppearance: (this: Simctl, appearance: string) => Promise<void>; | ||
removeApp: (this: Simctl, bundleId: string) => Promise<void>; | ||
} | ||
import { SubProcess } from 'teen_process'; | ||
//# sourceMappingURL=simctl.d.ts.map |
@@ -31,3 +31,2 @@ "use strict"; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const index_js_1 = __importDefault(require("./subcommands/index.js")); | ||
const which_1 = __importDefault(require("which")); | ||
@@ -37,2 +36,27 @@ const logger_1 = __importStar(require("./logger")); | ||
const teen_process_1 = require("teen_process"); | ||
const addmedia_1 = __importDefault(require("./subcommands/addmedia")); | ||
const appinfo_1 = __importDefault(require("./subcommands/appinfo")); | ||
const boot_1 = __importDefault(require("./subcommands/boot")); | ||
const bootstatus_1 = __importDefault(require("./subcommands/bootstatus")); | ||
const create_1 = __importDefault(require("./subcommands/create")); | ||
const delete_1 = __importDefault(require("./subcommands/delete")); | ||
const erase_1 = __importDefault(require("./subcommands/erase")); | ||
const get_app_container_1 = __importDefault(require("./subcommands/get_app_container")); | ||
const install_1 = __importDefault(require("./subcommands/install")); | ||
const io_1 = __importDefault(require("./subcommands/io")); | ||
const keychain_1 = __importDefault(require("./subcommands/keychain")); | ||
const launch_1 = __importDefault(require("./subcommands/launch")); | ||
const list_1 = __importDefault(require("./subcommands/list")); | ||
const openurl_1 = __importDefault(require("./subcommands/openurl")); | ||
const pbcopy_1 = __importDefault(require("./subcommands/pbcopy")); | ||
const pbpaste_1 = __importDefault(require("./subcommands/pbpaste")); | ||
const privacy_1 = __importDefault(require("./subcommands/privacy")); | ||
const push_1 = __importDefault(require("./subcommands/push")); | ||
const getenv_1 = __importDefault(require("./subcommands/getenv")); | ||
const shutdown_1 = __importDefault(require("./subcommands/shutdown")); | ||
const spawn_1 = __importDefault(require("./subcommands/spawn")); | ||
const terminate_1 = __importDefault(require("./subcommands/terminate")); | ||
const ui_1 = __importDefault(require("./subcommands/ui")); | ||
const uninstall_1 = __importDefault(require("./subcommands/uninstall")); | ||
const location_1 = __importDefault(require("./subcommands/location")); | ||
const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_'; | ||
@@ -88,2 +112,39 @@ const DEFAULT_OPTS = { | ||
constructor(opts = {}) { | ||
this.addMedia = addmedia_1.default.addMedia; | ||
this.appInfo = appinfo_1.default.appInfo; | ||
this.bootDevice = boot_1.default.bootDevice; | ||
this.startBootMonitor = bootstatus_1.default.startBootMonitor; | ||
this.createDevice = create_1.default.createDevice; | ||
this.deleteDevice = delete_1.default.deleteDevice; | ||
this.eraseDevice = erase_1.default.eraseDevice; | ||
this.getAppContainer = get_app_container_1.default.getAppContainer; | ||
this.getEnv = getenv_1.default.getEnv; | ||
this.installApp = install_1.default.installApp; | ||
this.getScreenshot = io_1.default.getScreenshot; | ||
this.addRootCertificate = keychain_1.default.addRootCertificate; | ||
this.addCertificate = keychain_1.default.addCertificate; | ||
this.resetKeychain = keychain_1.default.resetKeychain; | ||
this.launchApp = launch_1.default.launchApp; | ||
this.getDevicesByParsing = list_1.default.getDevicesByParsing; | ||
this.getDevices = list_1.default.getDevices; | ||
this.getRuntimeForPlatformVersionViaJson = list_1.default.getRuntimeForPlatformVersionViaJson; | ||
this.getRuntimeForPlatformVersion = list_1.default.getRuntimeForPlatformVersion; | ||
this.getDeviceTypes = list_1.default.getDeviceTypes; | ||
this.list = list_1.default.list; | ||
this.setLocation = location_1.default.setLocation; | ||
this.clearLocation = location_1.default.clearLocation; | ||
this.openUrl = openurl_1.default.openUrl; | ||
this.setPasteboard = pbcopy_1.default.setPasteboard; | ||
this.getPasteboard = pbpaste_1.default.getPasteboard; | ||
this.grantPermission = privacy_1.default.grantPermission; | ||
this.revokePermission = privacy_1.default.revokePermission; | ||
this.resetPermission = privacy_1.default.resetPermission; | ||
this.pushNotification = push_1.default.pushNotification; | ||
this.shutdownDevice = shutdown_1.default.shutdownDevice; | ||
this.spawnProcess = spawn_1.default.spawnProcess; | ||
this.spawnSubProcess = spawn_1.default.spawnSubProcess; | ||
this.terminateApp = terminate_1.default.terminateApp; | ||
this.getAppearance = ui_1.default.getAppearance; | ||
this.setAppearance = ui_1.default.setAppearance; | ||
this.removeApp = uninstall_1.default.removeApp; | ||
opts = lodash_1.default.cloneDeep(opts); | ||
@@ -111,2 +172,6 @@ lodash_1.default.defaultsDeep(opts, DEFAULT_OPTS); | ||
} | ||
/** | ||
* @param {string?} [commandName=null] | ||
* @returns {string} | ||
*/ | ||
requireUdid(commandName = null) { | ||
@@ -119,2 +184,5 @@ if (!this.udid) { | ||
} | ||
/** | ||
* @returns {Promise<string>} | ||
*/ | ||
async requireXcrun() { | ||
@@ -191,7 +259,3 @@ const xcrunBinary = (0, helpers_1.getXcrunBinary)(); | ||
exports.Simctl = Simctl; | ||
// add all the subcommands to the Simctl prototype | ||
for (const [fnName, fn] of lodash_1.default.toPairs(index_js_1.default)) { | ||
Simctl.prototype[fnName] = fn; | ||
} | ||
exports.default = Simctl; | ||
//# sourceMappingURL=simctl.js.map |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} filePath - Full path to a media file on the local | ||
@@ -15,4 +16,4 @@ * file system. | ||
*/ | ||
function addMedia(filePath: string): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
function addMedia(this: import("../simctl").default, filePath: string): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
} | ||
//# sourceMappingURL=addmedia.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} filePath - Full path to a media file on the local | ||
@@ -17,2 +18,4 @@ * file system. | ||
commands.addMedia = async function addMedia(filePath) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('addmedia', { | ||
@@ -19,0 +22,0 @@ args: [this.requireUdid('addmedia'), filePath], |
@@ -10,2 +10,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - The bundle identifier of the target application. | ||
@@ -44,4 +45,4 @@ * @return {Promise<string>} The information about installed application. | ||
*/ | ||
function appInfo(bundleId: string): Promise<string>; | ||
function appInfo(this: import("../simctl").default, bundleId: string): Promise<string>; | ||
} | ||
//# sourceMappingURL=appinfo.d.ts.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - The bundle identifier of the target application. | ||
@@ -46,2 +47,4 @@ * @return {Promise<string>} The information about installed application. | ||
commands.appInfo = async function appInfo(bundleId) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('appinfo', { | ||
@@ -48,0 +51,0 @@ args: [this.requireUdid('appinfo'), bundleId], |
@@ -6,2 +6,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -11,4 +12,4 @@ * returns non-zero return code. | ||
*/ | ||
function bootDevice(): Promise<void>; | ||
function bootDevice(this: import("../simctl").default): Promise<void>; | ||
} | ||
//# sourceMappingURL=boot.d.ts.map |
@@ -35,2 +35,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -37,0 +38,0 @@ * returns non-zero return code. |
@@ -48,2 +48,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {BootMonitorOptions} [opts={}] - Monitoring options. | ||
@@ -55,4 +56,4 @@ * @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process. | ||
*/ | ||
function startBootMonitor(opts?: BootMonitorOptions | undefined): Promise<import("teen_process").SubProcess>; | ||
function startBootMonitor(this: import("../simctl").default, opts?: BootMonitorOptions | undefined): Promise<import("teen_process").SubProcess>; | ||
} | ||
//# sourceMappingURL=bootstatus.d.ts.map |
@@ -26,2 +26,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {BootMonitorOptions} [opts={}] - Monitoring options. | ||
@@ -44,2 +45,4 @@ * @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process. | ||
} | ||
/** @type {import('teen_process').SubProcess} */ | ||
// @ts-ignore The returned type is ok | ||
const bootMonitor = await this.exec('bootstatus', { | ||
@@ -46,0 +49,0 @@ args, |
@@ -24,2 +24,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} name - The device name to be created. | ||
@@ -33,4 +34,4 @@ * @param {string} deviceTypeId - Device type, for example 'iPhone 6'. | ||
*/ | ||
function createDevice(name: string, deviceTypeId: string, platformVersion: string, opts?: SimCreationOpts | undefined): Promise<string>; | ||
function createDevice(this: import("../simctl").default, name: string, deviceTypeId: string, platformVersion: string, opts?: SimCreationOpts | undefined): Promise<string>; | ||
} | ||
//# sourceMappingURL=create.d.ts.map |
@@ -46,2 +46,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} name - The device name to be created. | ||
@@ -90,2 +91,4 @@ * @param {string} deviceTypeId - Device type, for example 'iPhone 6'. | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('create', { | ||
@@ -92,0 +95,0 @@ args: [name, deviceTypeId, runtimeId] |
@@ -6,2 +6,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -11,4 +12,4 @@ * returns non-zero return code. | ||
*/ | ||
function deleteDevice(): Promise<void>; | ||
function deleteDevice(this: import("../simctl").default): Promise<void>; | ||
} | ||
//# sourceMappingURL=delete.d.ts.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -9,0 +10,0 @@ * returns non-zero return code. |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait | ||
@@ -14,4 +15,4 @@ * unit device reset is completed. | ||
*/ | ||
function eraseDevice(timeout?: number | undefined): Promise<void>; | ||
function eraseDevice(this: import("../simctl").default, timeout?: number | undefined): Promise<void>; | ||
} | ||
//# sourceMappingURL=erase.d.ts.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait | ||
@@ -11,0 +12,0 @@ * unit device reset is completed. |
@@ -10,2 +10,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of an application. | ||
@@ -21,4 +22,4 @@ * @param {string?} [containerType=null] - Which container type to return. Possible values | ||
*/ | ||
function getAppContainer(bundleId: string, containerType?: string | null | undefined): Promise<string>; | ||
function getAppContainer(this: import("../simctl").default, bundleId: string, containerType?: string | null | undefined): Promise<string>; | ||
} | ||
//# sourceMappingURL=get_app_container.d.ts.map |
@@ -11,2 +11,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of an application. | ||
@@ -27,2 +28,3 @@ * @param {string?} [containerType=null] - Which container type to return. Possible values | ||
} | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('get_app_container', { args }); | ||
@@ -29,0 +31,0 @@ return (stdout || '').trim(); |
@@ -6,2 +6,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} varName - The name of the variable to be retrieved | ||
@@ -13,4 +14,4 @@ * @returns {Promise<string|null>} The value of the variable or null if the given variable | ||
*/ | ||
function getEnv(varName: string): Promise<string | null>; | ||
function getEnv(this: import("../simctl").default, varName: string): Promise<string | null>; | ||
} | ||
//# sourceMappingURL=getenv.d.ts.map |
@@ -7,2 +7,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} varName - The name of the variable to be retrieved | ||
@@ -15,2 +16,4 @@ * @returns {Promise<string|null>} The value of the variable or null if the given variable | ||
commands.getEnv = async function getEnv(varName) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const { stdout, stderr } = await this.exec('getenv', { | ||
@@ -17,0 +20,0 @@ args: [this.requireUdid('getenv'), varName], |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appPath - Full path to .app package, which is | ||
@@ -14,4 +15,4 @@ * going to be installed. | ||
*/ | ||
function installApp(appPath: string): Promise<void>; | ||
function installApp(this: import("../simctl").default, appPath: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=install.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appPath - Full path to .app package, which is | ||
@@ -10,0 +11,0 @@ * going to be installed. |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @since Xcode SDK 8.1 | ||
@@ -14,4 +15,4 @@ * @return {Promise<string>} Base64-encoded Simulator screenshot. | ||
*/ | ||
function getScreenshot(): Promise<string>; | ||
function getScreenshot(this: import("../simctl").default): Promise<string>; | ||
} | ||
//# sourceMappingURL=io.d.ts.map |
@@ -16,2 +16,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @since Xcode SDK 8.1 | ||
@@ -18,0 +19,0 @@ * @return {Promise<string>} Base64-encoded Simulator screenshot. |
@@ -21,2 +21,3 @@ export default commands; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -30,3 +31,3 @@ * the certificate content or the certificate content itself, depending on | ||
*/ | ||
function addRootCertificate(cert: string, opts?: CertOptions | undefined): Promise<void>; | ||
function addRootCertificate(this: import("../simctl").default, cert: string, opts?: CertOptions | undefined): Promise<void>; | ||
/** | ||
@@ -36,2 +37,3 @@ * Adds the given certificate to the Keychain Store on the simulator | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -45,3 +47,3 @@ * the certificate content or the certificate content itself, depending on | ||
*/ | ||
function addCertificate(cert: string, opts?: CertOptions | undefined): Promise<void>; | ||
function addCertificate(this: import("../simctl").default, cert: string, opts?: CertOptions | undefined): Promise<void>; | ||
/** | ||
@@ -51,2 +53,3 @@ * Resets the simulator keychain | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} if the current SDK version does not support the command | ||
@@ -56,4 +59,4 @@ * or there was an error while resetting the keychain | ||
*/ | ||
function resetKeychain(): Promise<void>; | ||
function resetKeychain(this: import("../simctl").default): Promise<void>; | ||
} | ||
//# sourceMappingURL=keychain.d.ts.map |
@@ -13,2 +13,7 @@ "use strict"; | ||
const commands = {}; | ||
/** | ||
* | ||
* @param {string|Buffer} payload | ||
* @param {(filePath: string) => Promise<any>} onPayloadStored | ||
*/ | ||
async function handleRawPayload(payload, onPayloadStored) { | ||
@@ -39,2 +44,3 @@ const filePath = path_1.default.resolve(os_1.default.tmpdir(), `${(0, uuid_1.v4)()}.pem`); | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -50,3 +56,3 @@ * the certificate content or the certificate content itself, depending on | ||
const { raw = false, } = opts; | ||
const execMethod = async (certPath) => await this.exec('keychain', { | ||
const execMethod = async (/** @type {string} */ certPath) => await this.exec('keychain', { | ||
args: [this.requireUdid('keychain add-root-cert'), 'add-root-cert', certPath], | ||
@@ -65,2 +71,3 @@ }); | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -90,2 +97,3 @@ * the certificate content or the certificate content itself, depending on | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} if the current SDK version does not support the command | ||
@@ -92,0 +100,0 @@ * or there was an error while resetting the keychain |
@@ -8,2 +8,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -18,4 +19,4 @@ * which is going to be removed. | ||
*/ | ||
function launchApp(bundleId: string, tries?: number | undefined): Promise<string>; | ||
function launchApp(this: import("../simctl").default, bundleId: string, tries?: number | undefined): Promise<string>; | ||
} | ||
//# sourceMappingURL=launch.d.ts.map |
@@ -14,2 +14,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -27,2 +28,4 @@ * which is going to be removed. | ||
return await (0, asyncbox_1.retryInterval)(tries, 1000, async () => { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const { stdout } = await this.exec('launch', { | ||
@@ -29,0 +32,0 @@ args: [this.requireUdid('launch'), bundleId], |
@@ -32,2 +32,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [platform] - The platform name, for example 'watchOS'. | ||
@@ -40,3 +41,3 @@ * @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version, | ||
*/ | ||
function getDevicesByParsing(platform?: string | null | undefined): Promise<Record<string, any>>; | ||
function getDevicesByParsing(this: import("../simctl").default, platform?: string | null | undefined): Promise<Record<string, any>>; | ||
/** | ||
@@ -46,2 +47,3 @@ * Parse the list of existing Simulator devices to represent | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [forSdk] - The sdk version, | ||
@@ -59,6 +61,7 @@ * for which the devices list should be parsed, | ||
*/ | ||
function getDevices(forSdk?: string | null | undefined, platform?: string | null | undefined): Promise<any>; | ||
function getDevices(this: import("../simctl").default, forSdk?: string | null | undefined, platform?: string | null | undefined): Promise<any>; | ||
/** | ||
* Get the runtime for the particular platform version using --json flag | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -70,6 +73,7 @@ * for example '10.3'. | ||
*/ | ||
function getRuntimeForPlatformVersionViaJson(platformVersion: string, platform?: string | undefined): Promise<string>; | ||
function getRuntimeForPlatformVersionViaJson(this: import("../simctl").default, platformVersion: string, platform?: string | undefined): Promise<string>; | ||
/** | ||
* Get the runtime for the particular platform version. | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -81,13 +85,15 @@ * for example '10.3'. | ||
*/ | ||
function getRuntimeForPlatformVersion(platformVersion: string, platform?: string | undefined): Promise<string>; | ||
function getRuntimeForPlatformVersion(this: import("../simctl").default, platformVersion: string, platform?: string | undefined): Promise<string>; | ||
/** | ||
* Get the list of device types available in the current Xcode installation | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string[]>} List of the types of devices available | ||
* @throws {Error} If the corresponding simctl command fails | ||
*/ | ||
function getDeviceTypes(): Promise<string[]>; | ||
function getDeviceTypes(this: import("../simctl").default): Promise<string[]>; | ||
/** | ||
* Get the full list of runtimes, devicetypes, devices and pairs as Object | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<Object>} Object containing device types, runtimes devices and pairs. | ||
@@ -124,4 +130,4 @@ * The resulting JSON will be like: | ||
*/ | ||
function list(): Promise<any>; | ||
function list(this: import("../simctl").default): Promise<any>; | ||
} | ||
//# sourceMappingURL=list.d.ts.map |
@@ -44,2 +44,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [platform] - The platform name, for example 'watchOS'. | ||
@@ -53,3 +54,4 @@ * @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version, | ||
commands.getDevicesByParsing = async function getDevicesByParsing(platform) { | ||
// get the list of devices | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -116,2 +118,3 @@ args: ['devices'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [forSdk] - The sdk version, | ||
@@ -132,2 +135,4 @@ * for which the devices list should be parsed, | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -198,2 +203,3 @@ args: ['devices', '-j'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -206,2 +212,4 @@ * for example '10.3'. | ||
commands.getRuntimeForPlatformVersionViaJson = async function getRuntimeForPlatformVersionViaJson(platformVersion, platform = 'iOS') { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -221,2 +229,3 @@ args: ['runtimes', '--json'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -231,2 +240,4 @@ * for example '10.3'. | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -251,2 +262,3 @@ args: ['runtimes'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string[]>} List of the types of devices available | ||
@@ -256,2 +268,4 @@ * @throws {Error} If the corresponding simctl command fails | ||
commands.getDeviceTypes = async function getDeviceTypes() { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -282,2 +296,3 @@ args: ['devicetypes', '-j'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<Object>} Object containing device types, runtimes devices and pairs. | ||
@@ -315,2 +330,4 @@ * The resulting JSON will be like: | ||
commands.list = async function list() { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('list', { | ||
@@ -317,0 +334,0 @@ args: ['-j'], |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|number} latitude Location latitude value | ||
@@ -14,9 +15,11 @@ * @param {string|number} longitude Location longitude value | ||
*/ | ||
function setLocation(latitude: string | number, longitude: string | number): Promise<void>; | ||
function setLocation(this: import("../simctl").default, latitude: string | number, longitude: string | number): Promise<void>; | ||
/** | ||
* Stop any running scenario and clear any simulated location. | ||
* This functionality is only available since Xcode 14. | ||
* | ||
* @since Xcode 14. | ||
* @this {import('../simctl').Simctl} | ||
*/ | ||
function clearLocation(): Promise<void>; | ||
function clearLocation(this: import("../simctl").default): Promise<void>; | ||
} | ||
//# sourceMappingURL=location.d.ts.map |
@@ -22,2 +22,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|number} latitude Location latitude value | ||
@@ -38,3 +39,5 @@ * @param {string|number} longitude Location longitude value | ||
* Stop any running scenario and clear any simulated location. | ||
* This functionality is only available since Xcode 14. | ||
* | ||
* @since Xcode 14. | ||
* @this {import('../simctl').Simctl} | ||
*/ | ||
@@ -41,0 +44,0 @@ commands.clearLocation = async function clearLocation() { |
@@ -8,2 +8,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} url - The URL scheme to open, for example http://appiom.io | ||
@@ -16,4 +17,4 @@ * will be opened by the built-in mobile browser. | ||
*/ | ||
function openUrl(url: string): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
function openUrl(this: import("../simctl").default, url: string): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
} | ||
//# sourceMappingURL=openurl.d.ts.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} url - The URL scheme to open, for example http://appiom.io | ||
@@ -18,2 +19,4 @@ * will be opened by the built-in mobile browser. | ||
commands.openUrl = async function openUrl(url) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('openurl', { | ||
@@ -20,0 +23,0 @@ args: [this.requireUdid('openurl'), url], |
@@ -8,5 +8,6 @@ export default commands; | ||
* @since Xcode SDK 8.1 | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} content - The actual string content to be set. | ||
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* UTF-8 by default. | ||
* @param {BufferEncoding} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* utf8 by default. | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -16,4 +17,4 @@ * returns non-zero return code. | ||
*/ | ||
function setPasteboard(content: string, encoding?: string | undefined): Promise<void>; | ||
function setPasteboard(this: import("../simctl").default, content: string, encoding?: BufferEncoding | undefined): Promise<void>; | ||
} | ||
//# sourceMappingURL=pbcopy.d.ts.map |
@@ -9,5 +9,6 @@ "use strict"; | ||
* @since Xcode SDK 8.1 | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} content - The actual string content to be set. | ||
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* UTF-8 by default. | ||
* @param {BufferEncoding} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* utf8 by default. | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -18,2 +19,4 @@ * returns non-zero return code. | ||
commands.setPasteboard = async function setPasteboard(content, encoding = 'utf8') { | ||
/** @type {import('teen_process').SubProcess} */ | ||
// @ts-ignore The returned type is ok | ||
const pbCopySubprocess = await this.exec('pbcopy', { | ||
@@ -25,6 +28,8 @@ args: [this.requireUdid('pbcopy')], | ||
const exitCodeVerifier = pbCopySubprocess.join(); | ||
const stdin = pbCopySubprocess.proc.stdin; | ||
stdin.setEncoding(encoding); | ||
stdin.write(content); | ||
stdin.end(); | ||
const stdin = pbCopySubprocess.proc?.stdin; | ||
if (stdin) { | ||
stdin.setDefaultEncoding(encoding); | ||
stdin.write(content); | ||
stdin.end(); | ||
} | ||
await exitCodeVerifier; | ||
@@ -31,0 +36,0 @@ }; |
@@ -8,2 +8,3 @@ export default commands; | ||
* @since Xcode 8.1 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content. | ||
@@ -16,4 +17,4 @@ * UTF-8 by default. | ||
*/ | ||
function getPasteboard(encoding?: string | undefined): Promise<string>; | ||
function getPasteboard(this: import("../simctl").default, encoding?: string | undefined): Promise<string>; | ||
} | ||
//# sourceMappingURL=pbpaste.d.ts.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
* @since Xcode 8.1 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content. | ||
@@ -18,2 +19,4 @@ * UTF-8 by default. | ||
commands.getPasteboard = async function getPasteboard(encoding = 'utf8') { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const { stdout } = await this.exec('pbpaste', { | ||
@@ -20,0 +23,0 @@ args: [this.requireUdid('pbpaste')], |
@@ -7,2 +7,3 @@ export default commands; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -28,3 +29,3 @@ * privacy settings are going to be changed | ||
*/ | ||
function grantPermission(bundleId: string, perm: string): Promise<void>; | ||
function grantPermission(this: import("../simctl").default, bundleId: string, perm: string): Promise<void>; | ||
/** | ||
@@ -35,2 +36,3 @@ * Revokes the given permission on the app with the given bundle identifier | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -43,3 +45,3 @@ * privacy settings are going to be changed | ||
*/ | ||
function revokePermission(bundleId: string, perm: string): Promise<void>; | ||
function revokePermission(this: import("../simctl").default, bundleId: string, perm: string): Promise<void>; | ||
/** | ||
@@ -50,2 +52,3 @@ * Resets the given permission on the app with the given bundle identifier | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -58,4 +61,4 @@ * privacy settings are going to be changed | ||
*/ | ||
function resetPermission(bundleId: string, perm: string): Promise<void>; | ||
function resetPermission(this: import("../simctl").default, bundleId: string, perm: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=privacy.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -39,2 +40,3 @@ * privacy settings are going to be changed | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -57,2 +59,3 @@ * privacy settings are going to be changed | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -59,0 +62,0 @@ * privacy settings are going to be changed |
@@ -7,2 +7,3 @@ export default commands; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {Object} payload - The object that describes Apple push notification content. | ||
@@ -24,4 +25,4 @@ * It must contain a top-level "Simulator Target Bundle" key with a string value matching | ||
*/ | ||
function pushNotification(payload: any): Promise<void>; | ||
function pushNotification(this: import("../simctl").default, payload: any): Promise<void>; | ||
} | ||
//# sourceMappingURL=push.d.ts.map |
@@ -16,2 +16,3 @@ "use strict"; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {Object} payload - The object that describes Apple push notification content. | ||
@@ -18,0 +19,0 @@ * It must contain a top-level "Simulator Target Bundle" key with a string value matching |
@@ -6,2 +6,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -11,4 +12,4 @@ * returns non-zero return code. | ||
*/ | ||
function shutdownDevice(): Promise<void>; | ||
function shutdownDevice(this: import("../simctl").default): Promise<void>; | ||
} | ||
//# sourceMappingURL=shutdown.d.ts.map |
@@ -35,2 +35,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -37,0 +38,0 @@ * returns non-zero return code. |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -15,3 +16,3 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
*/ | ||
function spawnProcess(args: string | string[], env?: any): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
function spawnProcess(this: import("../simctl").default, args: string | string[], env?: any): Promise<import("teen_process").TeenProcessExecResult<any>>; | ||
/** | ||
@@ -21,2 +22,3 @@ * Prepare SubProcess instance for a new process, which is going to be spawned | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -27,4 +29,4 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
*/ | ||
function spawnSubProcess(args: string | string[], env?: any): Promise<import("teen_process").SubProcess>; | ||
function spawnSubProcess(this: import("../simctl").default, args: string | string[], env?: any): Promise<import("teen_process").SubProcess>; | ||
} | ||
//# sourceMappingURL=spawn.d.ts.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -24,2 +25,4 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
} | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('spawn', { | ||
@@ -34,2 +37,3 @@ args: [this.requireUdid('spawn'), ...(lodash_1.default.isArray(args) ? args : [args])], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -44,2 +48,4 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
} | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('spawn', { | ||
@@ -46,0 +52,0 @@ args: [this.requireUdid('spawn'), ...(lodash_1.default.isArray(args) ? args : [args])], |
@@ -7,2 +7,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -14,4 +15,4 @@ * which is going to be terminated. | ||
*/ | ||
function terminateApp(bundleId: string): Promise<void>; | ||
function terminateApp(this: import("../simctl").default, bundleId: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=terminate.d.ts.map |
@@ -8,2 +8,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -10,0 +11,0 @@ * which is going to be terminated. |
@@ -7,2 +7,3 @@ export default commands; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string>} the appearance value, for example 'light' or 'dark' | ||
@@ -13,3 +14,3 @@ * @throws {Error} if the current SDK version does not support the command | ||
*/ | ||
function getAppearance(): Promise<string>; | ||
function getAppearance(this: import("../simctl").default): Promise<string>; | ||
/** | ||
@@ -19,2 +20,3 @@ * Sets the UI appearance to the given style | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appearance valid appearance value, for example 'light' or 'dark' | ||
@@ -25,4 +27,4 @@ * @throws {Error} if the current SDK version does not support the command | ||
*/ | ||
function setAppearance(appearance: string): Promise<void>; | ||
function setAppearance(this: import("../simctl").default, appearance: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=ui.d.ts.map |
@@ -12,2 +12,3 @@ "use strict"; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string>} the appearance value, for example 'light' or 'dark' | ||
@@ -19,2 +20,4 @@ * @throws {Error} if the current SDK version does not support the command | ||
commands.getAppearance = async function getAppearance() { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore We know the returned type is ok | ||
const { stdout } = await this.exec('ui', { | ||
@@ -29,2 +32,3 @@ args: [this.requireUdid('ui'), 'appearance'], | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appearance valid appearance value, for example 'light' or 'dark' | ||
@@ -31,0 +35,0 @@ * @throws {Error} if the current SDK version does not support the command |
@@ -8,2 +8,3 @@ export default commands; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -15,4 +16,4 @@ * which is going to be removed. | ||
*/ | ||
function removeApp(bundleId: string): Promise<void>; | ||
function removeApp(this: import("../simctl").default, bundleId: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=uninstall.d.ts.map |
@@ -9,2 +9,3 @@ "use strict"; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -11,0 +12,0 @@ * which is going to be removed. |
@@ -0,1 +1,8 @@ | ||
## [7.3.6](https://github.com/appium/node-simctl/compare/v7.3.5...v7.3.6) (2023-09-21) | ||
### Miscellaneous Chores | ||
* Import all mixin methods explicitly ([#205](https://github.com/appium/node-simctl/issues/205)) ([c691f20](https://github.com/appium/node-simctl/commit/c691f20ef4d843349b3c8ae0847b0a0d896482a0)) | ||
## [7.3.5](https://github.com/appium/node-simctl/compare/v7.3.4...v7.3.5) (2023-09-14) | ||
@@ -2,0 +9,0 @@ |
import _ from 'lodash'; | ||
import subcommands from './subcommands/index.js'; | ||
import which from 'which'; | ||
@@ -9,2 +8,27 @@ import log, { LOG_PREFIX } from './logger'; | ||
import { exec as tpExec, SubProcess } from 'teen_process'; | ||
import addmediaCommands from './subcommands/addmedia'; | ||
import appinfoCommands from './subcommands/appinfo'; | ||
import bootCommands from './subcommands/boot'; | ||
import bootstatusCommands from './subcommands/bootstatus'; | ||
import createCommands from './subcommands/create'; | ||
import deleteCommands from './subcommands/delete'; | ||
import eraseCommands from './subcommands/erase'; | ||
import getappcontainerCommands from './subcommands/get_app_container'; | ||
import installCommands from './subcommands/install'; | ||
import ioCommands from './subcommands/io'; | ||
import keychainCommands from './subcommands/keychain'; | ||
import launchCommands from './subcommands/launch'; | ||
import listCommands from './subcommands/list'; | ||
import openurlCommands from './subcommands/openurl'; | ||
import pbcopyCommands from './subcommands/pbcopy'; | ||
import pbpasteCommands from './subcommands/pbpaste'; | ||
import privacyCommands from './subcommands/privacy'; | ||
import pushCommands from './subcommands/push'; | ||
import envCommands from './subcommands/getenv'; | ||
import shutdownCommands from './subcommands/shutdown'; | ||
import spawnCommands from './subcommands/spawn'; | ||
import terminateCommands from './subcommands/terminate'; | ||
import uiCommands from './subcommands/ui'; | ||
import uninstallCommands from './subcommands/uninstall'; | ||
import locationCommands from './subcommands/location'; | ||
@@ -103,2 +127,6 @@ const SIMCTL_ENV_PREFIX = 'SIMCTL_CHILD_'; | ||
/** | ||
* @param {string?} [commandName=null] | ||
* @returns {string} | ||
*/ | ||
requireUdid (commandName = null) { | ||
@@ -112,2 +140,5 @@ if (!this.udid) { | ||
/** | ||
* @returns {Promise<string>} | ||
*/ | ||
async requireXcrun () { | ||
@@ -194,8 +225,64 @@ const xcrunBinary = getXcrunBinary(); | ||
} | ||
} | ||
addMedia = addmediaCommands.addMedia; | ||
// add all the subcommands to the Simctl prototype | ||
for (const [fnName, fn] of _.toPairs(subcommands)) { | ||
Simctl.prototype[fnName] = fn; | ||
appInfo = appinfoCommands.appInfo; | ||
bootDevice = bootCommands.bootDevice; | ||
startBootMonitor = bootstatusCommands.startBootMonitor; | ||
createDevice = createCommands.createDevice; | ||
deleteDevice = deleteCommands.deleteDevice; | ||
eraseDevice = eraseCommands.eraseDevice; | ||
getAppContainer = getappcontainerCommands.getAppContainer; | ||
getEnv = envCommands.getEnv; | ||
installApp = installCommands.installApp; | ||
getScreenshot = ioCommands.getScreenshot; | ||
addRootCertificate = keychainCommands.addRootCertificate; | ||
addCertificate = keychainCommands.addCertificate; | ||
resetKeychain = keychainCommands.resetKeychain; | ||
launchApp = launchCommands.launchApp; | ||
getDevicesByParsing = listCommands.getDevicesByParsing; | ||
getDevices = listCommands.getDevices; | ||
getRuntimeForPlatformVersionViaJson = listCommands.getRuntimeForPlatformVersionViaJson; | ||
getRuntimeForPlatformVersion = listCommands.getRuntimeForPlatformVersion; | ||
getDeviceTypes = listCommands.getDeviceTypes; | ||
list = listCommands.list; | ||
setLocation = locationCommands.setLocation; | ||
clearLocation = locationCommands.clearLocation; | ||
openUrl = openurlCommands.openUrl; | ||
setPasteboard = pbcopyCommands.setPasteboard; | ||
getPasteboard = pbpasteCommands.getPasteboard; | ||
grantPermission = privacyCommands.grantPermission; | ||
revokePermission = privacyCommands.revokePermission; | ||
resetPermission = privacyCommands.resetPermission; | ||
pushNotification = pushCommands.pushNotification; | ||
shutdownDevice = shutdownCommands.shutdownDevice; | ||
spawnProcess = spawnCommands.spawnProcess; | ||
spawnSubProcess = spawnCommands.spawnSubProcess; | ||
terminateApp = terminateCommands.terminateApp; | ||
getAppearance = uiCommands.getAppearance; | ||
setAppearance = uiCommands.setAppearance; | ||
removeApp = uninstallCommands.removeApp; | ||
} | ||
@@ -202,0 +289,0 @@ |
@@ -7,2 +7,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} filePath - Full path to a media file on the local | ||
@@ -16,2 +17,4 @@ * file system. | ||
commands.addMedia = async function addMedia (filePath) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('addmedia', { | ||
@@ -18,0 +21,0 @@ args: [this.requireUdid('addmedia'), filePath], |
@@ -10,2 +10,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - The bundle identifier of the target application. | ||
@@ -45,2 +46,4 @@ * @return {Promise<string>} The information about installed application. | ||
commands.appInfo = async function appInfo (bundleId) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('appinfo', { | ||
@@ -47,0 +50,0 @@ args: [this.requireUdid('appinfo'), bundleId], |
@@ -10,2 +10,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -12,0 +13,0 @@ * returns non-zero return code. |
@@ -25,2 +25,3 @@ import log from '../logger'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {BootMonitorOptions} [opts={}] - Monitoring options. | ||
@@ -51,2 +52,4 @@ * @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process. | ||
} | ||
/** @type {import('teen_process').SubProcess} */ | ||
// @ts-ignore The returned type is ok | ||
const bootMonitor = await this.exec('bootstatus', { | ||
@@ -53,0 +56,0 @@ args, |
@@ -23,2 +23,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} name - The device name to be created. | ||
@@ -79,2 +80,4 @@ * @param {string} deviceTypeId - Device type, for example 'iPhone 6'. | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('create', { | ||
@@ -81,0 +84,0 @@ args: [name, deviceTypeId, runtimeId] |
@@ -6,2 +6,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -8,0 +9,0 @@ * returns non-zero return code. |
@@ -9,2 +9,3 @@ import { retryInterval } from 'asyncbox'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait | ||
@@ -11,0 +12,0 @@ * unit device reset is completed. |
@@ -10,2 +10,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of an application. | ||
@@ -26,2 +27,3 @@ * @param {string?} [containerType=null] - Which container type to return. Possible values | ||
} | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('get_app_container', {args}); | ||
@@ -28,0 +30,0 @@ return (stdout || '').trim(); |
@@ -6,2 +6,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} varName - The name of the variable to be retrieved | ||
@@ -14,2 +15,4 @@ * @returns {Promise<string|null>} The value of the variable or null if the given variable | ||
commands.getEnv = async function getEnv (varName) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const {stdout, stderr} = await this.exec('getenv', { | ||
@@ -16,0 +19,0 @@ args: [this.requireUdid('getenv'), varName], |
@@ -7,2 +7,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appPath - Full path to .app package, which is | ||
@@ -9,0 +10,0 @@ * going to be installed. |
@@ -13,2 +13,3 @@ import { rimraf } from 'rimraf'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @since Xcode SDK 8.1 | ||
@@ -15,0 +16,0 @@ * @return {Promise<string>} Base64-encoded Simulator screenshot. |
@@ -10,2 +10,7 @@ import os from 'os'; | ||
/** | ||
* | ||
* @param {string|Buffer} payload | ||
* @param {(filePath: string) => Promise<any>} onPayloadStored | ||
*/ | ||
async function handleRawPayload (payload, onPayloadStored) { | ||
@@ -37,2 +42,3 @@ const filePath = path.resolve(os.tmpdir(), `${uuidV4()}.pem`); | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -50,3 +56,3 @@ * the certificate content or the certificate content itself, depending on | ||
} = opts; | ||
const execMethod = async (certPath) => await this.exec('keychain', { | ||
const execMethod = async (/** @type {string} */certPath) => await this.exec('keychain', { | ||
args: [this.requireUdid('keychain add-root-cert'), 'add-root-cert', certPath], | ||
@@ -65,2 +71,3 @@ }); | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} cert the full path to a valid .cert file containing | ||
@@ -92,2 +99,3 @@ * the certificate content or the certificate content itself, depending on | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} if the current SDK version does not support the command | ||
@@ -94,0 +102,0 @@ * or there was an error while resetting the keychain |
@@ -11,2 +11,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -24,2 +25,4 @@ * which is going to be removed. | ||
return await retryInterval(tries, 1000, async () => { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const {stdout} = await this.exec('launch', { | ||
@@ -26,0 +29,0 @@ args: [this.requireUdid('launch'), bundleId], |
@@ -20,2 +20,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [platform] - The platform name, for example 'watchOS'. | ||
@@ -29,3 +30,4 @@ * @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version, | ||
commands.getDevicesByParsing = async function getDevicesByParsing (platform) { | ||
// get the list of devices | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -95,2 +97,3 @@ args: ['devices'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string?} [forSdk] - The sdk version, | ||
@@ -111,2 +114,4 @@ * for which the devices list should be parsed, | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -181,2 +186,3 @@ args: ['devices', '-j'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -190,2 +196,4 @@ * for example '10.3'. | ||
platformVersion, platform = 'iOS') { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore the returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -206,2 +214,3 @@ args: ['runtimes', '--json'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} platformVersion - The platform version name, | ||
@@ -217,2 +226,4 @@ * for example '10.3'. | ||
try { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -239,2 +250,3 @@ args: ['runtimes'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string[]>} List of the types of devices available | ||
@@ -244,2 +256,4 @@ * @throws {Error} If the corresponding simctl command fails | ||
commands.getDeviceTypes = async function getDeviceTypes () { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -270,2 +284,3 @@ args: ['devicetypes', '-j'], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<Object>} Object containing device types, runtimes devices and pairs. | ||
@@ -303,2 +318,4 @@ * The resulting JSON will be like: | ||
commands.list = async function list () { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('list', { | ||
@@ -305,0 +322,0 @@ args: ['-j'], |
@@ -22,2 +22,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|number} latitude Location latitude value | ||
@@ -39,3 +40,5 @@ * @param {string|number} longitude Location longitude value | ||
* Stop any running scenario and clear any simulated location. | ||
* This functionality is only available since Xcode 14. | ||
* | ||
* @since Xcode 14. | ||
* @this {import('../simctl').Simctl} | ||
*/ | ||
@@ -42,0 +45,0 @@ commands.clearLocation = async function clearLocation () { |
@@ -8,2 +8,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} url - The URL scheme to open, for example http://appiom.io | ||
@@ -17,2 +18,4 @@ * will be opened by the built-in mobile browser. | ||
commands.openUrl = async function openUrl (url) { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('openurl', { | ||
@@ -19,0 +22,0 @@ args: [this.requireUdid('openurl'), url], |
@@ -8,5 +8,6 @@ const commands = {}; | ||
* @since Xcode SDK 8.1 | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} content - The actual string content to be set. | ||
* @param {string} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* UTF-8 by default. | ||
* @param {BufferEncoding} [encoding='utf8'] - The encoding of the given pasteboard content. | ||
* utf8 by default. | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -17,2 +18,4 @@ * returns non-zero return code. | ||
commands.setPasteboard = async function setPasteboard (content, encoding = 'utf8') { | ||
/** @type {import('teen_process').SubProcess} */ | ||
// @ts-ignore The returned type is ok | ||
const pbCopySubprocess = await this.exec('pbcopy', { | ||
@@ -24,6 +27,8 @@ args: [this.requireUdid('pbcopy')], | ||
const exitCodeVerifier = pbCopySubprocess.join(); | ||
const stdin = pbCopySubprocess.proc.stdin; | ||
stdin.setEncoding(encoding); | ||
stdin.write(content); | ||
stdin.end(); | ||
const stdin = pbCopySubprocess.proc?.stdin; | ||
if (stdin) { | ||
stdin.setDefaultEncoding(encoding); | ||
stdin.write(content); | ||
stdin.end(); | ||
} | ||
await exitCodeVerifier; | ||
@@ -30,0 +35,0 @@ }; |
@@ -8,2 +8,3 @@ const commands = {}; | ||
* @since Xcode 8.1 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content. | ||
@@ -17,2 +18,4 @@ * UTF-8 by default. | ||
commands.getPasteboard = async function getPasteboard (encoding = 'utf8') { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
const {stdout} = await this.exec('pbpaste', { | ||
@@ -19,0 +22,0 @@ args: [this.requireUdid('pbpaste')], |
@@ -7,2 +7,3 @@ const commands = {}; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -39,2 +40,3 @@ * privacy settings are going to be changed | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -58,2 +60,3 @@ * privacy settings are going to be changed | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId the identifier of the application whose | ||
@@ -60,0 +63,0 @@ * privacy settings are going to be changed |
@@ -13,2 +13,3 @@ import { rimraf } from 'rimraf'; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {Object} payload - The object that describes Apple push notification content. | ||
@@ -15,0 +16,0 @@ * It must contain a top-level "Simulator Target Bundle" key with a string value matching |
@@ -9,2 +9,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @throws {Error} If the corresponding simctl subcommand command | ||
@@ -11,0 +12,0 @@ * returns non-zero return code. |
@@ -10,2 +10,3 @@ import _ from 'lodash'; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -23,2 +24,4 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('spawn', { | ||
@@ -34,2 +37,3 @@ args: [this.requireUdid('spawn'), ...(_.isArray(args) ? args : [args])], | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string|string[]} args - Spawn arguments | ||
@@ -45,2 +49,4 @@ * @param {object} [env={}] - Additional environment variables mapping. | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore The returned type is ok | ||
return await this.exec('spawn', { | ||
@@ -47,0 +53,0 @@ args: [this.requireUdid('spawn'), ...(_.isArray(args) ? args : [args])], |
@@ -7,2 +7,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -9,0 +10,0 @@ * which is going to be terminated. |
@@ -10,2 +10,3 @@ import _ from 'lodash'; | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @return {Promise<string>} the appearance value, for example 'light' or 'dark' | ||
@@ -17,2 +18,4 @@ * @throws {Error} if the current SDK version does not support the command | ||
commands.getAppearance = async function getAppearance () { | ||
/** @type {import('teen_process').TeenProcessExecResult} */ | ||
// @ts-ignore We know the returned type is ok | ||
const {stdout} = await this.exec('ui', { | ||
@@ -28,2 +31,3 @@ args: [this.requireUdid('ui'), 'appearance'], | ||
* @since Xcode 11.4 SDK | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} appearance valid appearance value, for example 'light' or 'dark' | ||
@@ -30,0 +34,0 @@ * @throws {Error} if the current SDK version does not support the command |
@@ -8,2 +8,3 @@ const commands = {}; | ||
* | ||
* @this {import('../simctl').Simctl} | ||
* @param {string} bundleId - Bundle identifier of the application, | ||
@@ -10,0 +11,0 @@ * which is going to be removed. |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "7.3.5", | ||
"version": "7.3.6", | ||
"author": "Appium Contributors", | ||
@@ -12,0 +12,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
237906
4179
146