example/python: modify test scripts for reflecting recent changes
authorWonki Kim <wonki_.kim@samsung.com>
Thu, 4 Jun 2020 11:59:27 +0000 (20:59 +0900)
committerJongmin Lee <jm105.lee@samsung.com>
Sun, 7 Jun 2020 22:41:45 +0000 (07:41 +0900)
Change-Id: Ic240aafe580a152823489eb84cdc0cc3705555f1

protocol/examples/python/testFeatures.py
protocol/examples/python/testInternal.py

index 3b27fc9..05ec233 100644 (file)
@@ -32,7 +32,7 @@ def setValueClearTest(stub):
         return True
 
     for tryCnt in range(10):
-        stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=100))
+        stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=500))
         response = stub.findElement(ReqFindElement(textField='Entry/Editfield, Entry/Text Input'))
         if len(response.elements) <= 0: continue
         targetObj = response.elements[0].elementId
@@ -42,12 +42,13 @@ def setValueClearTest(stub):
             break
 
     for tryCnt in range(10):
-        stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=100))
+        stub.flick(ReqFlick(startPoint=Point(x=160, y=350), endPoint=Point(x=160, y=10), durationMs=500))
         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):
+        isShowing = stub.getAttribute(ReqGetAttribute(elementId=targetObj, attribute='SHOWING')).boolValue
+        if inScreen(response.size) or isShowing:
             stub.click(ReqClick(type='ELEMENTID', elementId=targetObj))
             break
 
@@ -234,10 +235,18 @@ def closeAppTest(stub):
     return stub.getAppInfo(ReqGetAppInfo(packageName='org.example.uicomponents')).isRunning != True
 
 def sendKeyTest(stub):
-    response = stub.sendKey(ReqKey(type='HOME', actionType='STROKE'))
+    response = stub.sendKey(ReqKey(type='POWER', actionType='STROKE'))
+    time.sleep(3)
+    response = stub.sendKey(ReqKey(type='POWER', actionType='STROKE'))
     time.sleep(3)
     response = stub.sendKey(ReqKey(type='BACK', actionType='STROKE'))
     time.sleep(5)
+    response = stub.sendKey(ReqKey(type='WHEELUP', actionType='STROKE'))
+    time.sleep(0.3)
+    response = stub.sendKey(ReqKey(type='WHEELUP', actionType='STROKE'))
+    time.sleep(0.3)
+    response = stub.sendKey(ReqKey(type='WHEELDOWN', actionType='STROKE'))
+    time.sleep(0.3)
     return True
 
 def scrollToTest(stub):
@@ -298,7 +307,6 @@ def run():
         runTest(stub, touchTest)
         runTest(stub, sendKeyTest)
         runTest(stub, setValueClearTest)
-
         runTestWithoutSetupAndTearDown(stub, installAppTest)
         runTestWithoutSetupAndTearDown(stub, launchAppTest)
         runTestWithoutSetupAndTearDown(stub, getAppInfoTest)
index c81c839..7e1a569 100644 (file)
@@ -3,15 +3,22 @@ from aurum_pb2 import *
 import aurum_pb2_grpc
 import logging
 import grpc
+import time
 
 def run():
     with grpc.insecure_channel('127.0.0.1:50051') as channel:
         stub = aurum_pb2_grpc.BootstrapStub(channel)
 
-        print(stub.getLocation(ReqGetLocation()).status)
-        print(stub.sync(ReqEmpty()))
-        print(stub.getDeviceTime(ReqGetDeviceTime(type='WALLCLOCK')))
-        # stub.killServer(aurum_pb2.ReqEmpty())
+#        print(stub.getLocation(ReqGetLocation()).status)
+#        print(stub.sync(ReqEmpty()))
+#        print(stub.getDeviceTime(ReqGetDeviceTime(type='WALLCLOCK')))
+#        print(stub.sendKey(ReqKey(type='WHEELUP')))
+#        time.sleep(0.1)
+#        print(stub.sendKey(ReqKey(type='WHEELDOWN')))
+#        time.sleep(0.1)
+#        print(stub.sendKey(ReqKey(type='HOME')))
+#        print(stub.sendKey(ReqKey(type='POWER')))
+#        stub.killServer(aurum_pb2.ReqEmpty())
 
 if __name__ == '__main__':
     logging.basicConfig()