appium-mac2-driver
Version:
XCTest-based Appium driver for macOS apps automation
58 lines • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.optionalAutomationModeCheck = exports.OptionalAutomationModeCheck = exports.optionalFfmpegCheck = exports.OptionalFfmpegCheck = void 0;
const utils_1 = require("./utils");
const support_1 = require("appium/support");
const teen_process_1 = require("teen_process");
require("@colors/colors");
class OptionalFfmpegCheck {
log;
static FFMPEG_BINARY = 'ffmpeg';
static FFMPEG_INSTALL_LINK = 'https://www.ffmpeg.org/download.html';
async diagnose() {
const ffmpegPath = await (0, utils_1.resolveExecutablePath)(OptionalFfmpegCheck.FFMPEG_BINARY);
return ffmpegPath
? support_1.doctor.okOptional(`${OptionalFfmpegCheck.FFMPEG_BINARY} exists at '${ffmpegPath}'`)
: support_1.doctor.nokOptional(`${OptionalFfmpegCheck.FFMPEG_BINARY} cannot be found`);
}
async fix() {
return (`${`${OptionalFfmpegCheck.FFMPEG_BINARY}`.bold} is used to capture screen recordings. ` +
`Please read ${OptionalFfmpegCheck.FFMPEG_INSTALL_LINK}.`);
}
hasAutofix() {
return false;
}
isOptional() {
return true;
}
}
exports.OptionalFfmpegCheck = OptionalFfmpegCheck;
exports.optionalFfmpegCheck = new OptionalFfmpegCheck();
class OptionalAutomationModeCheck {
log;
async diagnose() {
let stdout;
try {
({ stdout } = await (0, teen_process_1.exec)('automationmodetool'));
}
catch (err) {
return support_1.doctor.nokOptional(`Cannot run 'automationmodetool': ${err.stderr || err.message}`);
}
if (stdout.includes('DOES NOT REQUIRE')) {
return support_1.doctor.okOptional(`Automation Mode does not require user authentication`);
}
return support_1.doctor.nokOptional(`Automation Mode requires user authentication`);
}
async fix() {
return `Run \`automationmodetool enable-automationmode-without-authentication\` to disable Automation Mode authentication`;
}
hasAutofix() {
return false;
}
isOptional() {
return true;
}
}
exports.OptionalAutomationModeCheck = OptionalAutomationModeCheck;
exports.optionalAutomationModeCheck = new OptionalAutomationModeCheck();
//# sourceMappingURL=optional-checks.js.map