this patch introduces a python script that is testing whole aurum features.
Though some tests are crappy due to a kind of lack of feature for now,
it will be supported by libaurum later.
Change-Id: Icb7ebfa5887f53c70735dd3a739a04c364e11e1f
--- /dev/null
+from __future__ import print_function
+import aurum_pb2
+import aurum_pb2_grpc
+import logging
+import grpc
+import time
+
+def back(stub):
+ rsp_key = stub.sendKey(aurum_pb2.ReqKey(
+ type='BACK',
+ actionType='STROKE',
+ )
+ )
+
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField='TestMemo'
+ )
+ )
+
+ for item in rsp_find.elements:
+ print(item)
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=item.elementId
+ )
+ )
+
+def findNclick(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+
+ for item in rsp_find.elements:
+ print(item)
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=item.elementId
+ )
+ )
+
+def flick(stub):
+ rsp_flick = stub.flick(aurum_pb2.ReqFlick(
+ startPoint=aurum_pb2.Point(x=100, y=100),
+ endPoint=aurum_pb2.Point(x=400, y=400),
+ durationMs=1
+ ))
+
+def launchApp(stub):
+ rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
+ packageName='org.example.uicomponents'
+ ))
+
+def closeApp(stub):
+ rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
+ packageName='org.example.uicomponents'
+ ))
+
+CHUNK_SIZE = 1024 * 1024
+def get_file_chunks(filename):
+ with open(filename, 'rb') as f:
+ while True:
+ piece = f.read(CHUNK_SIZE)
+ if len(piece) == 0:
+ return
+ yield aurum_pb2.ReqInstallApp(package=piece)
+
+def installApp(stub):
+ in_file_name = './org.tizen.uicomponents.arm.tpk'
+ chunks_generator = get_file_chunks(in_file_name)
+ rsp_install = stub.installApp(chunks_generator)
+
+def removeApp(stub):
+ rsp_install = stub.removeApp(aurum_pb2.ReqRemoveApp(
+ packageName='org.example.uicomponents'
+ )
+ )
+
+def getAppInfo(stub):
+ rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName='org.example.uicomponents'))
+ print(rsp_info)
+
+def touchdown(stub, xx, yy):
+ rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchmove(stub, xx, yy):
+ rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchup(stub, xx, yy):
+ rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def sync(stub):
+ rsp = stub.sync(aurum_pb2.ReqEmpty())
+ print(rsp)
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = aurum_pb2_grpc.BootstrapStub(channel)
+
+ findNclick(stub, 'Testmemo')
+ back(stub)
+ flick(stub)
+ installApp(stub)
+ time.sleep(1)
+ launchApp(stub)
+ time.sleep(1)
+ getAppInfo(stub)
+ time.sleep(1)
+ closeApp(stub)
+ time.sleep(1)
+# removeApp(stub)
+ flick(stub)
+ touchdown(stub, 300, 300)
+ touchmove(stub, 250, 250)
+ touchmove(stub, 200, 200)
+ touchmove(stub, 110, 110)
+ touchup(stub, 100, 100)
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()
--- /dev/null
+from __future__ import print_function
+import aurum_pb2
+import aurum_pb2_grpc
+import logging
+import grpc
+import time
+
+def sendKey(stub, key):
+ rsp_key = stub.sendKey(aurum_pb2.ReqKey(
+ type=key,
+ actionType='STROKE',
+ )
+ )
+ time.sleep(1)
+
+def launchApp(stub, pkgname):
+ rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
+ packageName=pkgname
+ ))
+
+def closeApp(stub, pkgname):
+ rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
+ packageName=pkgname
+ ))
+
+def getAppInfo(stub, pkgname):
+ rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
+ print(rsp_info)
+
+def touchdown(stub, xx, yy):
+ rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchmove(stub, xx, yy):
+ rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchup(stub, xx, yy):
+ rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def sync(stub):
+ rsp = stub.sync(aurum_pb2.ReqEmpty())
+ print(rsp)
+
+
+def new_memo(stub):
+ touchdown(stub, 630,1140)
+ time.sleep(0.1)
+ touchup(stub, 630,1140)
+ time.sleep(0.5)
+
+def findElementByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ for item in rsp_find.elements:
+ return item.elementId
+ return None
+
+def findElementsByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ return rsp_find.elements
+
+def clickById(stub, id):
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=id
+ )
+ )
+
+def getAttrById(stub, id, attr):
+ rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
+ print(rsp)
+
+def run_memo(stub):
+ foundId = findElementByText(stub, 'All apps')
+ time.sleep(1)
+ if foundId != None:
+ getAttrById(stub, foundId, 'VISIBLE')
+ getAttrById(stub, foundId, 'CLICKABLE')
+ getAttrById(stub, foundId, 'FOCUSED')
+ getAttrById(stub, foundId, 'ENABLED')
+ getAttrById(stub, foundId, 'CHECKED')
+ clickById(stub, foundId)
+ time.sleep(1)
+
+ foundId = findElementByText(stub, 'Memo')
+ time.sleep(1)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(2)
+
+def set_text(stub, text):
+ foundId = findElementByText(stub, 'Title')
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(1.2)
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundId,
+ stringValue=text))
+ foundIds = findElementsByText(stub, "Memo")
+ if len(foundIds) >= 2:
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundIds[1].elementId,
+ stringValue=text))
+ time.sleep(0.2)
+ foundId = findElementByText(stub, 'DONE')
+ if foundId != None:
+ clickById(stub, foundId)
+
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = aurum_pb2_grpc.BootstrapStub(channel)
+
+ getAppInfo(stub, 'org.tizen.memo')
+ time.sleep(1)
+ sendKey(stub, 'HOME')
+ time.sleep(1)
+ closeApp(stub, 'org.tizen.memo')
+ time.sleep(1)
+ getAppInfo(stub, 'org.tizen.memo')
+ time.sleep(1)
+ run_memo(stub)
+ time.sleep(1)
+ new_memo(stub)
+ time.sleep(1)
+ set_text(stub, 'hello')
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()
--- /dev/null
+from __future__ import print_function
+import aurum_pb2
+import aurum_pb2_grpc
+import logging
+import grpc
+import time
+
+def sendKey(stub, key):
+ rsp_key = stub.sendKey(aurum_pb2.ReqKey(
+ type=key,
+ actionType='STROKE',
+ )
+ )
+ time.sleep(1.5)
+
+def launchApp(stub, pkgname):
+ rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
+ packageName=pkgname
+ ))
+
+def closeApp(stub, pkgname):
+ rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
+ packageName=pkgname
+ ))
+
+def getAppInfo(stub, pkgname):
+ rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
+ print(rsp_info)
+
+def touchdown(stub, xx, yy):
+ rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchmove(stub, xx, yy):
+ rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchup(stub, xx, yy):
+ rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def sync(stub):
+ rsp = stub.sync(aurum_pb2.ReqEmpty())
+ print(rsp)
+
+
+def new_memo(stub):
+ touchdown(stub, 630,1140)
+ time.sleep(0.1)
+ touchup(stub, 630,1140)
+ time.sleep(0.3)
+
+def findElementByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ for item in rsp_find.elements:
+ return item.elementId
+ return None
+
+def findElementsByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ els = []
+ for el in rsp_find.elements:
+ els.append(el.elementId)
+ return els
+
+def clickById(stub, id):
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=id
+ )
+ )
+
+def run_memo(stub):
+ foundId = findElementByText(stub, 'All apps')
+ time.sleep(1.5)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(1.5)
+
+ foundId = findElementByText(stub, 'Memo')
+ time.sleep(1.5)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(2.5)
+
+def set_text(stub, text):
+ foundIds = findElementsByText(stub, "Memo")
+ foundIds += (findElementsByText(stub, "Title"))
+ print(foundIds)
+ for el in foundIds:
+ print(el)
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=el,
+ stringValue=text))
+
+ #foundId = findElementByText(stub, 'DONE')
+ #if foundId != None:
+ # clickById(stub, foundId)
+
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = aurum_pb2_grpc.BootstrapStub(channel)
+ set_text(stub, 'hello')
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()
--- /dev/null
+from __future__ import print_function
+import aurum_pb2
+import aurum_pb2_grpc
+import logging
+import grpc
+import time
+
+def sendKey(stub, key):
+ rsp_key = stub.sendKey(aurum_pb2.ReqKey(
+ type=key,
+ actionType='STROKE',
+ )
+ )
+ time.sleep(1)
+
+def launchApp(stub, pkgname):
+ rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
+ packageName=pkgname
+ ))
+
+def closeApp(stub, pkgname):
+ rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
+ packageName=pkgname
+ ))
+
+def getAppInfo(stub, pkgname):
+ rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
+ print(rsp_info)
+
+def touchdown(stub, xx, yy):
+ rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchmove(stub, xx, yy):
+ rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchup(stub, xx, yy):
+ rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def sync(stub):
+ rsp = stub.sync(aurum_pb2.ReqEmpty())
+ print(rsp)
+
+
+def new_memo(stub):
+ touchdown(stub, 630,1140)
+ time.sleep(0.1)
+ touchup(stub, 630,1140)
+ time.sleep(0.5)
+
+def findElementByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ for item in rsp_find.elements:
+ return item.elementId
+ return None
+
+def findElementsByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ strategy='TEXT',
+ textField=text
+ )
+ )
+ return rsp_find.elements
+
+def clickById(stub, id):
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=id
+ )
+ )
+
+def run_memo(stub):
+ foundId = findElementByText(stub, 'All apps')
+ time.sleep(1)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(1)
+
+ foundId = findElementByText(stub, 'Memo')
+ time.sleep(1)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(2)
+
+def set_text(stub, text):
+ foundId = findElementByText(stub, 'Title')
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(1.2)
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundId,
+ stringValue=text))
+ foundIds = findElementsByText(stub, "Memo")
+ if len(foundIds) >= 2:
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundIds[1].elementId,
+ stringValue=text))
+ time.sleep(0.2)
+ foundId = findElementByText(stub, 'DONE')
+ if foundId != None:
+ clickById(stub, foundId)
+
+def clear_text(stub, el):
+ print(stub.clear(aurum_pb2.ReqClear(elementId=el)))
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = aurum_pb2_grpc.BootstrapStub(channel)
+#sync(stub)
+
+ foundId = findElementByText(stub, 'Title')
+ print(foundId)
+ clear_text(stub, foundId)
+
+
+# foundId = findElementByText(stub, 'Photos')
+# print(foundId)
+# foundId = findElementByText(stub, 'Resume')
+# print(foundId)
+# if foundId != None:
+# clickById(stub, foundId)
+
+# time.sleep(1.35)
+
+# foundId = findElementByText(stub, 'STOP')
+# print(foundId)
+# if foundId != None:
+# clickById(stub, foundId)
+
+
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()
--- /dev/null
+from __future__ import print_function
+import aurum_pb2
+import aurum_pb2_grpc
+import logging
+import grpc
+import time
+
+def sendKey(stub, key):
+ rsp_key = stub.sendKey(aurum_pb2.ReqKey(
+ type=key,
+ actionType='STROKE',
+ )
+ )
+ time.sleep(1)
+
+def launchApp(stub, pkgname):
+ rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
+ packageName=pkgname
+ ))
+
+def closeApp(stub, pkgname):
+ rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
+ packageName=pkgname
+ ))
+
+def getAppInfo(stub, pkgname):
+ rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
+ print(rsp_info)
+
+def touchdown(stub, xx, yy):
+ rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchmove(stub, xx, yy):
+ rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def touchup(stub, xx, yy):
+ rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
+ print(rsp)
+
+def sync(stub):
+ rsp = stub.sync(aurum_pb2.ReqEmpty())
+ print(rsp)
+
+
+def new_memo(stub):
+ touchdown(stub, 630,1140)
+ time.sleep(0.1)
+ touchup(stub, 630,1140)
+ time.sleep(0.5)
+
+def findElementByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ textField=text, isEnabled=False
+ )
+ )
+ for item in rsp_find.elements:
+ return item.elementId
+ return None
+
+def findElementsByText(stub, text):
+ rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
+ textField=text
+ )
+ )
+ return rsp_find.elements
+
+def clickById(stub, id):
+ stub.click(aurum_pb2.ReqClick(
+ type='ELEMENTID',
+ elementId=id
+ )
+ )
+
+def getAttrById(stub, id, attr):
+ rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
+ print(rsp)
+
+def run_memo(stub):
+ foundId = findElementByText(stub, 'All apps')
+ time.sleep(1)
+ if foundId != None:
+ getAttrById(stub, foundId, 'VISIBLE')
+ getAttrById(stub, foundId, 'CLICKABLE')
+ getAttrById(stub, foundId, 'FOCUSED')
+ getAttrById(stub, foundId, 'ENABLED')
+ getAttrById(stub, foundId, 'CHECKED')
+ clickById(stub, foundId)
+ time.sleep(1)
+
+ foundId = findElementByText(stub, 'Memo')
+ time.sleep(1)
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(2)
+
+def set_text(stub, text):
+ foundId = findElementByText(stub, 'Title')
+ if foundId != None:
+ clickById(stub, foundId)
+ time.sleep(1.2)
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundId,
+ stringValue=text))
+ foundIds = findElementsByText(stub, "Memo")
+ if len(foundIds) >= 2:
+ stub.setValue(aurum_pb2.ReqSetValue(
+ elementId=foundIds[1].elementId,
+ stringValue=text))
+ time.sleep(0.2)
+ foundId = findElementByText(stub, 'DONE')
+ if foundId != None:
+ clickById(stub, foundId)
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = aurum_pb2_grpc.BootstrapStub(channel)
+
+ appid='org.tizen.elm-demo-tizen-mobile'
+ getAppInfo(stub, appid)
+ sendKey(stub, 'HOME')
+ closeApp(stub, appid)
+ getAppInfo(stub, appid)
+ launchApp(stub, appid)
+ foundId = findElementByText(stub, "Radio")
+ print('--------' + foundId)
+ getAttrById(stub, foundId, 'VISIBLE')
+ getAttrById(stub, foundId, 'CLICKABLE')
+ getAttrById(stub, foundId, 'FOCUSED')
+ getAttrById(stub, foundId, 'ENABLED')
+ getAttrById(stub, foundId, 'CHECKED')
+ getAttrById(stub, foundId, 'SHOWING')
+
+ foundId = findElementByText(stub, "Button")
+ print('--------')
+ getAttrById(stub, foundId, 'VISIBLE')
+ getAttrById(stub, foundId, 'CLICKABLE')
+ getAttrById(stub, foundId, 'FOCUSED')
+ getAttrById(stub, foundId, 'ENABLED')
+ getAttrById(stub, foundId, 'CHECKED')
+ getAttrById(stub, foundId, 'SHOWING')
+
+ print(foundId)
+ clickById(stub, foundId)
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()
+++ /dev/null
-from __future__ import print_function
-import aurum_pb2
-import aurum_pb2_grpc
-import logging
-import grpc
-import time
-
-def back(stub):
- rsp_key = stub.sendKey(aurum_pb2.ReqKey(
- type='BACK',
- actionType='STROKE',
- )
- )
-
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField='TestMemo'
- )
- )
-
- for item in rsp_find.elements:
- print(item)
- stub.click(aurum_pb2.ReqClick(
- type='ELEMENTID',
- elementId=item.elementId
- )
- )
-
-def findNclick(stub, text):
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField=text
- )
- )
-
- for item in rsp_find.elements:
- print(item)
- stub.click(aurum_pb2.ReqClick(
- type='ELEMENTID',
- elementId=item.elementId
- )
- )
-
-def flick(stub):
- rsp_flick = stub.flick(aurum_pb2.ReqFlick(
- startPoint=aurum_pb2.Point(x=100, y=100),
- endPoint=aurum_pb2.Point(x=400, y=400),
- durationMs=1
- ))
-
-def launchApp(stub):
- rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
- packageName='org.example.uicomponents'
- ))
-
-def closeApp(stub):
- rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
- packageName='org.example.uicomponents'
- ))
-
-CHUNK_SIZE = 1024 * 1024
-def get_file_chunks(filename):
- with open(filename, 'rb') as f:
- while True:
- piece = f.read(CHUNK_SIZE)
- if len(piece) == 0:
- return
- yield aurum_pb2.ReqInstallApp(package=piece)
-
-def installApp(stub):
- in_file_name = './org.tizen.uicomponents.arm.tpk'
- chunks_generator = get_file_chunks(in_file_name)
- rsp_install = stub.installApp(chunks_generator)
-
-def removeApp(stub):
- rsp_install = stub.removeApp(aurum_pb2.ReqRemoveApp(
- packageName='org.example.uicomponents'
- )
- )
-
-def getAppInfo(stub):
- rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName='org.example.uicomponents'))
- print(rsp_info)
-
-def touchdown(stub, xx, yy):
- rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchmove(stub, xx, yy):
- rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchup(stub, xx, yy):
- rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def sync(stub):
- rsp = stub.sync(aurum_pb2.ReqEmpty())
- print(rsp)
-
-def run():
- with grpc.insecure_channel('127.0.0.1:50051') as channel:
- stub = aurum_pb2_grpc.BootstrapStub(channel)
-
- findNclick(stub, 'Testmemo')
- back(stub)
- flick(stub)
- installApp(stub)
- time.sleep(1)
- launchApp(stub)
- time.sleep(1)
- getAppInfo(stub)
- time.sleep(1)
- closeApp(stub)
- time.sleep(1)
-# removeApp(stub)
- flick(stub)
- touchdown(stub, 300, 300)
- touchmove(stub, 250, 250)
- touchmove(stub, 200, 200)
- touchmove(stub, 110, 110)
- touchup(stub, 100, 100)
-
-if __name__ == '__main__':
- logging.basicConfig()
- run()
+++ /dev/null
-from __future__ import print_function
-import aurum_pb2
-import aurum_pb2_grpc
-import logging
-import grpc
-import time
-
-def sendKey(stub, key):
- rsp_key = stub.sendKey(aurum_pb2.ReqKey(
- type=key,
- actionType='STROKE',
- )
- )
- time.sleep(1)
-
-def launchApp(stub, pkgname):
- rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
- packageName=pkgname
- ))
-
-def closeApp(stub, pkgname):
- rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
- packageName=pkgname
- ))
-
-def getAppInfo(stub, pkgname):
- rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
- print(rsp_info)
-
-def touchdown(stub, xx, yy):
- rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchmove(stub, xx, yy):
- rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchup(stub, xx, yy):
- rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def sync(stub):
- rsp = stub.sync(aurum_pb2.ReqEmpty())
- print(rsp)
-
-
-def new_memo(stub):
- touchdown(stub, 630,1140)
- time.sleep(0.1)
- touchup(stub, 630,1140)
- time.sleep(0.5)
-
-def findElementByText(stub, text):
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField=text
- )
- )
- for item in rsp_find.elements:
- return item.elementId
- return None
-
-def findElementsByText(stub, text):
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField=text
- )
- )
- return rsp_find.elements
-
-def clickById(stub, id):
- stub.click(aurum_pb2.ReqClick(
- type='ELEMENTID',
- elementId=id
- )
- )
-
-def getAttrById(stub, id, attr):
- rsp = stub.getAttribute(aurum_pb2.ReqGetAttribute(attribute=attr, elementId=id))
- print(rsp)
-
-def run_memo(stub):
- foundId = findElementByText(stub, 'All apps')
- time.sleep(1)
- if foundId != None:
- getAttrById(stub, foundId, 'VISIBLE')
- getAttrById(stub, foundId, 'CLICKABLE')
- getAttrById(stub, foundId, 'FOCUSED')
- getAttrById(stub, foundId, 'ENABLED')
- getAttrById(stub, foundId, 'CHECKED')
- clickById(stub, foundId)
- time.sleep(1)
-
- foundId = findElementByText(stub, 'Memo')
- time.sleep(1)
- if foundId != None:
- clickById(stub, foundId)
- time.sleep(2)
-
-def set_text(stub, text):
- foundId = findElementByText(stub, 'Title')
- if foundId != None:
- clickById(stub, foundId)
- time.sleep(1.2)
- stub.setValue(aurum_pb2.ReqSetValue(
- elementId=foundId,
- stringValue=text))
- foundIds = findElementsByText(stub, "Memo")
- if len(foundIds) >= 2:
- stub.setValue(aurum_pb2.ReqSetValue(
- elementId=foundIds[1].elementId,
- stringValue=text))
- time.sleep(0.2)
- foundId = findElementByText(stub, 'DONE')
- if foundId != None:
- clickById(stub, foundId)
-
-
-def run():
- with grpc.insecure_channel('127.0.0.1:50051') as channel:
- stub = aurum_pb2_grpc.BootstrapStub(channel)
-
- getAppInfo(stub, 'org.tizen.memo')
- time.sleep(1)
- sendKey(stub, 'HOME')
- time.sleep(1)
- closeApp(stub, 'org.tizen.memo')
- time.sleep(1)
- getAppInfo(stub, 'org.tizen.memo')
- time.sleep(1)
- run_memo(stub)
- time.sleep(1)
- new_memo(stub)
- time.sleep(1)
- set_text(stub, 'hello')
-
-if __name__ == '__main__':
- logging.basicConfig()
- run()
+++ /dev/null
-from __future__ import print_function
-import aurum_pb2
-import aurum_pb2_grpc
-import logging
-import grpc
-import time
-
-def sendKey(stub, key):
- rsp_key = stub.sendKey(aurum_pb2.ReqKey(
- type=key,
- actionType='STROKE',
- )
- )
- time.sleep(1.5)
-
-def launchApp(stub, pkgname):
- rsp_launch = stub.launchApp(aurum_pb2.ReqLaunchApp(
- packageName=pkgname
- ))
-
-def closeApp(stub, pkgname):
- rsp_launch = stub.closeApp(aurum_pb2.ReqCloseApp(
- packageName=pkgname
- ))
-
-def getAppInfo(stub, pkgname):
- rsp_info = stub.getAppInfo(aurum_pb2.ReqGetAppInfo(packageName=pkgname))
- print(rsp_info)
-
-def touchdown(stub, xx, yy):
- rsp = stub.touchDown(aurum_pb2.ReqTouchDown(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchmove(stub, xx, yy):
- rsp = stub.touchMove(aurum_pb2.ReqTouchMove(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def touchup(stub, xx, yy):
- rsp = stub.touchUp(aurum_pb2.ReqTouchUp(coordination=aurum_pb2.Point(x=xx,y=yy)))
- print(rsp)
-
-def sync(stub):
- rsp = stub.sync(aurum_pb2.ReqEmpty())
- print(rsp)
-
-
-def new_memo(stub):
- touchdown(stub, 630,1140)
- time.sleep(0.1)
- touchup(stub, 630,1140)
- time.sleep(0.3)
-
-def findElementByText(stub, text):
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField=text
- )
- )
- for item in rsp_find.elements:
- return item.elementId
- return None
-
-def findElementsByText(stub, text):
- rsp_find = stub.findElement(aurum_pb2.ReqFindElement(
- strategy='TEXT',
- textField=text
- )
- )
- els = []
- for el in rsp_find.elements:
- els.append(el.elementId)
- return els
-
-def clickById(stub, id):
- stub.click(aurum_pb2.ReqClick(
- type='ELEMENTID',
- elementId=id
- )
- )
-
-def run_memo(stub):
- foundId = findElementByText(stub, 'All apps')
- time.sleep(1.5)
- if foundId != None:
- clickById(stub, foundId)
- time.sleep(1.5)
-
- foundId = findElementByText(stub, 'Memo')
- time.sleep(1.5)
- if foundId != None:
- clickById(stub, foundId)
- time.sleep(2.5)
-
-def set_text(stub, text):
- foundIds = findElementsByText(stub, "Memo")
- foundIds += (findElementsByText(stub, "Title"))
- print(foundIds)
- for el in foundIds:
- print(el)
- stub.setValue(aurum_pb2.ReqSetValue(
- elementId=el,
- stringValue=text))
-
- #foundId = findElementByText(stub, 'DONE')
- #if foundId != None:
- # clickById(stub, foundId)
-
-
-def run():
- with grpc.insecure_channel('127.0.0.1:50051') as channel:
- stub = aurum_pb2_grpc.BootstrapStub(channel)
- set_text(stub, 'hello')
-
-if __name__ == '__main__':
- logging.basicConfig()
- run()
--- /dev/null
+from __future__ import print_function
+from aurum_pb2 import *
+from aurum_pb2_grpc import BootstrapStub
+import logging
+import grpc
+import time
+
+def findElementTest(stub):
+ response = stub.findElement(ReqFindElement(isClickable=True))
+ for el in response.elements:
+ return True
+ return False
+
+def getValueTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ print("els", response)
+ for el in response.elements:
+ response = stub.getValue(ReqGetValue(elementId=el.elementId))
+ return response.stringValue == 'Widgets'
+ return False
+
+def setValueClearTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ if len(response.elements) <= 0: return False
+ stub.click(ReqClick(type='ELEMENTID', elementId=response.elements[0].elementId))
+
+ def inScreen(size):
+ if size.x < 0: return False
+ if size.y < 0: return False
+ if size.x >= 360: return False
+ if size.y >= 360: return False
+ return True
+
+ for tryCnt in range(10):
+ stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=100))
+ response = stub.findElement(ReqFindElement(textField='Entry/Editfield, Entry/Text Input'))
+ if len(response.elements) <= 0: continue
+ targetObj = response.elements[0].elementId
+ response = stub.getSize(ReqGetSize(elementId=targetObj))
+ if inScreen(response.size):
+ stub.click(ReqClick(type='ELEMENTID', elementId=targetObj))
+ break
+
+ for tryCnt in range(10):
+ stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=100))
+ response = stub.findElement(ReqFindElement(textField='Editable'))
+ if len(response.elements) <= 0: continue
+ targetObj = response.elements[0].elementId
+ response = stub.getSize(ReqGetSize(elementId=targetObj))
+ if inScreen(response.size):
+ stub.click(ReqClick(type='ELEMENTID', elementId=targetObj))
+ break
+
+ response = stub.findElement(ReqFindElement(textField='editable'))
+ if len(response.elements) <= 0: return False
+ targetObj = response.elements[0].elementId
+
+ testString = 'set test string by calling SetValue Method'
+ stub.setValue(ReqSetValue(elementId=targetObj, stringValue=testString))
+ response = stub.getValue(ReqGetValue(elementId=targetObj))
+ if response.stringValue != testString:
+ return False
+
+ stub.clear(ReqClear(elementId=targetObj))
+
+ response = stub.getValue(ReqGetValue(elementId=targetObj))
+ if response.stringValue != 'editable':
+ return False
+
+ return True
+
+def getSizeTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ print("els", response)
+ for el in response.elements:
+ response = stub.getSize(ReqGetSize(elementId=el.elementId))
+ print(response)
+ return response.size.width + response.size.height > 0
+ return False
+
+def getAttributeTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ if len(response.elements) <= 0: return False
+
+ checkList = [
+ ['VISIBLE', True],
+ ['FOCUSABLE', True],
+ ['FOCUSED', False],
+ ['ENABLED', True],
+ ['CLICKABLE', True],
+ ['SCROLLABLE', False],
+ ['CHECKABLE', False],
+ ['CHECKED', False],
+ ['SELECTED', False],
+ ['SELECTABLE',True],
+ ['SHOWING', True],
+ ['ACTIVE', True],
+ ]
+ isFailed = False
+ for el in response.elements:
+ for attr in checkList:
+ if stub.getAttribute(ReqGetAttribute(elementId=el.elementId, attribute=attr[0])).boolValue != attr[1]:
+ isFailed = True
+
+ if isFailed == True: return False
+
+ response = stub.findElement(ReqFindElement(textField='Internal Legacy'))
+ if len(response.elements) <= 0: return False
+
+ checkList = [
+ ['VISIBLE', True],
+ ['FOCUSABLE', True],
+ ['FOCUSED', False],
+ ['ENABLED', True],
+ ['CLICKABLE', True],
+ ['SCROLLABLE', False],
+ ['CHECKABLE', False],
+ ['CHECKED', False],
+ ['SELECTED', False],
+ ['SELECTABLE', True],
+ ['SHOWING', False],
+ ['ACTIVE', False],
+ ]
+ isFailed = False
+ for el in response.elements:
+ for attr in checkList:
+ if stub.getAttribute(ReqGetAttribute(elementId=el.elementId, attribute=attr[0])).boolValue != attr[1]:
+ isFailed = True
+
+ return isFailed == False
+
+def clickTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ if len(response.elements) <= 0: return False
+
+ for el in response.elements:
+ stub.click(ReqClick(elementId=el.elementId, type='ELEMENTID'))
+
+ response = stub.findElement(ReqFindElement(textField='Box'))
+ if len(response.elements) <= 0: return False
+
+ for el in response.elements:
+ stub.click(ReqClick(coordination=Point(x=160, y=160), type='COORD'))
+
+ response = stub.findElement(ReqFindElement(textField='Vertical Box'))
+ if len(response.elements) <= 0: return False
+
+ return True
+
+def longClickTest(stub):
+ return False
+
+def flickTest(stub):
+ response = stub.findElement(ReqFindElement(textField='Widgets'))
+ if len(response.elements) <= 0:
+ return False
+
+ for el in response.elements:
+ print(el)
+ stub.click(ReqClick(elementId=el.elementId, type='ELEMENTID'))
+ break
+
+ response = stub.findElement(ReqFindElement(textField='Box', isShowing=True))
+ if len(response.elements) <= 0: return False
+ targetObj = response.elements[0].elementId
+
+ for tryCnt in range(10):
+ print('Flick to bottom to find "Spinner" item @ tries:', tryCnt)
+ stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=10))
+ response = stub.findElement(ReqFindElement(textField='Slider'))
+ time.sleep(0.5)
+ print(response)
+ if len(response.elements) > 0: return True
+
+ return False
+
+def touchTest(stub):
+ stub.touchDown(ReqTouchDown(coordination=Point(x=160,y=330)))
+ for yy in range(330, 30, -10):
+ stub.touchMove(ReqTouchMove(coordination=Point(x=160,y=yy)))
+ stub.touchUp(ReqTouchUp(coordination=Point(x=160,y=30)))
+
+ return True
+
+
+def get_file_chunks(filename):
+ CHUNK_SIZE = 1024 * 1024
+ with open(filename, 'rb') as f:
+ while True:
+ piece = f.read(CHUNK_SIZE)
+ if len(piece) == 0:
+ return
+ yield ReqInstallApp(package=piece)
+
+
+def installAppTest(stub):
+ response = stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents'))
+ if (response.isInstalled): return True
+
+ tpkFile = './org.tizen.uicomponents.arm.tpk'
+ binaryChunk = get_file_chunks(tpkFile)
+ response = stub.installApp(binaryChunk)
+
+ for waitCnt in range(10):
+ response = stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents'))
+ print('tries:', waitCnt, 'isInstalled:', response.isInstalled)
+ time.sleep(1)
+ if response.isInstalled: return True
+ return False
+
+def removeAppTest(stub):
+ response = stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents'))
+ if (response.isInstalled): response = stub.removeApp(ReqRemoveApp(packageName='org.example.uicomponents'))
+ for waitCnt in range(10):
+ response = stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents'))
+ print('tries:', waitCnt, 'isInstalled:', response.isInstalled)
+ time.sleep(1)
+ if response.isInstalled != True: return True
+ return False
+
+def getAppInfoTest(stub):
+ return stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents')).isRunning
+
+def launchAppTest(stub):
+ print('launch result', stub.launchApp(ReqLaunchApp(packageName='org.example.uicomponents')))
+
+ return stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents')).isRunning
+
+def closeAppTest(stub):
+ print('close result',stub.closeApp(ReqCloseApp(packageName='org.example.uicomponents')))
+ return stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents')).isRunning != True
+
+def sendKeyTest(stub):
+ response = stub.sendKey(ReqKey(type='HOME', actionType='STROKE'))
+ time.sleep(3)
+ response = stub.sendKey(ReqKey(type='BACK', actionType='STROKE'))
+ time.sleep(5)
+ return True
+
+def scrollToTest(stub):
+ print('scrollTo command not implemented')
+ return False
+
+def getDeviceTimeTest(stub):
+ print('getDeviceTime command not implemented')
+ return False
+
+def getLocationTest(stub):
+ print('getLocation command not implemented')
+ return False
+
+def defaultSetup(stub):
+ if stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.ui-widget-sample')).isRunning:
+ stub.closeApp(ReqCloseApp(packageName='com.samsung.ui-widget-sample'))
+
+ stub.launchApp(ReqLaunchApp(packageName='com.samsung.ui-widget-sample'))
+
+def defaultTearDown(stub):
+ stub.closeApp(ReqCloseApp(packageName='com.samsung.ui-widget-sample'))
+
+def runTest(stub, testFunc, setup=defaultSetup, tearDown=defaultTearDown, alwaySucceed=False):
+ print("Testing started :", testFunc)
+
+ setup(stub)
+ result = testFunc(stub)
+ tearDown(stub)
+
+ if alwaySucceed: return True
+ assert True == result
+
+def runTestWithoutSetupAndTearDown(stub, testFunc, setup=defaultSetup, tearDown=defaultTearDown):
+ def Empty(stub):
+ pass
+
+ runTest(stub, testFunc, Empty, Empty)
+
+
+def run():
+ with grpc.insecure_channel('127.0.0.1:50051') as channel:
+ stub = BootstrapStub(channel)
+
+ runTest(stub, findElementTest)
+ runTest(stub, getValueTest)
+ runTest(stub, getSizeTest)
+ runTest(stub, getAttributeTest)
+ runTest(stub, clickTest)
+ runTest(stub, flickTest)
+ runTest(stub, touchTest)
+ runTest(stub, sendKeyTest)
+ runTest(stub, setValueClearTest)
+
+ runTestWithoutSetupAndTearDown(stub, installAppTest)
+ runTestWithoutSetupAndTearDown(stub, launchAppTest)
+ runTestWithoutSetupAndTearDown(stub, getAppInfoTest)
+ runTestWithoutSetupAndTearDown(stub, closeAppTest)
+ runTestWithoutSetupAndTearDown(stub, removeAppTest)
+
+ runTest(stub, scrollToTest, alwaySucceed=True)
+ runTest(stub, longClickTest, alwaySucceed=True)
+ runTest(stub, getDeviceTimeTest, alwaySucceed=True)
+ runTest(stub, getLocationTest, alwaySucceed=True)
+
+if __name__ == '__main__':
+ logging.basicConfig()
+ run()