Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(function () {
driver = new XCUITestDriver();
// fake the proxy to WDA
const jwproxy = new JWProxy();
jwproxyCommandSpy = sinon.stub(jwproxy, 'command').callsFake(async function () { // eslint-disable-line require-await
return {some: 'thing'};
});
driver.wda = {
jwproxy,
};
});
setupProxies (sessionId) {
const proxyOpts = {
server: this.url.hostname,
port: this.url.port,
base: '',
timeout: this.wdaConnectionTimeout,
};
this.jwproxy = new JWProxy(proxyOpts);
this.jwproxy.sessionId = sessionId;
this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);
this.noSessionProxy = new NoSessionProxy(proxyOpts);
this.noSessionProxyReqRes = this.noSessionProxy.proxyReqRes.bind(this.noSessionProxy);
}
setupProxies (sessionId) {
const proxyOpts = {
server: this.url.hostname,
port: this.url.port,
base: '',
timeout: this.wdaConnectionTimeout,
keepAlive: true,
};
this.jwproxy = new JWProxy(proxyOpts);
this.jwproxy.sessionId = sessionId;
this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);
this.noSessionProxy = new NoSessionProxy(proxyOpts);
}
isAutodownloadEnabled = false,
} = args;
this.proxyHost = host;
this.proxyPort = port;
this.adb = adb;
this.cmdArgs = cmdArgs;
this.proc = null;
this.useSystemExecutable = useSystemExecutable;
this.chromedriver = executable;
this.executableDir = executableDir;
this.mappingPath = mappingPath;
this.bundleId = bundleId;
this.executableVerified = false;
this.state = Chromedriver.STATE_STOPPED;
this.jwproxy = new JWProxy({server: this.proxyHost, port: this.proxyPort});
this.verbose = verbose;
this.logPath = logPath;
this.disableBuildCheck = !!disableBuildCheck;
this.storageClient = isAutodownloadEnabled
? new ChromedriverStorageClient({ chromedriverDir: this.executableDir })
: null;
this.capabilities = {};
this.desiredProtocol = PROTOCOLS.MJSONWP;
}
constructor (opts = {}) {
for (let req of REQD_PARAMS) {
if (!opts || !util.hasValue(opts[req])) {
throw new Error(`Option '${req}' is required!`);
}
this[req] = opts[req];
}
this.jwproxy = new JWProxy({
server: this.host,
port: this.systemPort,
keepAlive: true,
});
this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);
}
constructor () {
this.proxyHost = DEFAULT_A4M_HOST;
this.proxyPort = DEFAULT_A4M_PORT;
this.proc = null;
this.jwproxy = new JWProxy({server: this.proxyHost, port: this.proxyPort});
}