def install_app(logger, appname, version, apptype, apppath, all_perms, extrafiles, launch=False): logger.debug('uninstalling: %s' % appname) fxos_appgen.uninstall_app(appname) logger.debug('packaging: %s version: %s apptype: %s all_perms: %s' % (appname, version, apptype, all_perms)) details = fxos_appgen.create_details(version, all_perms=all_perms) manifest = json.dumps( fxos_appgen.create_manifest(appname, details, apptype, version)) files = extrafiles.copy() files['manifest.webapp'] = manifest package_app(apppath, files) logger.debug('installing: %s' % appname) fxos_appgen.install_app(appname, 'app.zip', script_timeout=120000) if launch: logger.debug('launching: %s' % appname) fxos_appgen.launch_app(appname)
def install_cert_app(self): """Install the container app used to run the tests""" if fxos_appgen.is_installed("CertTest App"): self.executor.logger.info("CertTest App is already installed") return self.executor.logger.info("Installing CertTest App") app_path = os.path.join(here, "b2g_setup", "certtest_app.zip") fxos_appgen.install_app("CertTest App", app_path, marionette=self.marionette) self.executor.logger.debug("Install complete")
def install_app(logger, appname, version, apptype, apppath, all_perms, extrafiles, launch=False): logger.debug('uninstalling: %s' % appname) fxos_appgen.uninstall_app(appname) logger.debug('packaging: %s version: %s apptype: %s all_perms: %s' % (appname, version, apptype, all_perms)) details = fxos_appgen.create_details(version, all_perms=all_perms) manifest = json.dumps(fxos_appgen.create_manifest(appname, details, apptype, version)) files = extrafiles.copy() files['manifest.webapp'] = manifest package_app(apppath, files) logger.debug('installing: %s' % appname) fxos_appgen.install_app(appname, 'app.zip', script_timeout=30000) if launch: logger.debug('launching: %s' % appname) fxos_appgen.launch_app(appname)
print "Installing the hosted app. This will take a minute... " appname = 'WebAPI Verifier' details = fxos_appgen.create_details(args.version, all_perms=True) manifest = json.dumps(fxos_appgen.create_manifest(appname, details, 'web', args.version)) apppath = os.path.join(static_path, 'webapi-test-app') package_app(apppath, {'results_uri.js': 'RESULTS_URI="http://%s:%s/webapi_results";' % addr, 'manifest.webapp': manifest}) # if we have recently rebooted, we might get here before marionette # is running. retries = 0 while retries < 3: try: fxos_appgen.install_app(appname, 'app.zip', script_timeout=30000) break except marionette.errors.InvalidResponseException: time.sleep(5) retries += 1 continue fxos_appgen.launch_app(appname) print "Done. Running the app..." Wait(timeout=600).until(lambda: webapi_results is not None) report["headers"] = headers fxos_appgen.uninstall_app(appname) test_user_agent(headers['user-agent'], logger)