aurum: update sample script 16/289316/3
authorHosang Kim <hosang12.kim@samsung.com>
Mon, 6 Mar 2023 08:11:11 +0000 (17:11 +0900)
committerkim hosang <hosang12.kim@samsung.com>
Fri, 17 Mar 2023 04:43:47 +0000 (04:43 +0000)
Change-Id: I56e18cd202e71c28a3f718caf5f149e9b89ab669

protocol/resources/python/tv/multiView.py
protocol/resources/python/tv/searchAll.py

index b404739..983dba4 100644 (file)
@@ -8,52 +8,43 @@ import logging
 import grpc
 import time
 
-# Second view size change and check
 # Please refer key codes below page
 # https://code.sec.samsung.net/confluence/display/GFX/VD+Key+Code+Table
-def MultiViewSizeTest(stub):
-    response = stub.findElements(ReqFindElements(textField='VSComponent2'))
-    if len(response.elements) <= 0: return False
+def MultiViewSelectContentTest(stub):
+    response = stub.findElement(ReqFindElements(textField='VSComponent2'))
+    if response.element is None: return False
 
-    responseGuide = stub.findElements(ReqFindElements(textField='Guide TextBox'))
-    if len(response.elements) <= 0:
-        stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
-
-    stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Right'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Up'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
     # Wait until render finished
-    time.sleep(1)
+    time.sleep(3)
 
     responseAfter = stub.findElement(ReqFindElement(textField='VSComponent2'))
     if responseAfter.element is None: return False
 
-    if response.element.geometry.width < responseAfter.element.geometry.width:
+    if response.element.geometry.height < responseAfter.element.geometry.height:
         return True
 
     return False
 
-# Launch 3rd-party app and long press back key test
-def MultiViewContentsTest(stub):
+def MultiViewChangeContentTest(stub):
+    stub.sendKey(ReqKey(type='XF86', actionType='LONG_STROKE', XF86keyCode='XF86Back'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Left'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Up'))
     stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='Return'))
     # Wait until render finished
-    time.sleep(10)
+    time.sleep(5)
 
     # It fails if there is a View
-    response= stub.findElements(ReqFindElements(textField='VSComponent2'))
-    if len(response.elements) > 0: return False
-
-    stub.sendKey(ReqKey(type='XF86', actionType='LONG_STROKE', XF86keyCode='XF86Back'))
+    response= stub.findElement(ReqFindElements(textField='VSComponent2'))
+    if response.element is None: return False
 
     return True
 
 # Launch application. it returns application running state
 def launchAppTest(stub):
     stub.launchApp(ReqLaunchApp(packageName='com.samsung.tv.multiscreen'))
-    time.sleep(5)
     return stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.tv.multiscreen')).isRunning
 
 # Close application. it returns application running state
@@ -73,8 +64,12 @@ def run():
     with grpc.insecure_channel('127.0.0.1:50051') as channel:
         stub = BootstrapStub(channel)
         runTest(stub, launchAppTest)
-        runTest(stub, MultiViewSizeTest)
-        runTest(stub, MultiViewContentsTest)
+        # Select Internet View
+        runTest(stub, MultiViewSelectContentTest)
+        # Change Internet View to Youtube View
+        runTest(stub, MultiViewChangeContentTest)
+        # Change Youtube View to Internet View
+        runTest(stub, MultiViewChangeContentTest)
         runTest(stub, closeAppTest)
 
 if __name__ == '__main__':
index a03d2b2..7b62fdc 100644 (file)
@@ -13,25 +13,28 @@ def SearchTestWithText(stub):
     response = stub.findElement(ReqFindElement(widgetType='TextField'))
     if response.element is None: return False
     targetObj = response.element.elementId
+    response = stub.setFocus(ReqSetFocus(elementId=targetObj))
+    if response.status is False: return False
     testString = 'Movie'
-    stub.setValue(ReqSetValue(elementId=targetObj, stringValue=testString))
+    response = stub.setValue(ReqSetValue(elementId=targetObj, stringValue=testString))
+    if response.status is False: return False
 
     # Wait until result upload
     time.sleep(2)
 
     return True
 
-# Find Foused item and move focus to right then compare focused item with previous one
+# Find Foused item and move focus to down then compare focused item with previous one
 def SearchFocusedObject(stub):
     response = stub.findElement(ReqFindElement(isFocused=True))
-    if response.elements is None: return False
+    if response.element is None: return False
 
     prevObj = response.element.elementId
-    stub.sendKey(ReqKey(type='XF86', actionType='LONG_STROKE', XF86keyCode='Right'))
+    stub.sendKey(ReqKey(type='XF86', actionType='LONG_STROKE', XF86keyCode='Down'))
     time.sleep(1)
 
     response = stub.findElement(ReqFindElement(isFocused=True))
-    if response.elements is None: return False
+    if response.element is None: return False
 
     if prevObj != response.element.elementId:
         return True
@@ -41,15 +44,12 @@ def SearchFocusedObject(stub):
 
 # Launch application. it returns application running state
 def launchAppTest(stub):
-    stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='XF86Search'))
-    # Wait until app launch
-    time.sleep(5)
+    stub.launchApp(ReqLaunchApp(packageName="com.samsung.tv.searchall"))
     return stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.tv.searchall')).isRunning
 
 # Close application. it returns application running state
 def closeAppTest(stub):
-    stub.sendKey(ReqKey(type='XF86', actionType='STROKE', XF86keyCode='XF86Exit'))
-    time.sleep(2)
+    stub.closeApp(ReqCloseApp(packageName='com.samsung.tv.searchall'))
     return stub.getAppInfo(ReqGetAppInfo(packageName='com.samsung.tv.searchall')).isRunning != True
 
 def runTest(stub, testFunc):