appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
42 lines • 1.8 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.XCTestClient = void 0;
const xctest_remotexpc_1 = require("./xctest-remotexpc");
const utils_1 = require("../utils");
const XCTEST_REAL_DEVICE_MSG = 'This XCTest operation is only supported on real devices running iOS/tvOS 18 or newer with the ' +
'appium-ios-remotexpc package.';
class XCTestClient {
deps;
constructor(deps) {
this.deps = deps;
}
static fromDriver(driver) {
return new XCTestClient({
udid: driver.device.udid,
isRealDevice: driver.isRealDevice(),
platformVersion: driver.opts.platformVersion,
});
}
async run({ testRunnerBundleId, appUnderTestBundleId, xcTestBundleId, args = [], testType = 'ui', env, timeout = 360000, }) {
this.assertRealDeviceRemoteXpc();
if (testType === 'logic') {
throw new Error('Logic XCTests on real devices are not supported.');
}
return await (0, xctest_remotexpc_1.runXCTestViaRemoteXPC)(this.deps.udid, testRunnerBundleId, appUnderTestBundleId, xcTestBundleId, testType, args, env, timeout);
}
async installBundle(xctestApp) {
this.assertRealDeviceRemoteXpc();
await (0, xctest_remotexpc_1.installXCTestBundleViaRemoteXPC)(this.deps.udid, xctestApp);
}
async listBundles() {
this.assertRealDeviceRemoteXpc();
return await (0, xctest_remotexpc_1.listXCTestBundlesViaRemoteXPC)(this.deps.udid);
}
assertRealDeviceRemoteXpc() {
if (!this.deps.isRealDevice || !(0, utils_1.isIos18OrNewerPlatform)(this.deps.platformVersion)) {
throw new Error(XCTEST_REAL_DEVICE_MSG);
}
}
}
exports.XCTestClient = XCTestClient;
//# sourceMappingURL=xctest-client.js.map