appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
87 lines • 3.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const sinon_1 = __importDefault(require("sinon"));
const driver_1 = require("../../lib/driver");
const chai_1 = __importDefault(require("chai"));
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
chai_1.default.use(chai_as_promised_1.default);
describe('process args', function () {
const BUNDLE_ID = 'com.test.app';
const driver = new driver_1.XCUITestDriver({});
driver.opts.platformVersion = '10.3';
let mockDriver;
const DEFAULT_CAPS = {
elementResponseFields: undefined,
disableAutomaticScreenshots: undefined,
shouldUseCompactResponses: undefined,
waitForIdleTimeout: undefined,
shouldWaitForQuiescence: true,
shouldUseTestManagerForVisibilityDetection: false,
maxTypingFrequency: 60,
forceAppLaunch: true,
forceSimulatorSoftwareKeyboardPresence: true,
useNativeCachingStrategy: true,
shouldTerminateApp: true,
shouldUseSingletonTestManager: true,
appLaunchStateTimeoutSec: undefined,
eventloopIdleDelaySec: 0,
};
const PROCESS_ARGS_OBJECT = {
args: ['a', 'b', 'c'],
env: { a: 'b', c: 'd' },
};
const processArgsString = JSON.stringify(PROCESS_ARGS_OBJECT);
const desired = {
capabilities: {
firstMatch: [
{
...DEFAULT_CAPS,
bundleId: BUNDLE_ID,
arguments: PROCESS_ARGS_OBJECT.args,
environment: PROCESS_ARGS_OBJECT.env,
},
],
alwaysMatch: {},
},
};
beforeEach(function () {
mockDriver = sinon_1.default.mock(driver);
});
afterEach(function () {
mockDriver.verify();
});
describe('send process args as object', function () {
it('should send translated POST /session request with valid desired caps to WDA', async function () {
mockDriver.expects('proxyCommand').once().withExactArgs('/session', 'POST', desired);
const desiredWithProArgsObject = {
platformName: 'iOS',
platformVersion: '10.3',
deviceName: 'iPhone 6',
app: 'testapp.app',
bundleId: BUNDLE_ID,
processArguments: PROCESS_ARGS_OBJECT,
};
driver.validateDesiredCaps(desiredWithProArgsObject);
await driver.startWdaSession(desiredWithProArgsObject.bundleId, desiredWithProArgsObject.processArguments);
});
});
describe('send process args json string', function () {
it('should send translated POST /session request with valid desired caps to WDA', async function () {
mockDriver.expects('proxyCommand').once().withExactArgs('/session', 'POST', desired);
const desiredWithProArgsString = {
platformName: 'iOS',
platformVersion: '10.3',
deviceName: 'iPhone 6',
app: 'testapp.app',
bundleId: BUNDLE_ID,
processArguments: processArgsString,
};
driver.validateDesiredCaps(desiredWithProArgsString);
await driver.startWdaSession(desiredWithProArgsString.bundleId, desiredWithProArgsString.processArguments);
});
});
});
//# sourceMappingURL=processargs-specs.js.map