How to use appium-webdriveragent - 6 common examples

To help you get started, we’ve selected a few appium-webdriveragent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-xcuitest-driver / lib / simulator-management.js View on Github external
async function shutdownOtherSimulators (currentDevice) {
  const allDevices = _.flatMap(_.values(await getDevices()));
  const otherBootedDevices = allDevices.filter((device) => device.udid !== currentDevice.udid && device.state === 'Booted');
  if (_.isEmpty(otherBootedDevices)) {
    log.info('No other running simulators have been detected');
    return;
  }
  log.info(`Detected ${otherBootedDevices.length} other running Simulator${otherBootedDevices.length === 1 ? '' : 's'}.` +
           `Shutting ${otherBootedDevices.length === 1 ? 'it' : 'them'} down...`);
  for (const {udid} of otherBootedDevices) {
    // It is necessary to stop the corresponding xcodebuild process before killing
    // the simulator, otherwise it will be automatically restarted
    await resetTestProcesses(udid, true);
    await shutdown(udid);
  }
}
github appium / appium-xcuitest-driver / lib / simulator-management.js View on Github external
async function shutdownSimulator (device) {
  // stop XCTest processes if running to avoid unexpected side effects
  await resetTestProcesses(device.udid, true);
  await device.shutdown();
}
github appium / appium-xcuitest-driver / test / functional / helpers / simulator.js View on Github external
async function killAllSimulators () {
  if (process.env.CLOUD) {
    return;
  }

  const allDevices = _.flatMap(_.values(await getDevices()));
  const bootedDevices = allDevices.filter((device) => device.state === 'Booted');

  for (const {udid} of bootedDevices) {
    // It is necessary to stop the corresponding xcodebuild process before killing
    // the simulator, otherwise it will be automatically restarted
    await resetTestProcesses(udid, true);
    await shutdown(udid);
  }
  await simKill();
}
github appium / appium-xcuitest-driver / lib / driver.js View on Github external
async startWda (sessionId, realDevice) {
    this.wda = new WebDriverAgent(this.xcodeVersion, this.opts);

    // Don't cleanup the processes if webDriverAgentUrl is set
    if (!util.hasValue(this.wda.webDriverAgentUrl)) {
      await this.wda.cleanupObsoleteProcesses();
    }

    const usePortForwarding = this.isRealDevice()
      && !this.wda.webDriverAgentUrl
      && isLocalHost(this.wda.wdaBaseUrl);
    await DEVICE_CONNECTIONS_FACTORY.requestConnection(this.opts.udid, this.wda.url.port, {
      devicePort: this.wda.wdaRemotePort,
      usePortForwarding,
    });

    // Let multiple WDA binaries with different derived data folders be built in parallel
    // Concurrent WDA builds from the same source will cause xcodebuild synchronization errors
github appium / appium-xcuitest-driver / lib / wda / utils.js View on Github external
async function updateProjectFile (agentPath, newBundleId) {
  let projectFilePath = `${agentPath}/${PROJECT_FILE}`;
  try {
    // Assuming projectFilePath is in the correct state, create .old from projectFilePath
    await fs.copyFile(projectFilePath, `${projectFilePath}.old`);
    await replaceInFile(projectFilePath, new RegExp(WDA_RUNNER_BUNDLE_ID.replace('.', '\.'), 'g'), newBundleId); // eslint-disable-line no-useless-escape
    log.debug(`Successfully updated '${projectFilePath}' with bundle id '${newBundleId}'`);
  } catch (err) {
    log.debug(`Error updating project file: ${err.message}`);
    log.warn(`Unable to update project file '${projectFilePath}' with ` +
             `bundle id '${newBundleId}'. WebDriverAgent may not start`);
  }
}
github appium / appium-xcuitest-driver / lib / wda / webdriveragent.js View on Github external
async fetchWDABundle () {
    if (!this.derivedDataPath) {
      return await bundleWDASim();
    }
    const wdaBundlePath = await fs.walkDir(this.derivedDataPath, true, (item) => item.endsWith('WebDriverAgentRunner-Runner.app'));
    if (!wdaBundlePath) {
      throw new Error(`Couldn't find the WDA bundle in the ${this.derivedDataPath}`);
    }
    return wdaBundlePath;
  }

appium-webdriveragent

Package bundling WebDriverAgent

Apache-2.0
Latest version published 19 days ago

Package Health Score

86 / 100
Full package analysis