appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
49 lines • 2.39 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const lodash_1 = __importDefault(require("lodash"));
const utils_1 = require("../utils");
const driver_1 = require("appium/driver");
const assertSimulator = lodash_1.default.partial(utils_1.assertSimulator, 'Content size ui command');
const INCREASE_CONTRAST_CONFIG = [
'enabled',
'disabled',
];
exports.default = {
/**
* Sets the increase contrast configuration for the given simulator.
*
* @since Xcode 15 (but lower xcode could have this command)
* @param {IncreaseContrastAction} increaseContrast valid increase constrast configuration value.
* Acceptable value is 'enabled' or 'disabled' with Xcode 16.2.
* @throws {Error} if the current platform does not support content size appearance changes
* @this {XCUITestDriver}
*/
async mobileSetIncreaseContrast(increaseContrast) {
const simulator = assertSimulator(this);
if (!INCREASE_CONTRAST_CONFIG.includes(lodash_1.default.lowerCase(increaseContrast))) {
throw new driver_1.errors.InvalidArgumentError(`The 'increaseContrast' value is expected to be one of ${INCREASE_CONTRAST_CONFIG.join(',')}`);
}
await simulator.setIncreaseContrast(increaseContrast);
},
/**
* Retrieves the current increase contrast configuration value from the given simulator.
*
* @since Xcode 15 (but lower xcode could have this command)
* @returns {Promise<IncreaseContrastResult>} the contrast configuration value.
* Possible return value is 'enabled', 'disabled',
* 'unsupported' or 'unknown' with Xcode 16.2.
* @this {XCUITestDriver}
*/
async mobileGetIncreaseContrast() {
return /** @type {IncreaseContrastResult} */ (await assertSimulator(this).getIncreaseContrast());
},
};
/**
* @typedef {import('../driver').XCUITestDriver} XCUITestDriver
* @typedef {import('./types').IncreaseContrastAction} IncreaseContrastAction
* @typedef {import('./types').IncreaseContrastResult} IncreaseContrastResult
*/
//# sourceMappingURL=increase-contrast.js.map