Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(self, args=sys.argv[1:]):
args = self.parser.parse_args()
host, port = args.address.split(':')
self.marionette = Marionette(host=host, port=int(port))
self.marionette.start_session()
self.apps = gaiatest.GaiaApps(self.marionette)
self.data_layer = gaiatest.GaiaData(self.marionette)
self.device = gaiatest.GaiaDevice(self.marionette)
ret = args.func(args)
if ret is None:
ret = 0
self.marionette.delete_session()
sys.exit(ret)
def after_connect(self, executor):
self.executor = executor
self.marionette = executor.marionette
self.executor.logger.debug("Running browser.after_connect steps")
self.gaia_apps = gaiatest.GaiaApps(marionette=executor.marionette)
self.executor.logger.debug("Waiting for homescreen to load")
# Moved out of gaia_test temporarily
self.executor.logger.info("Waiting for B2G to be ready")
self.wait_for_homescreen(timeout=60)
self.install_cert_app()
self.use_cert_app()
def __init__(self, marionette):
self.marionette = marionette
self.apps = GaiaApps(self.marionette)
self.accessibility = Accessibility(self.marionette)
self.frame = None
self.entry_point = hasattr(self, 'entry_point') and self.entry_point or None
def install_apps():
mc = get_marionette(args)
device = GaiaDevice(mc)
try:
device.restart_b2g()
print 'Your device is rebooting.'
except Exception:
print ' ** Check to make sure you don\'t have desktop B2G running'
raise
apps = GaiaApps(mc)
apps.kill_all()
lockscreen = LockScreen(mc)
lockscreen.unlock()
if args.wifi_ssid:
print 'Configuring WiFi'
if not args.wifi_key or not args.wifi_pass:
args.error('Missing --wifi_key or --wifi_pass option')
args.wifi_key = args.wifi_key.upper()
data_layer = GaiaData(mc)
data_layer.enable_wifi()
if args.wifi_key == 'WPA-PSK':
pass_key = 'psk'
elif args.wifi_key == 'WEP':
def kill_all_apps(args):
mc = get_marionette(args)
apps = GaiaApps(mc)
apps.kill_all()
print 'Killed all apps'
'/mnt/extsdcard',
'/storage/sdcard',
'/storage/sdcard0',
'/storage/sdcard1']:
if self.device.file_manager.dir_exists(path):
for item in self.device.file_manager.list_items(path):
self.device.file_manager.remove('/'.join([path, item]))
self.logger.debug('Populating databases')
self.populate_databases()
if self.restart:
self.logger.debug('Starting B2G')
self.device.start_b2g(self.start_timeout)
self.apps = gaiatest.GaiaApps(self.marionette)
self.data_layer = gaiatest.GaiaData(self.marionette)
self.logger.debug('Populating files')
self.populate_files()
self.logger.debug('Settling for %d seconds' % self.settle_time)
time.sleep(self.settle_time)
self.marionette.switch_to_frame()
safe_volume = 5
self.logger.debug('Setting content volume to %d' % safe_volume)
self.data_layer.set_setting('audio.volume.content', safe_volume)
self.logger.debug('Switching off keyboard first time use screen')
self.data_layer.set_setting('keyboard.ftu.enabled', False)
print 'App successfully installed.'
# marketplace loading fragment locator
_loading_fragment_locator = ('css selector', 'div#splash-overlay')
_search_locator = ('id', 'search-q')
if not args.app and not args.manifest and not args.app_url:
args.error('Provide either app name (using --app), URL of app\'s '
'manifest file (using --manifest) or URL of the app '
'on marketpalce (using --app_url).')
mc = get_marionette(args)
lockscreen = LockScreen(mc)
lockscreen.unlock()
apps = GaiaApps(mc)
apps.kill_all()
no_internet_error = ('Unable to download app.\nReason: You are probably '
'not connected to internet on your device.')
if args.manifest:
mc.execute_script('navigator.mozApps.install("%s")' % args.manifest)
try:
confirm_installation()
except TimeoutException, exc:
print '** %s: %s' % (exc.__class__.__name__, exc)
args.error(no_internet_error)
return
if args.prod:
marketplace_app = 'Marketplace'
def do_login(args):
mc = get_marionette(args)
device = GaiaDevice(mc)
apps = GaiaApps(mc)
data_layer = GaiaData(mc)
_persona_frame_locator = ('css selector', "iframe")
# Trusty UI on home screen
_tui_container_locator = ('id', 'trustedui-frame-container')
# Persona dialog
_waiting_locator = ('css selector', 'body.waiting')
_email_input_locator = ('id', 'authentication_email')
_password_input_locator = ('id', 'authentication_password')
_new_password = ('id', 'password')
_verify_new_password = ('id', 'vpassword')
_next_button_locator = ('css selector', 'button.start')
_verify_start_button = ('css selector', 'button#verify_user')
_returning_button_locator = ('css selector', 'button.returning')