Verify that Appium is running so it can be used for local iOS tests.
514677
def verify_appium_is_running(self):
        """"""
        process = Popen(['ps -e | grep "Appium"'], shell=True, stdout=PIPE)
        (grep_output, _grep_error) = process.communicate()
        lines = grep_output.split('\n')
        for line in lines:
            if 'Appium.app' in line:
                self.stdout.write('Appium is already running')
                return True
        self.stdout.write('Please launch and configure Appium first')
        return False
338149
def is_local(self):
        """"""
        local_repo = package_repository_manager.get_repository(
            self.config.local_packages_path)
        return (self.resource._repository.uid == local_repo.uid)
289367
def detectAndroid(self):
        
        if UAgentInfo.deviceAndroid in self.__userAgent \
           or self.detectGoogleTV():
            return True

        return False
228875
public void start() throws AppiumServerHasNotBeenStartedLocallyException {
        lock.lock();
        try {
            if (isRunning()) {
                return;
            }

            try {
                process = new CommandLine(this.nodeJSExec.getCanonicalPath(),
                    nodeJSArgs.toArray(new String[] {}));
                process.setEnvironmentVariables(nodeJSEnvironment);
                process.copyOutputTo(stream);
                process.executeAsync();
                ping(startupTimeout, timeUnit);
            } catch (Throwable e) {
                destroyProcess();
                String msgTxt = "The local appium server has not been started. "
                    + "The given Node.js executable: " + this.nodeJSExec.getAbsolutePath()
                    + " Arguments: " + nodeJSArgs.toString() + " " + "\n";
                if (process != null) {
                    String processStream = process.getStdOut();
                    if (!StringUtils.isBlank(processStream)) {
                        msgTxt = msgTxt + "Process output: " + processStream + "\n";
                    }
                }

                throw new AppiumServerHasNotBeenStartedLocallyException(msgTxt, e);
            }
        } finally {
            lock.unlock();
        }
    }
781683
def appium_server_start(**options)
      command = +'appium'
      command << " --nodeconfig #{options[:config]}" if options.key?(:config)
      command << " -p #{options[:port]}" if options.key?(:port)
      command << " -bp #{options[:bp]}" if options.key?(:bp)
      command << " --log #{Dir.pwd}/output/#{options[:log]}" if options.key?(:log)
      command << " --tmp #{ENV['BASE_DIR']}/tmp/#{options[:tmp]}" if options.key?(:tmp)
      Dir.chdir('.') do
        puts(command)
        pid = spawn(command, out: '/dev/null')
        puts 'Waiting for Appium to start up...'
        sleep 10
        puts "Appium PID: #{pid}"
        puts 'Appium server did not start' if pid.nil?
      end
    end
1257153
def before_scenario(context, scenario):
    
    # Configure reset properties from behave tags
    if 'no_reset_app' in scenario.tags:
        os.environ["AppiumCapabilities_noReset"] = 'true'
        os.environ["AppiumCapabilities_fullReset"] = 'false'
    elif 'reset_app' in scenario.tags:
        os.environ["AppiumCapabilities_noReset"] = 'false'
        os.environ["AppiumCapabilities_fullReset"] = 'false'
    elif 'full_reset_app' in scenario.tags:
        os.environ["AppiumCapabilities_noReset"] = 'false'
        os.environ["AppiumCapabilities_fullReset"] = 'true'

    # Force to reset driver before each scenario if it has @reset_driver tag
    if 'reset_driver' in scenario.tags:
        DriverWrappersPool.stop_drivers()
        DriverWrappersPool.download_videos('multiple tests', context.global_status['test_passed'])
        DriverWrappersPool.save_all_ggr_logs('multiple tests', context.global_status['test_passed'])
        DriverWrappersPool.remove_drivers()
        context.global_status['test_passed'] = True

    # Skip android_only or ios_only scenarios
    if 'android_only' in scenario.tags and context.driver_wrapper.is_ios_test():
        scenario.skip('Android scenario')
        return
    elif 'ios_only' in scenario.tags and context.driver_wrapper.is_android_test():
        scenario.skip('iOS scenario')
        return

    # Read @no_driver tag
    no_driver = 'no_driver' in scenario.tags or 'no_driver' in scenario.feature.tags

    bdd_common_before_scenario(context, scenario, no_driver)

    # Behave dynamic environment
    context.dyn_env.execute_before_scenario_steps(context)
