appium-xcuitest-driver
Version:
Appium driver for iOS using XCUITest for backend
49 lines • 1.73 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");
describe('session commands', function () {
const driver = new driver_1.XCUITestDriver({});
let mockDriver;
beforeEach(function () {
mockDriver = sinon_1.default.mock(driver);
});
afterEach(function () {
try {
mockDriver.verify();
}
finally {
proxySpy.reset();
for (const stub of otherStubs) {
stub.reset();
}
}
});
driver.opts.udid = 'cecinestpasuneudid';
const proxySpy = sinon_1.default.stub(driver, 'proxyCommand').callsFake(async (endpoint, method) => {
if (endpoint === '/' && method === 'GET') {
// XXX this is synchronous
return await {
capabilities: {
sillyCap: true,
app: 'LOL.app',
},
};
}
// XXX this is synchronous
return await {};
});
const otherStubs = [
sinon_1.default.stub(driver, 'getStatusBarHeight').resolves(20),
sinon_1.default.stub(driver, 'getViewportRect').resolves({ height: 3, width: 4, left: 0, top: 0 }),
sinon_1.default.stub(driver, 'getScreenInfo').resolves({
statusBarSize: { width: 400, height: 20 },
scale: 3,
}),
sinon_1.default.stub(driver, 'getDevicePixelRatio').resolves(3),
];
});
//# sourceMappingURL=session-specs.js.map