UNPKG

appium-xcuitest-driver

Version:

Appium driver for iOS using XCUITest for backend

65 lines 2.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mobileEnableVoiceOver = mobileEnableVoiceOver; exports.mobileDisableVoiceOver = mobileDisableVoiceOver; exports.mobileIsVoiceOverEnabled = mobileIsVoiceOverEnabled; exports.mobileVoiceOverMove = mobileVoiceOverMove; exports.mobileVoiceOverCurrentSpeech = mobileVoiceOverCurrentSpeech; const driver_1 = require("appium/driver"); const utils_1 = require("../utils"); /** * Enables VoiceOver on the device under test. * * @since iOS/tvOS 27 */ async function mobileEnableVoiceOver() { requireIos27VoiceOver(this, 'mobile: enableVoiceOver'); await this.proxyCommand('/wda/voiceOver/enable', 'POST'); } /** * Disables VoiceOver on the device under test. * * @since iOS/tvOS 27 */ async function mobileDisableVoiceOver() { requireIos27VoiceOver(this, 'mobile: disableVoiceOver'); await this.proxyCommand('/wda/voiceOver/disable', 'POST'); } /** * Returns whether VoiceOver is currently enabled. * * @since iOS/tvOS 27 */ async function mobileIsVoiceOverEnabled() { requireIos27VoiceOver(this, 'mobile: isVoiceOverEnabled'); return await this.proxyCommand('/wda/voiceOver/enabled', 'GET'); } /** * Moves VoiceOver focus in the given direction. * * @since iOS/tvOS 27 * @param direction - One of `forward`, `backward`, `in` (iOS only), or `out` (iOS only). * @returns The utterance spoken after the move, or `null`. */ async function mobileVoiceOverMove(direction) { requireIos27VoiceOver(this, 'mobile: voiceOverMove'); return await this.proxyCommand('/wda/voiceOver/move', 'POST', { direction, }); } /** * Returns the current VoiceOver utterance without moving focus. * * @since iOS/tvOS 27 */ async function mobileVoiceOverCurrentSpeech() { requireIos27VoiceOver(this, 'mobile: voiceOverCurrentSpeech'); return await this.proxyCommand('/wda/voiceOver/currentSpeech', 'GET'); } function requireIos27VoiceOver(driver, script) { if (!(0, utils_1.isIos27OrNewer)(driver.opts)) { throw new driver_1.errors.InvalidArgumentError(`${script} requires iOS/tvOS 27 or newer. ` + `The current platformVersion is '${driver.opts.platformVersion ?? 'unknown'}'.`); } } //# sourceMappingURL=voiceover.js.map