292599
function isSupportHistoryAPIDetect(){
    var ua = global.navigator.userAgent;
    // We only want Android 2 and 4.0, stock browser, and not Chrome which identifies
    // itself as 'Mobile Safari' as well, nor Windows Phone (issue #1471).
    if ((ua.indexOf('Android 2.') !== -1 ||
      (ua.indexOf('Android 4.0') !== -1)) &&
      ua.indexOf('Mobile Safari') !== -1 &&
      ua.indexOf('Chrome') === -1 &&
      ua.indexOf('Windows Phone') === -1)
    {
      return false;
    }
    // Return the regular check
    return !!historyPushState;
  }
242418
def main(argv=sys.argv, stream=sys.stderr):
    """"""
    args = parse_args(argv)
    suite = build_suite(args)
    runner = unittest.TextTestRunner(verbosity=args.verbose, stream=stream)
    result = runner.run(suite)

    return get_status(result)
69088
def run_app(self):
        """"""
        # Update system arguments
        sys.argv[0] = sys.executable
        sys.argv[1] = '{}.py'.format(sys.argv[1])

        # Make sure to exit with the return value from the subprocess call
        self._app_process = subprocess.Popen(sys.argv)
        return self._app_process.wait()
127407
def hasApplication(self, app):
        
        if self._applications is None:
            self._initApplicationList()
        return app in self._applications
447711
def setup_signal_handler(ios_pid = nil, android_pid = nil)
      Signal.trap('INT') do
        Process.kill('INT', ios_pid) unless ios_pid.nil?
        Process.kill('INT', android_pid) unless android_pid.nil?

        # Kill any existing Appium and Selenium processes
        kill_process 'appium'
        kill_process 'selenium'

        # Terminate ourself
        exit 1
      end
    end
17538
def is_webdriver_mobile(webdriver):
        
        browser = webdriver.capabilities['browserName']

        if (browser == u('iPhone') or 
            browser == u('android')):
            return True
        else:
            return False
209959
def is_existing_up_to_date(destination, latest_version):
    """"""
    version_path = os.path.join(
        destination, 'google_appengine', 'VERSION')

    if not os.path.exists(version_path):
        return False

    with open(version_path, 'r') as f:
        version_line = f.readline()

        match = SDK_RELEASE_RE.match(version_line)

        if not match:
            print('Unable to parse version from:', version_line)
            return False

        version = [int(x) for x in match.groups()]

    return version >= latest_version
1757
def system(session):
    """"""

    # Sanity check: Only run system tests if the environment variable is set.
    if not os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', ''):
        session.skip('Credentials must be set via environment variable.')

    # Install all test dependencies, then install this package into the
    # virtualenv's dist-packages.
    session.install('pytest')
    session.install('-e', os.path.join('..', 'test_utils'))
    for local_dep in LOCAL_DEPS:
        session.install('-e', local_dep)
    session.install('-e', '.[pandas,fastavro]')

    # Run py.test against the system tests.
    session.run('py.test', '--quiet', 'tests/system/')
606001
def check_dependencies(specs)
      missing = check_app_requirement(specs)

      present = exclude_specs(installed, specs)
      future = present + specs

      check_all_dependencies(specs, future, missing)
    end
36674
def restart_app(app_id, is_finished=False):
    
    state = constant.STATE_APP_RUNNING if is_finished else constant.STATE_APP_RESTARTING
    app_update_state(app_id, state)
52870
def check(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('app:check', **{
        'node': ctx.repo.create_secure_service('node'),
        'name': name,
    })