Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@step(u'Go Back')
def go_back(context):
context.app.child('This is a test').click()
@step(u'Click on search')
def click_on_search(context):
context.app.child('Find').click()
@step('Focus VM')
def focus_vm(context):
drawing_area = None
drawing_area = context.app.findChildren(lambda x: x.roleName == 'drawing area' and x.showing)
if drawing_area:
drawing_area[0].click()
@step('"{pattern}" is not visible with command "{command}"')
def check_pattern_not_visible(context, pattern, command):
sleep(0.2) # time for all to get set
out = check_output(command, shell=True)
assert out.find(pattern) == -1, 'pattern %s is visible with %s' % (pattern, command)
@step('Create new box from menu "{sys_name}"')
def create_new_vm_from_menu(context, sys_name):
context.app.child('New').click()
get_showing_node_name(sys_name, context.app).click()
@step(u'I add vcard "{path}" to my contact list')
def add_contact(context, path):
vcard_path = os.path.join(context.attachment_dir, path)
if context.browser.driver_name == 'ios':
subprocess.call([
'xcrun', 'simctl', 'addmedia',
context.browser.udid(), vcard_path
])
else:
name = context.persona['id']
emulator_id = get_android_emulator_id_from_name(name)
check_output([
'adb', "-s", emulator_id, 'push', vcard_path, '/sdcard/Download/'
])
vcard_name = path.split('/')[1]
check_output([
'adb', "-s", emulator_id, 'shell', 'am', 'start', '-t',
@step(u'the API authentication is wrong')
def api_auth_fail(context):
context.mock_api.test('authFails', 'longaccessauth')
@step(u'I select "{value}" from "{name}"')
@persona_vars
def i_select(context, value, name):
try:
context.browser.select(name, value)
except ElementDoesNotExist:
inp = context.browser.find_by_xpath("//input[@name='%s'][@value='%s']" % (name, value))
assert inp, u'Element not found'
inp.first.check()
@step(u'I remove the environment variable "{env_name}"')
def step_I_remove_the_environment_variable(context, env_name):
if not hasattr(context, "environ"):
context.environ = {}
context.environ[env_name] = ""
os.environ[env_name] = ""
del context.environ[env_name]
del os.environ[env_name]
@step('I set the inner HTML of the element with id "{id}" to "{contents}"')
@persona_vars
def set_html_content_to_element_with_id(context, id, contents):
assert context.browser.evaluate_script("document.getElementById('%s').innerHTML = '%s'" % (id, contents)), \
u'Element not found or could not set HTML content'