1 from __future__ import print_function
4 sys.path.append(os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
5 from aurum_pb2 import *
6 from aurum_pb2_grpc import BootstrapStub
11 # Second view size change and check
12 # Please refer key codes below page
13 # https://code.sec.samsung.net/confluence/display/GFX/VD+Key+Code+Table
14 def MultiViewSizeTest(stub):
15 response = stub.findElement(ReqFindElement(textField='VSComponent2'))
16 if len(response.elements) <= 0: return False
18 responseGuide = stub.findElement(ReqFindElement(textField='Guide TextBox'))
19 if len(response.elements) <= 0:
20 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
22 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Right'))
23 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Up'))
24 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
25 # Wait until render finished
28 responseAfter = stub.findElement(ReqFindElement(textField='VSComponent2'))
29 if len(responseAfter.elements) <= 0: return False
31 if response.elements[0].geometry.width < responseAfter.elements[0].geometry.width:
36 # Launch 3rd-party app and long press back key test
37 def MultiViewContentsTest(stub):
38 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
39 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Left'))
40 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Up'))
41 stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
42 # Wait until render finished
45 # It fails if there is a View
46 response= stub.findElement(ReqFindElement(textField='VSComponent2'))
47 if len(response.elements) > 0: return False
49 stub.sendKey(ReqKey(type='XF86', actionType='LONG_STROKE', XF86keyCode='XF86Back'))
53 # Launch application. it returns application running state
54 def launchAppTest(stub):
55 stub.launchApp(ReqLaunchApp(packageName='com.samsung.tv.multiscreen'))
57 return stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.tv.multiscreen')).isRunning
59 # Close application. it returns application running state
60 def closeAppTest(stub):
61 stub.closeApp(ReqCloseApp(packageName='com.samsung.tv.multiscreen'))
62 return stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.tv.multiscreen')).isRunning != True
64 def runTest(stub, testFunc):
65 print("Testing started :", testFunc)
67 result = testFunc(stub)
69 print("Testing result :", result)
73 with grpc.insecure_channel('127.0.0.1:50051') as channel:
74 stub = BootstrapStub(channel)
75 runTest(stub, launchAppTest)
76 runTest(stub, MultiViewSizeTest)
77 runTest(stub, MultiViewContentsTest)
78 runTest(stub, closeAppTest)
80 if __name__ == '__main__':