Commit 8ae40cb3 authored by Ru Cindrea's avatar Ru Cindrea

Merge branch '198-fix-python-appium-commands-after-refactoring' into 'master'

Resolve "Fix python appium commands after refactoring"

Closes #198

See merge request !117
parents 3fd1280f 6c6acb3f
......@@ -15,6 +15,7 @@ from altunityrunner.commands.ObjectCommands.pointer_up import PointerUp
class AltElement(object):
def __init__(self, alt_unity_driver, appium_driver, json_data):
self.alt_unity_driver = alt_unity_driver
self.appium_driver=None
if (appium_driver != None):
self.appium_driver = appium_driver
data = json.loads(json_data)
......@@ -63,7 +64,8 @@ class AltElement(object):
def click_Event(self):
alt_object = self.toJSON()
return ClickEvent(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= ClickEvent(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def mobile_tap(self, durationInSeconds=0.5):
self.appium_driver.tap([[float(self.x), float(self.mobileY)]], durationInSeconds * 1000)
......@@ -76,28 +78,35 @@ class AltElement(object):
def drag(self, x, y):
alt_object = self.toJSON()
return Drag(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,x,y,alt_object).execute()
data= Drag(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,x,y,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def drop(self, x, y):
alt_object = self.toJSON()
return Drop(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,x,y,alt_object).execute()
data= Drop(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,x,y,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def pointer_up(self):
alt_object = self.toJSON()
return PointerUp(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= PointerUp(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def pointer_down(self):
alt_object = self.toJSON()
return PointerDown(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= PointerDown(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def pointer_enter(self):
alt_object = self.toJSON()
return PointerEnter(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= PointerEnter(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def pointer_exit(self):
alt_object = self.toJSON()
return PointerExit(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= PointerExit(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
def tap(self):
alt_object=self.toJSON()
return Tap(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
data= Tap(self.alt_unity_driver.socket,self.alt_unity_driver.request_separator,self.alt_unity_driver.request_end,alt_object).execute()
return AltElement(self.alt_unity_driver,self.appium_driver,data)
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.by import By
class FindObject(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.by import By
class FindObjectWhichContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.by import By
class FindObjects(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.by import By
class FindObjectsWhichContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,by,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
from altunityrunner.commands.base_command import BaseCommand
class GetAllElements(BaseCommand):
def __init__(self, socket,request_separator,request_end,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.camera_name=camera_name
self.enabled=enabled
......
......@@ -2,8 +2,8 @@ from altunityrunner.commands.command_returning_alt_elements import CommandReturn
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForObject(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
......@@ -2,8 +2,8 @@ from altunityrunner.commands.command_returning_alt_elements import CommandReturn
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForObjectToNotBePresent(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
......@@ -2,8 +2,8 @@ from altunityrunner.commands.command_returning_alt_elements import CommandReturn
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForObjectWhichContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver, by,value,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.camera_name=camera_name
......
......@@ -2,8 +2,8 @@ from altunityrunner.commands.command_returning_alt_elements import CommandReturn
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForObjectWithText(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end, by,value,text,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver, by,value,text,camera_name, timeout, interval,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.by=by
self.value=value
self.text=text
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
class ClickAtCoordinates(CommandReturningAltElements):
class ClickAtCoordinates(BaseCommand):
def __init__(self, socket,request_separator,request_end, x, y):
super().__init__(socket,request_separator,request_end)
self.x=x
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.commands.InputActions.move_mouse import MoveMouse
import time
class MoveMouseAndWait(CommandReturningAltElements):
class MoveMouseAndWait(BaseCommand):
def __init__(self, socket,request_separator,request_end, x, y, duration):
super().__init__(socket,request_separator,request_end)
self.x=x
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
import time
class PressKey(CommandReturningAltElements):
class PressKey(BaseCommand):
def __init__(self, socket,request_separator,request_end, keyName,power,duration):
super().__init__(socket,request_separator,request_end)
self.keyName=keyName
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.commands.InputActions.press_key import PressKey
import time
class PressKeyAndWait(CommandReturningAltElements):
class PressKeyAndWait(BaseCommand):
def __init__(self, socket,request_separator,request_end, keyName,power,duration):
super().__init__(socket,request_separator,request_end)
self.keyName=keyName
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
import time
class ScrollMouse(CommandReturningAltElements):
class ScrollMouse(BaseCommand):
def __init__(self, socket,request_separator,request_end, speed, duration):
super().__init__(socket,request_separator,request_end)
self.speed=speed
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.commands.InputActions.scroll_mouse import ScrollMouse
import time
class ScrollMouseAndWait(CommandReturningAltElements):
class ScrollMouseAndWait(BaseCommand):
def __init__(self, socket,request_separator,request_end, speed, duration):
super().__init__(socket,request_separator,request_end)
self.speed=speed
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class Swipe(CommandReturningAltElements):
from altunityrunner.commands.base_command import BaseCommand
class Swipe(BaseCommand):
def __init__(self, socket,request_separator,request_end,x_start, y_start, x_end, y_end, duration_in_secs):
super().__init__(socket,request_separator,request_end)
self.x_start=x_start
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.commands.InputActions.swipe import Swipe
import time
class SwipeAndWait(CommandReturningAltElements):
class SwipeAndWait(BaseCommand):
def __init__(self, socket,request_separator,request_end,x_start, y_start, x_end, y_end, duration_in_secs):
super().__init__(socket,request_separator,request_end)
self.x_start=x_start
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class TapAtCoordinates(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,x,y):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,x,y):
super().__init__(socket,request_separator,request_end,appium_driver)
self.x=x
self.y=y
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
import time
class Tilt(CommandReturningAltElements):
class Tilt(BaseCommand):
def __init__(self, socket,request_separator,request_end,x, y, z):
super().__init__(socket,request_separator,request_end)
self.x=x
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElement(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.enabled=enabled
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElementByComponent(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,component_name,assembly_name,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,component_name,assembly_name,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.component_name=component_name
self.assembly_name=assembly_name
self.camera_name=camera_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElementWhereNameContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.enabled=enabled
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElements(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.enabled=enabled
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElementsByComponent(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,component_name,assembly_name,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,component_name,assembly_name,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.component_name=component_name
self.assembly_name=assembly_name
self.camera_name=camera_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class FindElementsWhereNameContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name,enabled):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.enabled=enabled
......
......@@ -3,8 +3,8 @@ from altunityrunner.commands.OldFindObjects.find_element import FindElement
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForElement(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.timeout=timeout
......@@ -16,7 +16,7 @@ class WaitForElement(CommandReturningAltElements):
alt_element = None
while (t <= self.timeout):
try:
alt_element = FindElement(self.socket,self.request_separator,self.request_end,self.value,self.camera_name,self.enabled).execute()
alt_element = FindElement(self.socket,self.request_separator,self.request_end,self.appium_driver,self.value,self.camera_name,self.enabled).execute()
break
except Exception:
print('Waiting for element ' + self.value + '...')
......
......@@ -3,8 +3,8 @@ from altunityrunner.commands.OldFindObjects.find_element import FindElement
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForElementToNotBePresent(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.timeout=timeout
......@@ -16,7 +16,7 @@ class WaitForElementToNotBePresent(CommandReturningAltElements):
while (t <= self.timeout):
try:
print('Waiting for element ' + self.value + ' to not be present...')
alt_element=FindElement(self.socket,self.request_separator,self.request_end,self.value,self.camera_name,self.enabled).execute()
alt_element=FindElement(self.socket,self.request_separator,self.request_end,self.appium_driver,self.value,self.camera_name,self.enabled).execute()
time.sleep(self.interval)
t += self.interval
except Exception:
......
......@@ -3,8 +3,8 @@ from altunityrunner.commands.OldFindObjects.find_element_where_name_contains imp
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForElementWhereNameContains(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.camera_name=camera_name
self.timeout=timeout
......@@ -16,7 +16,7 @@ class WaitForElementWhereNameContains(CommandReturningAltElements):
alt_element = None
while (t <= self.timeout):
try:
alt_element = FindElementWhereNameContains(self.socket,self.request_separator,self.request_end,self.value,self.camera_name,self.enabled).execute()
alt_element = FindElementWhereNameContains(self.socket,self.request_separator,self.request_end,self.appium_driver,self.value,self.camera_name,self.enabled).execute()
break
except Exception:
print('Waiting for element where name contains ' + self.value + '...')
......
......@@ -4,8 +4,8 @@ from altunityrunner.commands.ObjectCommands.get_text import GetText
from altunityrunner.altUnityExceptions import WaitTimeOutException
import time
class WaitForElementWithText(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end,value,text,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver,value,text,camera_name='', timeout=20, interval=0.5,enabled=True):
super().__init__(socket,request_separator,request_end,appium_driver)
self.value=value
self.text=text
self.camera_name=camera_name
......@@ -19,7 +19,7 @@ class WaitForElementWithText(CommandReturningAltElements):
object_text=""
while (t <= self.timeout):
try:
alt_element = FindElement(self.socket,self.request_separator,self.request_end,self.value,self.camera_name,self.enabled).execute()
alt_element = FindElement(self.socket,self.request_separator,self.request_end,self.appium_driver,self.value,self.camera_name,self.enabled).execute()
alt_object = alt_element.toJSON()
object_text=GetText(self.socket,self.request_separator,self.request_end,alt_object).execute()
if object_text == self.text:
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
class DeletePlayerPref(CommandReturningAltElements):
class DeletePlayerPref(BaseCommand):
def __init__(self, socket,request_separator,request_end):
super().__init__(socket,request_separator,request_end)
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
class DeletePlayerPrefKey(CommandReturningAltElements):
class DeletePlayerPrefKey(BaseCommand):
def __init__(self, socket,request_separator,request_end,key_name):
super().__init__(socket,request_separator,request_end)
self.key_name=key_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class GetCurrentScene(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver):
super().__init__(socket,request_separator,request_end,appium_driver)
def execute(self):
data = self.send_data(self.create_command('getCurrentScene'))
if (data != '' and 'error:' not in data):
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.player_pref_key_type import PlayerPrefKeyType
class GetPlayerPrefKey(CommandReturningAltElements):
class GetPlayerPrefKey(BaseCommand):
def __init__(self, socket,request_separator,request_end,key_name, key_type):
super().__init__(socket,request_separator,request_end)
self.key_name=key_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
class GetTimeScale(CommandReturningAltElements):
class GetTimeScale(BaseCommand):
def __init__(self, socket,request_separator,request_end):
super().__init__(socket,request_separator,request_end)
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
class LoadScene(CommandReturningAltElements):
from altunityrunner.commands.base_command import BaseCommand
class LoadScene(BaseCommand):
def __init__(self, socket,request_separator,request_end,scene_name):
super().__init__(socket,request_separator,request_end)
self.scene_name=scene_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
from altunityrunner.player_pref_key_type import PlayerPrefKeyType
class SetPlayerPrefKey(CommandReturningAltElements):
class SetPlayerPrefKey(BaseCommand):
def __init__(self, socket,request_separator,request_end,key_name, value, key_type):
super().__init__(socket,request_separator,request_end)
self.key_name=key_name
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.base_command import BaseCommand
class SetTimeScale(CommandReturningAltElements):
class SetTimeScale(BaseCommand):
def __init__(self, socket,request_separator,request_end,time_scale):
super().__init__(socket,request_separator,request_end)
self.time_scale=time_scale
......
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.commands.command_returning_alt_elements import CommandReturningAltElements
from altunityrunner.altUnityExceptions import *
from altunityrunner.commands.UnityCommands.get_current_scene import *
import time
class WaitForCurrentSceneToBe(CommandReturningAltElements):
def __init__(self, socket,request_separator,request_end, scene_name, timeout, interval):
super().__init__(socket,request_separator,request_end)
def __init__(self, socket,request_separator,request_end,appium_driver, scene_name, timeout, interval):
super().__init__(socket,request_separator,request_end,appium_driver)
self.scene_name=scene_name
self.timeout=timeout
self.interval=interval
......@@ -14,7 +14,7 @@ class WaitForCurrentSceneToBe(CommandReturningAltElements):
current_scene = ''
while (t <= self.timeout):
print('Waiting for scene to be ' + self.scene_name + '...')
current_scene = GetCurrentScene(self.socket,self.request_separator,self.request_end).execute()
current_scene = GetCurrentScene(self.socket,self.request_separator,self.request_end,self.appium_driver).execute()
if current_scene != self.scene_name:
time.sleep(self.interval)
t += self.interval
......
......@@ -3,10 +3,11 @@ from altunityrunner.commands.base_command import BaseCommand
import json
BUFFER_SIZE = 1024
class CommandReturningAltElements(BaseCommand):
def __init__(self, socket,request_separator=';',request_end='&'):
def __init__(self, socket,request_separator,request_end,appium_driver):
self.request_separator=request_separator
self.request_end=request_end
self.socket=socket
self.appium_driver=appium_driver
def get_alt_element(self, data):
print(data)
......
......@@ -17,6 +17,7 @@ class AltrunUnityDriver(object):
self.TCP_PORT = TCP_PORT
self.request_separator=request_separator
self.request_end=request_end
self.appium_driver=None
if (appium_driver != None):
self.appium_driver = appium_driver
if (platform != None):
......@@ -86,38 +87,38 @@ class AltrunUnityDriver(object):
return CallStaticMethods(self.socket,self.request_separator,self.request_end,type_name,method_name,parameters,type_of_parameters,assembly).execute()
def get_all_elements(self,camera_name='',enabled=True):
return GetAllElements(self.socket,self.request_separator,self.request_end,camera_name,enabled).execute()
return GetAllElements(self.socket,self.request_separator,self.request_end,self.appium_driver,camera_name,enabled).execute()
def find_object(self,by,value,camera_name='',enabled=True):
return FindObject(self.socket,self.request_separator,self.request_end,by,value,camera_name,enabled).execute()
return FindObject(self.socket,self.request_separator,self.request_end,self.appium_driver,by,value,camera_name,enabled).execute()
def find_object_which_contains(self,by,value,camera_name='',enabled=True):
return FindObjectWhichContains(self.socket,self.request_separator,self.request_end,by,value,camera_name,enabled).execute()
return FindObjectWhichContains(self.socket,self.request_separator,self.request_end,self.appium_driver,by,value,camera_name,enabled).execute()
def find_objects(self,by,value,camera_name='',enabled=True):
return FindObjects(self.socket,self.request_separator,self.request_end,by,value,camera_name,enabled).execute()
return FindObjects(self.socket,self.request_separator,self.request_end,self.appium_driver,by,value,camera_name,enabled).execute()
def find_objects_which_contains(self,by,value,camera_name='',enabled=True):
return FindObjectsWhichContains(self.socket,self.request_separator,self.request_end,by,value,camera_name,enabled).execute()
return FindObjectsWhichContains(self.socket,self.request_separator,self.request_end,self.appium_driver,by,value,camera_name,enabled).execute()
@deprecated(version='1.4.0',reason="Use find_object instead")
def find_element(self, name,camera_name='',enabled=True):
return FindElement(self.socket,self.request_separator,self.request_end,name,camera_name,enabled).execute()
return FindElement(self.socket,self.request_separator,self.request_end,self.appium_driver,name,camera_name,enabled).execute()
@deprecated(version='1.4.0',reason="Use find_object_which_contains instead")
def find_element_where_name_contains(self, name,camera_name='',enabled=True):