How to use appium-xcode - 10 common examples

To help you get started, we’ve selected a few appium-xcode 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 / test / functional / basic / gesture-e2e-specs.js View on Github external
it('should double tap on an element', async function () {
      // FIXME: Multitouch does not work as expected in Xcode < 9.
      // cloud tests are run on Linux, so no Xcode version to check
      if (!process.env.CLOUD && (await xcode.getVersion(true)).major < 9) {
        return this.skip();
      }

      await driver.execute('mobile: scroll', {direction: 'down'});
      await driver.elementByAccessibilityId('Steppers').click();

      let stepper = await driver.elementByAccessibilityId('Increment');
      let action = new wd.TouchAction(driver);
      action.tap({el: stepper, count: 2});
      await action.perform();

      await driver.elementByAccessibilityId('2')
        .should.not.be.rejected;
    });
    it(`should swipe the table and the bottom cell's Y position should change accordingly`, async function () {
github appium / appium-xcuitest-driver / test / functional / driver / webdriveragent-e2e-specs.js View on Github external
before(async function () {
    // Don't do these tests on Sauce Labs
    if (process.env.CLOUD) {
      this.skip();
    }

    xcodeVersion = await getVersion(true);
  });
  describe('with fresh sim', function () {
github appium / appium-ios-simulator / lib / utils.js View on Github external
async function killAllSimulators (timeout = DEFAULT_SIM_SHUTDOWN_TIMEOUT) {
  log.debug('Killing all iOS Simulators');
  const xcodeVersion = await getVersion(true);
  const appName = xcodeVersion.major >= 7 ? 'Simulator' : 'iOS Simulator';

  // later versions are slower to close
  timeout = timeout * (xcodeVersion.major >= 8 ? 2 : 1);

  try {
    await exec('xcrun', ['simctl', 'shutdown', xcodeVersion.major > 8 ? 'all' : 'booted'], {timeout});
  } catch (ign) {}

  const pids = [];
  try {
    const {stdout} = await exec('pgrep', ['-f', `${appName}.app/Contents/MacOS/`]);
    if (stdout.trim()) {
      pids.push(...(stdout.trim().split(/\s+/)));
    }
  } catch (e) {
github appium-boneyard / appium-instruments / lib / utils.js View on Github external
async function quickLaunch (udid, appPath = path.resolve(__dirname, '..', '..', 'assets', 'TestApp.app')) {
  let traceTemplatePath = await xcode.getAutomationTraceTemplatePath();
  let scriptPath = path.resolve(__dirname, '..', '..', 'assets', 'blank_instruments_test.js');
  let traceDocument = path.resolve('/', 'tmp', 'testTrace.trace');
  let resultsPath = path.resolve('/', 'tmp');

  // the trace document can be in a weird state
  // but we never do anything with it, so delete
  await fs.rimraf(traceDocument);

  let args = ['instruments',
              '-D', traceDocument,
               '-t', traceTemplatePath,
               '-w', udid,
               appPath,
               '-e', 'UIASCRIPT', scriptPath,
               '-e', 'UIARESULTSPATH', resultsPath];
  log.debug(`Running command: 'xcrun ${args.join(' ')}'`);
github appium / appium-ios-driver / lib / instruments / utils.js View on Github external
async function quickLaunch (udid, appPath = path.resolve(__dirname, '..', '..', 'assets', 'TestApp.app')) {
  let traceTemplatePath = await xcode.getAutomationTraceTemplatePath();
  let scriptPath = path.resolve(__dirname, '..', '..', 'assets', 'blank_instruments_test.js');
  let traceDocument = path.resolve('/', 'tmp', 'testTrace.trace');
  let resultsPath = path.resolve('/', 'tmp');

  // the trace document can be in a weird state
  // but we never do anything with it, so delete
  await fs.rimraf(traceDocument);

  let args = [
    'instruments',
    '-D', traceDocument,
    '-t', traceTemplatePath,
    '-w', udid,
    appPath,
    '-e', 'UIASCRIPT', scriptPath,
    '-e', 'UIARESULTSPATH', resultsPath];
github appium / appium-ios-driver / lib / utils.js View on Github external
async function prepareIosOpts (opts) {
  opts.backendRetries = 4;
  opts.withoutDelay = !opts.nativeInstrumentsLib;
  opts.reset = !opts.noReset;
  opts.initialOrientation = opts.deviceOrientation ||
                            opts.orientation ||
                            'PORTRAIT';
  opts.useRobot = opts.robotPort > 0;
  opts.robotUrl = opts.useRobot ?
    `http://${opts.robotAddress}:${opts.robotPort}` : null;
  if (opts.locationServicesAuthorized && !opts.bundleId) {
    throw new Error('You must set the bundleId cap if using locationServicesEnabled');
  }

  opts.platformVersion = opts.platformVersion || await xcode.getMaxIOSSDK();
  let pv = parseFloat(opts.platformVersion);
  if (pv < 8) {
    logger.warn(`iOS version ${opts.platformVersion} support has been ` +
                `deprecated and will be removed in a future version of ` +
                `Appium.`);
  }
  opts.localizableStringsDir = opts.localizableStringsDir || 'en.lproj';
  opts.autoAcceptAlerts = _.isNull(opts.autoAcceptAlerts) || _.isUndefined(opts.autoAcceptAlerts) ? false : opts.autoAcceptAlerts;
  opts.autoDismissAlerts = _.isNull(opts.autoDismissAlerts) || _.isUndefined(opts.autoDismissAlerts) ? false : opts.autoDismissAlerts;

  if ((opts.browserName || '').toLowerCase() === 'safari' ||
      (opts.app || '').toLowerCase() === 'safari' ||
      (opts.bundleId || '').toLowerCase() === SAFARI_BUNDLE) {
    // preparing a safari session
    if (opts.udid) {
      // on a real device
github appium / appium-ios-simulator / lib / simulator-xcode-6.js View on Github external
static async _getDeviceStringPlatformVersion (platformVersion) {
    let reqVersion = platformVersion;
    if (!reqVersion) {
      reqVersion = await xcode.getMaxIOSSDK();
      log.warn(`No platform version set. Using max SDK version: ${reqVersion}`);
      // this will be a number, and possibly an integer (e.g., if max iOS SDK is 9)
      // so turn it into a string and add a .0 if necessary
      if (!_.isString(reqVersion)) {
        reqVersion = (reqVersion % 1) ? String(reqVersion) : `${reqVersion}.0`;
      }
    }
    return reqVersion;
  }
github appium / appium-ios-simulator / test / functional / simulator-e2e-specs.js View on Github external
before(async function () {
      let exists = await fs.exists(app);
      if (!exists) {
        app = path.resolve(__dirname, '..', '..', '..', 'test', 'assets', 'TestApp-iphonesimulator.app');
      }

      xcodeVersion = await xcode.getVersion(true);
    });
github appium / node-simctl / test / simctl-e2e-specs.js View on Github external
before(async function () {
      ({major, minor} = await xcode.getVersion(true));
      if (major < 8 || (major === 8 && minor < 1)) {
        return this.skip();
      }

      const sdk = process.env.IOS_SDK || _.last(validSdks);
      udid = await createDevice('runningSimTest', DEVICE_NAME, sdk);

      await bootDevice(udid);
      await startBootMonitor(udid, {timeout: MOCHA_TIMEOUT});
    });
    after(async function () {
github appium / appium-xcuitest-driver / lib / utils.js View on Github external
async function getAndCheckIosSdkVersion () {
  try {
    return await xcode.getMaxIOSSDK();
  } catch (err) {
    log.errorAndThrow(`Could not determine iOS SDK version: ${err.message}`);
  }
}