Created
February 10, 2017 00:40
-
-
Save kwangkook/31a07c2766258dd548c411a2e1ac021e to your computer and use it in GitHub Desktop.
Wear_MTBF_170207_RubyRunGenerated
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadTestDB | |
module Wear_MTBF_170207 | |
def self.APP_NAVI_GotoApp(loopTime) | |
tcase = TestCase.new("APP_NAVI_GotoApp") | |
tcase << TestAction.new(:wakeup) do | |
wakeUp | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:logStart) do | |
logStartTest("05_01_09_01_Menu_Navigation") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu_1) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_1) do | |
gotoApp('Alarm') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_1) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_1) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_2) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_2) do | |
gotoApp('Flashlight') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_2) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_2) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_3) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_3) do | |
gotoApp('Phone') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_3) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_3) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_4) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_4) do | |
gotoApp('Stopwatch') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_4) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_4) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_5) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_5) do | |
gotoApp('Agenda') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_5) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_5) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_6) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_6) do | |
gotoApp('Timer') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_6) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_6) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_7) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_7) do | |
gotoApp('Translate') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_7) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_7) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_8) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_8) do | |
gotoApp('Play Store') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_8) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_8) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_9) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_9) do | |
gotoApp('Fit') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_9) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_9) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_10) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_11) do | |
gotoApp('Contacts') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_11) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_11) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_12) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_12) do | |
gotoApp('Fit Workout') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_12) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_12) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_13) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_13) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second_13) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:goto_Home_13) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:logStop) do | |
#waitsecond(3) | |
logStopTest("05_01_09_01_Menu_Navigation") | |
#waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.Clean_Device(loopTime) | |
tcase = TestCase.new("Clean_Device") | |
tcase << TestAction.new(:clean_device) do | |
wakeUp | |
waitsecond(4) | |
PDGUiDevice.getInstance.execShellCmd("mkdir /sdcard/uiengine/log/meminfo") | |
PDGUiDevice.getInstance.execShellCmd("mkdir /sdcard/uiengine/log/top") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("top -n 1 > /sdcard/uiengine/log/top/#{getTimeStamp}_before_top.txt") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("cat /proc/meminfo > /sdcard/uiengine/log/meminfo/#{getTimeStamp}_before_meminfo.txt") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.lge.wearable.chargingmode") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.nfc") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am kill-all") | |
waitsecond(10) | |
PDGUiDevice.getInstance.execShellCmd("top -n 1 > /sdcard/uiengine/log/top/#{getTimeStamp}_after_top.txt") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("cat /proc/meminfo > /sdcard/uiengine/log/meminfo/#{getTimeStamp}_after_meminfo.txt") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.settings") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.wearable.app") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.clockwork.systemui") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.process.gapps") | |
waitsecond(5) | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.On_Off_NFC(loopTime) | |
tcase = TestCase.new("On_Off_NFC") | |
tcase << TestAction.new(:scriptAction_check_IncomingCall) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_11_01_NFC") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_1) do | |
$ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -434675318).with('textdescid', -1641296144).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 3) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'NFC') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_check_IncomingCall_2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home_1) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Settings) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Connectivity) do | |
gotoApp('Connectivity') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_1) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown) do | |
for i in 0..16 | |
if !uiObj("TextView").text("NFC").exists | |
swipe_vertical(173) | |
else | |
if !uiObj("Switch").resid("android:id/switch_widget").exists | |
uiObj("TextView").text("NFC").click | |
end | |
break | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_2) do | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_OnOff_NFC_Switch) do | |
if uiObj("TextView").text("NFC").exists | |
if uiObj("Switch").text("ON").exists | |
# uiObj("TextView").text("NFC").click | |
uiObj("Switch").text("ON").click | |
$msg = "Click NFC Menu for Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(10) | |
end | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("Switch").text("OFF").exists | |
# uiObj("TextView").text("NFC").click | |
uiObj("Switch").text("OFF").click | |
$msg = "Click NFC Menu for On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(10) | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("Switch").text("ON").exists | |
$msg = "Turn-On NFC Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
# uiObj("TextView").text("NFC").click | |
uiObj("Switch").text("ON").click | |
$msg = "Click NFC Menu for Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(10) | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("Switch").text("OFF").exists | |
$myTestResult = true | |
$msg = "Turn-Off NFC Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$myFailReason = "Cannot Turn-Off NFC::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot Turn-Off NFC" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$myFailReason = "Cannot Turn-On NFC::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot Turn-On NFC" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$myFailReason = "Cannot find NFC Off::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find NFC Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$myFailReason = "Cannot find NFC::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find NFC Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_11_01_NFC") | |
#waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home_2) do | |
if $curLoopNum == 19 | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.mainLoop(loopTime) | |
WebSocketXServer.setAutoUpdate(false) | |
index = $mainResumeMainLoop | |
$mainResumeMainLoop = 0 | |
writelog("mainLoop::#{index}::Resume") if index > 0 | |
while index < loopTime | |
$curMainLoopNum = index | |
$actionParamInput = "none" | |
make30sSleep 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
contactCall 50 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
recentCall 50 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
answerCall 100 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
make_Clipboard_Text_160 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
sendSMS 50 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
open_SMS 50 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
excutePlayStore 20 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
downloadAppByPlayStore 10 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
closePlayStore 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
openDownloadedApp 20 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
deleteDownloadedApp 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
setAlarm_GotoApp 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
remove_Alarm_GotoApp 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 0 | |
waitsecond(2) | |
$actionParamInput = "none" | |
playMusic_GoogleMusic 0 | |
waitsecond(2) | |
$actionParamInput = "none" | |
shuffleMusic_GoogleMusic 0 | |
waitsecond(2) | |
$actionParamInput = "none" | |
stopMusic 0 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
APP_NAVI_GotoApp 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
wifiTurnOnOff_GotoApp 20 | |
waitsecond(2) | |
$actionParamInput = "none" | |
wifiConnect_GotoApp 20 | |
waitsecond(2) | |
$actionParamInput = "none" | |
clean_Home 1 | |
waitsecond(2) | |
$actionParamInput = "none" | |
On_Off_NFC 20 | |
waitsecond(2) | |
$actionParamInput = "none" | |
Clean_Device 1 | |
waitsecond(2) | |
sendStatus("Done::mainLoop::Loop::#{index}") | |
writelog("Finish::Loop::#{$curMainLoopNum}") | |
saveLogFileToGist if $saveLogToGist | |
index += 1 | |
end | |
$engineStatus = "Idle" | |
resetStatus | |
sendStatus("Finish::mainLoop::END") | |
end | |
def self.answerCall(loopTime) | |
tcase = TestCase.new("answerCall") | |
tcase << TestAction.new(:Check_Watch_Face) do | |
wakeUp | |
waitsecond(1) | |
pressMenu | |
waitsecond(1) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists | |
$msg = "Watch Face Change Displaying...." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
pressHome | |
$msg = "pressHome >> Watch Face Escape " | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Check_Temperature_Start) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== RecentCall Start Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
$ruiObj = RUIObject.new.with('objectid', 664288872).with('selfid', 1322575484).with('textdescid', -1859474097).with('uniqueparentid', 0).with('classresourceid', 1059678339) | |
.with('uitreeindex', 3) | |
.with('classname', 'ImageButton') | |
.with('resource-id', 'android:id/button1') | |
.with('content-desc', 'Yes') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_01_05_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_sendBTCmd_makeCall) do | |
sendBTCmd("makeCall('#{db('CallNumber')[0]}')") | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_receiveCall_Wear) do | |
$res = false | |
for i in 0..25 | |
puts "i = #{i}" | |
wakeUp | |
if uiObj("TextView").text("Call options").exists or uiObj("FrameLayout").resid("com.google.android.apps.wearable.phone:id/call_fragment").exists or uiObj("EditText").resid("com.google.android.apps.wearable.phone:id/state_title").exists or uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/accept").exists | |
$UIDev.pressKeyCode(5) | |
waitsecond(3) | |
puts "Receive Call OK" | |
end | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
$res = true | |
puts "Receive Call Loop Break" | |
else | |
waitsecond(3) | |
end | |
if ($res) then | |
puts "loop break" | |
break | |
end | |
if (i == 25) | |
sendBTCmd("endCall") | |
$myFailReason = "Call signal is not reached.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_endCall_Wear) do | |
wakeUp | |
$res = uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
if !$res | |
if uiObj("TextView").text("Call in progress").exists | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
click(240,240) | |
if uiObj("TextView").text("Call from watch").exists | |
puts "Cancel call" | |
waitsecond(2) | |
gotoApp('Cancel call') | |
end | |
end | |
end | |
end | |
if $res | |
$UIDev.pressKeyCode(6) | |
puts "End Call OK" | |
elsif uiObj("TextView").text("Call options").exists | |
sendBTCmd("endCall") | |
waitsecond(2) | |
$UIDev.pressKeyCode(6) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
#waitsecond(2) | |
logStopTest("05_01_01_05_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:kill) do | |
wakeUp | |
waitsecond(1) | |
if uiObj("TextView").text("Call in progress").exists | |
waitsecond(2) | |
$msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth") | |
waitsecond(5) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_BTChatWear_Discover) do | |
if !($myTestResult) | |
$myTestResult = true | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
waitsecond(2) | |
$msg = "Run BTChatWear for turning on discover" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
waitsecond(2) | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
for i in 0..20 | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.android.server.telecom/.components.UserCallActivity -a android.intent.action.CALL -d tel:#{db('CallNumber')[1,1]}") | |
waitsecond(5) | |
wakeUp | |
waitsecond(2) | |
if uiObj("TextView").text("Call from watch").exists | |
uiObj("TextView").text("Call from watch").clickAndWaitForNewWindow | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Choose calling device").exists | |
uiObj("TextView").text("Call from watch").clickAndWaitForNewWindow | |
waitsecond(2) | |
end | |
waitsecond(5) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(2) | |
break | |
end | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Check_Temperature_End) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== AnswerCall End Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.clean_Home(loopTime) | |
tcase = TestCase.new("clean_Home") | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:clean_HomeScreen) do | |
wakeUp | |
for i in 0..5 | |
swipe_vertical(20) | |
waitsecond(2) | |
swipe_horizontal_back 10 | |
waitsecond(4) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:kill) do | |
wakeUp | |
waitsecond(1) | |
if uiObj("TextView").text("Call in progress").exists | |
waitsecond(2) | |
$msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth") | |
waitsecond(5) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/title").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.closePlayStore(loopTime) | |
tcase = TestCase.new("closePlayStore") | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_05_04_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Play Store') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Button_Button1_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_PlayStore) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_PlayStore) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "PlayStore Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_05_04_StoreFrontDownload") | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.contactCall(loopTime) | |
tcase = TestCase.new("contactCall") | |
tcase << TestAction.new(:Check_Temperature_Start) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== RecentCall Start Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
$ruiObj = RUIObject.new.with('objectid', 664288872).with('selfid', 1322575484).with('textdescid', -1859474097).with('uniqueparentid', 0).with('classresourceid', 1059678339) | |
.with('uitreeindex', 3) | |
.with('classname', 'ImageButton') | |
.with('resource-id', 'android:id/button1') | |
.with('content-desc', 'Yes') | |
$ruiObj.click | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_setUp) do | |
wakeUp | |
logStartTest("05_01_01_01_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu_1) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_1) do | |
gotoApp('Contacts') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:View_ContactDetailHeaderImage) do | |
$ruiObj = RUIObject.new.with('objectid', 1575762115).with('selfid', -738182854).with('textdescid', 1603985341).with('uniqueparentid', 0) | |
.with('uitreeindex', 5) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_detail_header_image') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_checkSearchBtn) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Back_By_Swipe) do | |
swipe_horizontal_back 10 | |
waitsecond(1) | |
swipe_horizontal_back 10 | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu_2) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_2) do | |
gotoApp('Contacts') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_checkSearchBtn) do | |
for i in 0..5 | |
if !uiObj("ImageButton").resid("com.google.android.wearable.app:id/contacts_search_button").exists | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
gotoApp("Contacts") | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
else | |
break | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageButton_ContactsSearchButton_1) do | |
$ruiObj = RUIObject.new.with('objectid', 954708298).with('selfid', -581006309).with('textdescid', 13239774).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'ImageButton') | |
.with('resource-id', 'com.google.android.wearable.app:id/contacts_search_button') | |
.with('content-desc', 'Search') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:View_ImeChoice_1) do | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:scriptAction_inputSearchName_1) do | |
a = ($curLoopNum+1) / 10 | |
b = ($curLoopNum+1) - (a * 10) | |
pressKeyCode(7 + a) | |
pressKeyCode(7 + b) | |
waitsecond(1) | |
click(338,73) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Searching_Complete_1) do | |
for i in 0..2 | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/contact_photo").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_ImeChoice_Object_Read_Error_1) do | |
$ruiObj = RUIObject.new.with('objectid', 226426021).with('selfid', 1645856786).with('textdescid', -1104342964).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_ContactPhoto_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Select_Object_Direct_1) do | |
click(120,300) # Select search result | |
waitsecond(2) | |
click(100,386) # Select phone icon | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Calling_1) do | |
for i in 0..4 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_Hangup_1) do | |
$ruiObj = RUIObject.new.with('objectid', 397607787).with('selfid', -655586695).with('textdescid', 2141000120).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/hangup') | |
.with('content-desc', 'End call') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_sendBTCmd_answerCall) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ContactPhoto_1) do | |
$ruiObj = RUIObject.new.with('objectid', 2018999196).with('selfid', 741655928).with('textdescid', -1835534332).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_photo') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_ContactPhoto_3) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageButton_ContactsSearchButton_2) do | |
$ruiObj = RUIObject.new.with('objectid', 954708298).with('selfid', -581006309).with('textdescid', 13239774).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'ImageButton') | |
.with('resource-id', 'com.google.android.wearable.app:id/contacts_search_button') | |
.with('content-desc', 'Search') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:View_ImeChoice_2) do | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:scriptAction_inputSearchName_2) do | |
a = 1 / 10 | |
b = 1 - (a * 10) | |
pressKeyCode(7 + a) | |
pressKeyCode(7 + b) | |
waitsecond(1) | |
click(338,73) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Searching_Complete_2) do | |
for i in 0..2 | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/contact_photo").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_ImeChoice_Object_Read_Error_2) do | |
$ruiObj = RUIObject.new.with('objectid', 226426021).with('selfid', 1645856786).with('textdescid', -1104342964).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_ContactPhoto_2) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Select_Object_Direct_2) do | |
click(120,300) # Select search result | |
waitsecond(2) | |
click(100,386) # Select phone icon | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Calling_2) do | |
for i in 0..4 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_Hangup_2) do | |
$ruiObj = RUIObject.new.with('objectid', 397607787).with('selfid', -655586695).with('textdescid', 2141000120).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/hangup') | |
.with('content-desc', 'End call') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_sendBTCmd_answerCall) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ContactPhoto_2) do | |
$ruiObj = RUIObject.new.with('objectid', 2018999196).with('selfid', 741655928).with('textdescid', -1835534332).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_photo') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_endCall_Wear) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ContactPhoto_3) do | |
$ruiObj = RUIObject.new.with('objectid', 2018999196).with('selfid', 741655928).with('textdescid', -1835534332).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_photo') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:View_ContactMethodIcon_1) do | |
$ruiObj = RUIObject.new.with('objectid', 1553099761).with('selfid', -542618136).with('textdescid', -1198512627).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_method_icon') | |
.with('content-desc', 'Call') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_endCall_Wear) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_ContactMethodIcon_2) do | |
$ruiObj = RUIObject.new.with('objectid', 1553099761).with('selfid', -542618136).with('textdescid', -1198512627).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/contact_method_icon') | |
.with('content-desc', 'Call') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Calling_3) do | |
for i in 0..4 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
if uiObj("android.view.View").resid("com.google.android.wearable.app:id/contact_method_icon").exists | |
uiObj("android.view.View").resid("com.google.android.wearable.app:id/contact_method_icon").click | |
for i in 0..4 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:View_Hangup_3) do | |
$ruiObj = RUIObject.new.with('objectid', 397607787).with('selfid', -655586695).with('textdescid', 2141000120).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/hangup') | |
.with('content-desc', 'End call') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_sendBTCmd_answerCall) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_Action_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1056937129).with('selfid', 1865264606).with('textdescid', 1594687401).with('uniqueparentid', 0) | |
.with('uitreeindex', 13) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/action') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_endCall_Wear) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_Action_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1056937129).with('selfid', 1865264606).with('textdescid', 1594687401).with('uniqueparentid', 0) | |
.with('uitreeindex', 13) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/action') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_sendBTCmd_answerCall) do | |
for i in 0..20 | |
waitsecond(2) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
sendBTCmd("answerCall") | |
waitsecond(3) | |
if uiObj("TextView").resid("com.google.android.apps.wearable.phone:id/elapsed_time").exists | |
#waitsecond(2) | |
$res = false | |
else | |
$res = true | |
end | |
elsif uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
if uiObj("TextView").resid("com.google.android.apps.wearable.phone:id/elapsed_time").exists | |
$res = false | |
else | |
$res = true | |
end | |
elsif uiObj("TextView").text("Call in progress").exists | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
click(240,240) | |
waitsecond(2) | |
if !uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists and uiObj("TextView").text("Call from watch").exists | |
puts "Call from watch" | |
gotoApp('watch') | |
waitsecond(2) | |
end | |
end | |
waitsecond(2) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
sendBTCmd("answerCall") | |
waitsecond(2) | |
$res = uiObj("TextView").text("dialing").exists | |
elsif not uiObj("TextView").text("dialing").exists | |
$res = true | |
else | |
$res = true | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
elsif (i == 20) | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
#else | |
# waitsecond(2) | |
end | |
if !$res | |
puts "Answer Call OK" | |
break | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_endCall_Wear) do | |
wakeUp | |
$res = uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
$res = uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
end | |
if !$res | |
puts "Not exist Hangup" | |
if uiObj("TextView").text("Call in progress").exists | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
click(240,240) | |
end | |
end | |
end | |
if $res | |
$UIDev.pressKeyCode(6) | |
puts "End Call OK" | |
else | |
$UIDev.pressKeyCode(6) | |
sendBTCmd("endCall") | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_logStop) do | |
#waitsecond(5) | |
logStopTest("05_01_01_01_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:kill) do | |
wakeUp | |
#waitsecond(1) | |
if uiObj("TextView").text("Call in progress").exists | |
waitsecond(2) | |
$msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth") | |
waitsecond(5) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_BTChatWear_Discover) do | |
if !($myTestResult) | |
$myTestResult = true | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
$msg = "Run BTChatWear for turning on discover" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Check_Temperature_End) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== RecentCall End Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.deleteDownloadedApp(loopTime) | |
tcase = TestCase.new("deleteDownloadedApp") | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_05_08_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Play Store') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Button_Button1_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_Check_PlayStore) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_PlayStore) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "PlayStore Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_SearchIcon_1) do | |
$ruiObj = RUIObject.new.with('objectid', 525749627).with('selfid', -136350747).with('textdescid', -881630715).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.android.vending:id/search_icon') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_SearchIcon_2) do | |
$ruiObj = RUIObject.new.with('objectid', 525749627).with('selfid', -136350747).with('textdescid', -881630715).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.android.vending:id/search_icon') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:View_ImeChoice) do | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:scriptAction_Input_AppName_Runkeeper) do | |
pressKeyCode(46) | |
pressKeyCode(49) | |
pressKeyCode(42) | |
pressKeyCode(39) | |
pressKeyCode(33) | |
pressKeyCode(33) | |
pressKeyCode(44) | |
pressKeyCode(33) | |
pressKeyCode(46) | |
waitsecond(1) | |
click(338,73) | |
waitsecond(8) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_2) do | |
$ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', 1005743735).with('textdescid', -997552165).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_LiTitle_Runkeeper_4) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Search) do | |
$myFailReason = "Can not search Application::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_3) do | |
$ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', 1005743735).with('textdescid', -997552165).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_4) do | |
$ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', 1005743735).with('textdescid', -997552165).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_search_InstallBtn_OpenBtn) do | |
for i in 0..6 | |
if uiObj("TextView").text("Install").exists or uiObj("TextView").text("Open").exists | |
break | |
else | |
drag(120, 100, 120, 400, 50) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Install_1) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Install') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_ButtonText_Uninstall_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Install_2) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Install') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_InstallComplete) do | |
$msg = "Start downloading application" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
for i in 0..99 | |
waitsecond(5) | |
wakeUp | |
if uiObj("TextView").text("Open").exists and !uiObj("TextView").text("Uninstall").exists | |
for i in 0..4 | |
if uiObj("TextView").text("Uninstall").exists | |
break | |
else | |
swipe_vertical(150) | |
end | |
end | |
end | |
if uiObj("TextView").text("Uninstall").exists | |
$myTestResult = true | |
$msg = "Complete downloading application" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
break | |
else | |
if i == 59 | |
$myFailReason = "Application install 10m time out::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Install 10m Time out" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
elsif uiObj("TextView").text("Continue").exists | |
uiObj("TextView").text("Continue").click | |
elsif uiObj("TextView").text("Accept").exists | |
uiObj("TextView").text("Accept").click | |
elsif uiObj("Button").text("YES").exists | |
uiObj("Button").text("YES").click # Download app over mobile network 3.4 MB? | |
end | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Downloading_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Downloading') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_ButtonText_Uninstall_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Downloading_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Downloading') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Uninstall_1) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Uninstall') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_ButtonText_Uninstall_3) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_UninstallApp_1) do | |
if uiObj("TextView").text("Open").exists and !uiObj("TextView").text("Uninstall").exists | |
for i in 0..4 | |
if uiObj("TextView").text("Uninstall").exists | |
break | |
else | |
swipe_vertical(150) | |
end | |
end | |
end | |
if !uiObj("TextView").text("Uninstall").exists | |
$myFailReason = "Can not Uninstall Application - 1::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Uninstall_2) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Uninstall') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Uninstall_3) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Uninstall') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait8second) do | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
$msg = "Uninstalling for download application" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(8) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Install_3) do | |
$ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Install') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_UninstallApp_2) do | |
$myFailReason = "Can not Uninstall Application - 2::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_05_08_StoreFrontDownload") | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Text_Successfully) do | |
$ruiObj = RUIObject.new.with('objectid', 1472509444).with('selfid', 1035549449).with('textdescid', 753694147).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/text') | |
.with('text', 'Successfully installed') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_End) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_removePopUp) do | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_End) do | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.downloadAppByPlayStore(loopTime) | |
tcase = TestCase.new("downloadAppByPlayStore") | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_05_03_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Uninstall) do | |
$ruiObj = RUIObject.new.with('objectid', -1438237125).with('selfid', -694121599).with('textdescid', -1452325213).with('uniqueparentid', 0) | |
.with('uitreeindex', 9) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Uninstall') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_Click_Install_Uninstall_Button) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Play Store') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Button_Button1_YesIM_IN_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_Check_PlayStore) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_YesIM_IN_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_PlayStore) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "PlayStore Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_SearchIcon_1) do | |
$ruiObj = RUIObject.new.with('objectid', 525749627).with('selfid', -136350747).with('textdescid', -881630715).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.android.vending:id/search_icon') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:ImageView_SearchIcon_2) do | |
$ruiObj = RUIObject.new.with('objectid', 525749627).with('selfid', -136350747).with('textdescid', -881630715).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.android.vending:id/search_icon') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:View_ImeChoice) do | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:scriptAction_Input_AppName_Runkeeper) do | |
pressKeyCode(46) | |
pressKeyCode(49) | |
pressKeyCode(42) | |
pressKeyCode(39) | |
pressKeyCode(33) | |
pressKeyCode(33) | |
pressKeyCode(44) | |
pressKeyCode(33) | |
pressKeyCode(46) | |
waitsecond(1) | |
click(338,73) | |
waitsecond(8) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_2) do | |
$ruiObj = RUIObject.new.with('objectid', -645114109).with('selfid', 1005743735).with('textdescid', -584673065).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_LiTitle_Runkeeper_4) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_Search) do | |
$myFailReason = "Can not search Application::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_3) do | |
$ruiObj = RUIObject.new.with('objectid', -645114109).with('selfid', 1005743735).with('textdescid', -584673065).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_LiTitle_Runkeeper_4) do | |
$ruiObj = RUIObject.new.with('objectid', -645114109).with('selfid', 1005743735).with('textdescid', -584673065).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/li_title') | |
.with('text', 'Runkeeper GPS Track Run Walk') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_search_InstallBtn_OpenBtn) do | |
for i in 0..6 | |
if uiObj("TextView").text("Install").exists or uiObj("TextView").text("Open").exists | |
break | |
else | |
drag(120, 100, 120, 400, 50) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Click_Install_Uninstall_Button) do | |
if uiObj("TextView").resid("com.android.vending:id/downloads_count").exists or uiObj("TextView").resid("com.android.vending:id/rating_count").exists | |
if uiObj("TextView").text("Open").exists and !uiObj("TextView").text("Uninstall").exists | |
for i in 0..4 | |
if uiObj("TextView").text("Uninstall").exists | |
break | |
else | |
swipe_vertical(150) | |
end | |
end | |
end | |
if uiObj("TextView").text("Uninstall").exists | |
uiObj("TextView").text("Uninstall").click | |
$msg = "Click Uninstall Button-1" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
for i in 0..5 | |
waitsecond(5) | |
wakeUp | |
if uiObj("TextView").text("Install").exists | |
$msg = "Uninstall Success-1" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
break | |
else | |
if i == 5 | |
$msg = "Uninstall Fail-1" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
end | |
end | |
if uiObj("TextView").text("Install").exists | |
uiObj("TextView").text("Install").click | |
$msg = "Click Install Button" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
for i in 0..99 | |
waitsecond(5) | |
wakeUp | |
if uiObj("TextView").text("Open").exists and !uiObj("TextView").text("Uninstall").exists | |
for i in 0..4 | |
if uiObj("TextView").text("Uninstall").exists | |
break | |
else | |
swipe_vertical(150) | |
end | |
end | |
end | |
if uiObj("TextView").text("Uninstall").exists | |
$myTestResult = true | |
$msg = "Install Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
break | |
else | |
if i == 59 | |
$myFailReason = "Application install 10m time out::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Install 10m Time out" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
elsif uiObj("TextView").text("Continue").exists | |
uiObj("TextView").text("Continue").click | |
elsif uiObj("TextView").text("Accept").exists | |
uiObj("TextView").text("Accept").click | |
elsif uiObj("Button").text("YES").exists | |
uiObj("Button").text("YES").click # Download app over mobile network 3.4 MB? | |
end | |
end | |
end | |
else | |
$myFailReason = "Cannot find Install Button::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot Install Button" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$myFailReason = "Cannot find downloads count::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find downloads count" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Downloading_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Downloading') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_ButtonText_Downloading_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0) | |
.with('uitreeindex', 7) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.android.vending:id/button_text') | |
.with('text', 'Downloading') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_05_03_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
if !($myTestResult) or $curLoopNum == 9 | |
$myTestResult = true | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Text_Successfully) do | |
$ruiObj = RUIObject.new.with('objectid', 1472509444).with('selfid', 1035549449).with('textdescid', 753694147).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/text') | |
.with('text', 'Successfully installed') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_End) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_removePopUp) do | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_End) do | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.excutePlayStore(loopTime) | |
tcase = TestCase.new("excutePlayStore") | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_05_01_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Play Store') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Button_Button1_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_PlayStore_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_PlayStore_1) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "PlayStore Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_3) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.isExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Button_Button1_4) do | |
$ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358) | |
.with('uitreeindex', 1) | |
.with('classname', 'Button') | |
.with('resource-id', 'android:id/button1') | |
.with('text', 'YES IM IN') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_PlayStore_2) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "PlayStore Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_05_01_StoreFrontDownload") | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.make30sSleep(loopTime) | |
tcase = TestCase.new("make30sSleep") | |
tcase << TestAction.new(:LogUpload_Enable) do | |
$saveLogToGist = true | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait32second) do | |
waitsecond(300) | |
end | |
tcase.run(loopTime) | |
end | |
def self.make_Clipboard_Text_160(loopTime) | |
tcase = TestCase.new("make_Clipboard_Text_160") | |
tcase << TestAction.new(:Messgenger) do | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity") | |
waitsecond(2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait_4seconds) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_MainText_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_MainText_2) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown_searchConversation) do | |
swipe_vertical 100 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_MainText_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:show_Option) do | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Reply) do | |
$ruiObj = RUIObject.new.with('objectid', -1353661384).with('selfid', -1919466194).with('textdescid', -993711234).with('uniqueparentid', 0) | |
.with('uitreeindex', 5) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', 'Reply') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:View_ImeChoice) do | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:Characters_Input_160) do | |
for i in 1..16 | |
click(78,300) | |
click(278,360) | |
click(198,360) | |
click(158,300) | |
click(138,240) | |
click(198,300) | |
click(238,300) | |
click(278,300) | |
click(338,240) | |
click(318,300) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:touch_text) do | |
click(240,73) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_1) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Copy_1) do | |
click(240,197) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_2) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_All) do | |
click(378,197) | |
waitsecond(2) | |
click(318,380) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Copy_2) do | |
click(240,197) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(4) | |
end | |
tcase.run(loopTime) | |
end | |
def self.openDownloadedApp(loopTime) | |
tcase = TestCase.new("openDownloadedApp") | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_05_06_StoreFrontDownload") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Runkeeper') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_DownloadedApp) do | |
for i in 0..9 | |
waitsecond(3) | |
if uiObj("TextView").text("Start").exists | |
$myTestResult = true | |
break | |
elsif i == 9 | |
$myFailReason = "Runkeeper Open 30s timeout::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_05_06_StoreFrontDownload") | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.open_SMS(loopTime) | |
tcase = TestCase.new("open_SMS") | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_02_10_Messaging") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Messgenger) do | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity") | |
waitsecond(2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait4second) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_MainText_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_MainText_2) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown_searchConversation) do | |
swipe_vertical 100 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_MainText_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait1second) do | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:swipeLeft_back) do | |
pressKeyCode(4) | |
waitsecond(1) | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_02_10_Messaging") | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.playMusic_GoogleMusic(loopTime) | |
tcase = TestCase.new("playMusic_GoogleMusic") | |
tcase << TestAction.new(:Check_Watch_Face_1) do | |
wakeUp | |
waitsecond(1) | |
pressMenu | |
waitsecond(1) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists | |
$msg = "Watch Face Change Displaying...." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
pressHome | |
$msg = "pressHome >> Watch Face Escape " | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_07_11_Multi_Media") | |
waitsecond(2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu_5) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_2) do | |
gotoApp('Play Music') | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:closeApp_1) do | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
waitsecond(3) | |
logStopTest("05_01_07_11_Multi_Media") | |
waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.recentCall(loopTime) | |
tcase = TestCase.new("recentCall") | |
tcase << TestAction.new(:Check_Temperature_Start) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== RecentCall Start Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
$ruiObj = RUIObject.new.with('objectid', 664288872).with('selfid', 1322575484).with('textdescid', -1859474097).with('uniqueparentid', 0).with('classresourceid', 1059678339) | |
.with('uitreeindex', 3) | |
.with('classname', 'ImageButton') | |
.with('resource-id', 'android:id/button1') | |
.with('content-desc', 'Yes') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_setUp) do | |
wakeUp | |
logStartTest("05_01_01_03_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:open_recentCallList) do | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.phone/com.google.android.clockwork.phone.dialer.DialerActivity") | |
for i in 0..4 | |
if uiObj("ImageView").resid("com.google.android.apps.wearable.phone:id/action").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Contacts").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
elsif uiObj("TextView").text("Recents").exists | |
break | |
elsif uiObj("TextView").resid("com.google.android.apps.wearable.phone:id/numpad_digit").exists | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
else | |
waitsecond(2) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:check_RecentCall_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isNotExist | |
ifFailJumpTo(:click_RecentCall) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown) do | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:check_RecentCall_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_endCall_Wear) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:click_RecentCall) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Recents) do | |
$ruiObj = RUIObject.new.with('objectid', 1506645687).with('selfid', 1176639686).with('textdescid', 1641116945).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('text', 'Recents') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_sendBTCmd_answerCall) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:check_RecentCall_Retry_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isNotExist | |
ifFailJumpTo(:click_RecentCall_Retry) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown_Retry) do | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:check_RecentCall_Retry_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_endCall_Wear) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:click_RecentCall_Retry) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/number') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_sendBTCmd_answerCall) do | |
for i in 0..20 | |
waitsecond(2) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
sendBTCmd("answerCall") | |
waitsecond(3) | |
if uiObj("TextView").resid("com.google.android.apps.wearable.phone:id/elapsed_time").exists | |
#waitsecond(2) | |
$res = false | |
else | |
$res = true | |
end | |
elsif uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
if uiObj("TextView").resid("com.google.android.apps.wearable.phone:id/elapsed_time").exists | |
$res = false | |
else | |
$res = true | |
end | |
elsif uiObj("TextView").text("Call in progress").exists | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
click(240,240) | |
waitsecond(2) | |
if !uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists and uiObj("TextView").text("Call from watch").exists | |
puts "Call from watch" | |
gotoApp('watch') | |
waitsecond(2) | |
end | |
end | |
waitsecond(2) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
sendBTCmd("answerCall") | |
waitsecond(2) | |
$res = uiObj("TextView").text("dialing").exists | |
elsif not uiObj("TextView").text("dialing").exists | |
$res = true | |
else | |
$res = true | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
elsif (i == 20) | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
#else | |
# waitsecond(2) | |
end | |
if !$res | |
puts "Answer Call OK" | |
break | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_endCall_Wear) do | |
wakeUp | |
$res = uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
$res = uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/hangup").exists | |
end | |
if !$res | |
puts "Not exist Hangup" | |
if uiObj("TextView").text("Call in progress").exists | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Swipe left to open.").exists | |
swipe_horizontal 10 | |
waitsecond(2) | |
click(240,240) | |
end | |
end | |
end | |
if $res | |
$UIDev.pressKeyCode(6) | |
puts "End Call OK" | |
else | |
$UIDev.pressKeyCode(6) | |
sendBTCmd("endCall") | |
$myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_logStop) do | |
#waitsecond(2) | |
logStopTest("05_01_01_03_Telephony") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:kill) do | |
wakeUp | |
waitsecond(1) | |
if uiObj("TextView").text("Call in progress").exists | |
waitsecond(2) | |
$msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth") | |
waitsecond(5) | |
PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth") | |
waitsecond(5) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_BTChatWear) do | |
if !($myTestResult) | |
$myTestResult = true | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity") | |
$msg = "Run BTChatWear for turning on discover" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(4) | |
pressKeyCode(4) | |
waitsecond(2) | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity") | |
waitsecond(4) | |
for i in 0..5 | |
if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists | |
uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow | |
break | |
else | |
waitsecond(1) | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Check_Temperature_End) do | |
wakeUp | |
if uiObj("TextView").text("Temperature limit reached").exists | |
$msg = "=== RecentCall End Temperature limit Popup ===" | |
puts($msg) | |
logcat($msg) | |
writelog($msg) | |
$ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.remove_Alarm_GotoApp(loopTime) | |
tcase = TestCase.new("remove_Alarm_GotoApp") | |
tcase << TestAction.new(:wakeUp) do | |
wakeUp | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait2second) do | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Alarm') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:logStart) do | |
logStartTest("05_01_06_04_PIM") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Remove_Alarm) do | |
wakeUp | |
waitsecond(2) | |
if uiObj("TextView").text("New alarm").exists or uiObj('TextView').resid("com.google.android.deskclock:id/repeating_days").exists | |
$msg = "New alarm" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
for i in 0..5 | |
if uiObj("TextView").text("One time").exists | |
uiObj('TextView').text("One time").click | |
$msg = "New alarm >> One time" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
if uiObj("TextView").text("Repeat").exists | |
swipe_vertical 20 | |
waitsecond(1) | |
uiObj('TextView').text("Remove").click | |
$msg = "New alarm >> Remove OK" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
end | |
end | |
if uiObj("TextView").text("No alarms set").exists | |
waitsecond(2) | |
break | |
end | |
end | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:logStop) do | |
#waitsecond(3) | |
logStopTest("05_01_06_04_PIM") | |
#waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.sendSMS(loopTime) | |
tcase = TestCase.new("sendSMS") | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_02_03_Messaging") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:Messgenger) do | |
wakeUp | |
PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity") | |
waitsecond(2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait_4seconds) do | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_DescriptionText) do | |
$ruiObj = RUIObject.new.with('objectid', -1172628426).with('selfid', -742062757).with('textdescid', 294867016).with('uniqueparentid', 0).with('classresourceid', 574161329) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/description_text') | |
.with('text', 'With Messenger on your phone you can reply to all your phones conversations from your watch') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_MainText_1) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Back_1) do | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_MainText_1) do | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.isNotExist | |
ifFailJumpTo(:TextView_MainText_2) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown_searchConversation) do | |
swipe_vertical 100 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_MainText_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 475289571).with('selfid', -1551548312).with('textdescid', 1043296569).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', db('CallNumber')[1]) | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:show_Option) do | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Reply) do | |
$ruiObj = RUIObject.new.with('objectid', -1353661384).with('selfid', -1919466194).with('textdescid', -993711234).with('uniqueparentid', 0) | |
.with('uitreeindex', 5) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/main_text') | |
.with('text', 'Reply') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:View_ImeChoice_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_1) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_2) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Paste) do | |
click(299,183) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Check_EMogi) do | |
if uiObj("TextView").resid("com.google.android.wearable.app:id/instruction_title").exists or uiObj("ImageView").resid("com.google.android.wearable.app:id/tutorial_image").exists or uiObj("TextView").resid("com.google.android.wearable.app:id/character_result").exists | |
pressKeyCode(4) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_InstructionTitle) do | |
$ruiObj = RUIObject.new.with('objectid', -1285089049).with('selfid', 1652403414).with('textdescid', 1683314973).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/instruction_title') | |
.with('text', 'Draw emoji') | |
$ruiObj.isExist | |
ifFailJumpTo(:select_Send_Icon) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_Back_2) do | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Send_Icon) do | |
click(338,73) | |
waitsecond(2) | |
waitsecond(8) | |
end | |
tcase << TestAction.new(:View_ImeChoice_Retry_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_BottomTimestamp_2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:View_ImeChoice_Retry_2) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 1845518973).with('selfid', 1645856786).with('textdescid', -1189538444).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'android.view.View') | |
.with('resource-id', 'com.google.android.wearable.app:id/ime_choice') | |
.with('content-desc', 'Keyboard input') | |
$ruiObj.click | |
waitsecond(4) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_Retry_1) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_BottomTimestamp_1) do | |
wakeUp | |
$ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp') | |
.with('text', 'You Now') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Characters_Input_160_Retry) do | |
for i in 1..16 | |
click(78,300) | |
click(278,360) | |
click(198,360) | |
click(158,300) | |
click(138,240) | |
click(198,300) | |
click(238,300) | |
click(278,300) | |
click(338,240) | |
click(318,300) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_Retry_2) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:touch_text_Retry) do | |
click(240,73) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_Retry_3) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Copy_Retry_1) do | |
click(240,197) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_RemoteInputHeader_Retry_4) do | |
$ruiObj = RUIObject.new.with('objectid', 527100234).with('selfid', -908654521).with('textdescid', 2112040751).with('uniqueparentid', 0) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/remote_input_header') | |
.with('text', 'Message') | |
$ruiObj.longClick | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_All_Retry) do | |
click(378,197) | |
waitsecond(2) | |
click(318,380) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Copy_Retry_2) do | |
click(240,197) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:select_Send_Icon_Retry) do | |
click(338,73) | |
waitsecond(2) | |
waitsecond(8) | |
end | |
tcase << TestAction.new(:TextView_BottomTimestamp_2) do | |
$ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp') | |
.with('text', 'You Now') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait16second_1) do | |
waitsecond(16) | |
wakeUp | |
end | |
tcase << TestAction.new(:TextView_BottomTimestamp_3) do | |
$ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp') | |
.with('text', 'You Now') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait16second_2) do | |
waitsecond(16) | |
wakeUp | |
end | |
tcase << TestAction.new(:check_SendingError) do | |
for i in 0..2 | |
if uiObj("TextView").resid("com.google.android.apps.messaging:id/error_text").exists | |
if i == 2 | |
$myFailReason = "Cannot send SMS" | |
$myTestResult = false | |
break | |
else | |
uiObj("TextView").resid("com.google.android.apps.messaging:id/error_text").click | |
waitsecond(2) | |
if uiObj("TextView").text("Resend").exists | |
uiObj("TextView").text("Resend").click | |
waitsecond(16) | |
wakeUp | |
waitsecond(16) | |
wakeUp | |
end | |
end | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_BottomTimestamp_4) do | |
$ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp') | |
.with('text', 'You Now') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStop) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:send_SMS_Fail) do | |
$myFailReason = "SMS send Fail::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_02_03_Messaging") | |
#waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_MessageText) do | |
$ruiObj = RUIObject.new.with('objectid', -1187987555).with('selfid', -1370099946).with('textdescid', 1674132369).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.apps.messaging:id/message_text') | |
.with('text', 'Hello') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:goto_Home) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:show_Option_2) do | |
for i in 0..4 | |
swipe_vertical 20 | |
waitsecond(2) | |
if uiObj("TextView").resid("com.google.android.apps.messaging:id/reply_menu_header").exists | |
break | |
elsif uiObj("android.view.View").resid("com.google.android.wearable.app:id/ime_choice").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_deleteSMS) do | |
gotoApp('Delete last message') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Button_ConfirmButton) do | |
$ruiObj = RUIObject.new.with('objectid', 1462699923).with('selfid', -630553976).with('textdescid', -1900942611).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'Button') | |
.with('resource-id', 'com.google.android.apps.messaging:id/confirm_button') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.setAlarm_GotoApp(loopTime) | |
tcase = TestCase.new("setAlarm_GotoApp") | |
tcase << TestAction.new(:wakeUp) do | |
wakeUp | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:swipeRight_1) do | |
swipe_horizontal 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Alarm') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Check_New_Alarm) do | |
wakeUp | |
waitsecond(1) | |
if uiObj("TextView").text("New alarm").exists | |
$msg = "New alarm" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
for i in 0..5 | |
$msg = "i = #{i}" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
if uiObj("TextView").text("One time").exists | |
uiObj('TextView').text("One time").click | |
$msg = "New alarm >> One time" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
if uiObj("TextView").text("Repeat").exists | |
uiObj('TextView').text("Remove").click | |
$msg = "New alarm >> Remove OK" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
end | |
end | |
if uiObj("TextView").text("No alarms set").exists | |
waitsecond(2) | |
break | |
end | |
end | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
pressMenu | |
waitsecond(2) | |
swipe_horizontal 10 | |
waitsecond(2) | |
gotoApp('Alarm') | |
waitsecond(2) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_06_02_PIM") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:swipeDown) do | |
wakeUp | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:swipeRight_2) do | |
swipe_horizontal 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:swipeRight_3) do | |
swipe_horizontal 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:swipeRight_4) do | |
swipe_horizontal 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Set_Alarm) do | |
$ruiObj = RUIObject.new.with('objectid', -337373855).with('selfid', -1105113556).with('textdescid', -1537748564).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.deskclock:id/text') | |
.with('text', 'Set alarm') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
#waitsecond(3) | |
logStopTest("05_01_06_02_PIM") | |
#waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.shuffleMusic_GoogleMusic(loopTime) | |
tcase = TestCase.new("shuffleMusic_GoogleMusic") | |
tcase << TestAction.new(:Check_Watch_Face) do | |
if rand(100) < 0 | |
wakeUp | |
waitsecond(1) | |
pressMenu | |
waitsecond(1) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists | |
$msg = "Watch Face Change Displaying...." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
pressHome | |
$msg = "pressHome >> Watch Face Escape " | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
end | |
waitsecond(2) | |
end | |
end | |
tcase << TestAction.new(:ImageView_NextTrack_1) do | |
$ruiObj = RUIObject.new.with('objectid', -1140743559).with('selfid', -77028276).with('textdescid', -1003311929).with('uniqueparentid', 0).with('classresourceid', 171675282) | |
.with('uitreeindex', 4) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.wearable.app:id/next_track') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:LogStart) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp) do | |
gotoApp('Play Music') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Title_1) do | |
$ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', -42316734).with('textdescid', -1845768772).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.music:id/title') | |
.with('text', 'Play on Wear') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_PlaylistTitle) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Title_2) do | |
$ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', -42316734).with('textdescid', -1845768772).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.music:id/title') | |
.with('text', 'Play on Wear') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_PlaylistTitle) do | |
$ruiObj = RUIObject.new.with('objectid', 1928194679).with('selfid', -1627616556).with('textdescid', 300968312).with('uniqueparentid', 0) | |
.with('uitreeindex', 3) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.music:id/playlist_title') | |
.with('text', 'Wear') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_SelectOutput) do | |
$ruiObj = RUIObject.new.with('objectid', -1627054395).with('selfid', 2109702396).with('textdescid', -1665923823).with('uniqueparentid', 0) | |
.with('uitreeindex', 4) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.music:id/title') | |
.with('text', 'Choose output') | |
$ruiObj.isExist | |
ifFailJumpTo(:goto_Home) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Speaker) do | |
$ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', 1915081553).with('textdescid', -723584367).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.music:id/title') | |
.with('text', 'Speaker') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:Activation_MusicW) do | |
wakeUp | |
for i in 0..7 | |
if !uiObj("TextView").text("Agenda").exists | |
swipe_vertical 20 | |
waitsecond(2) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/small_icon").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_StartTime) do | |
if rand(100) < 0 | |
$ruiObj = RUIObject.new.with('objectid', -1097734111).with('selfid', -1419618899).with('textdescid', 2123859129).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/start_time') | |
.with('text', '1427') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
end | |
tcase << TestAction.new(:ImageView_SmallIcon_3) do | |
$ruiObj = RUIObject.new.with('objectid', 726849438).with('selfid', 541159049).with('textdescid', 1430480187).with('uniqueparentid', 0).with('classresourceid', -1973133756) | |
.with('uitreeindex', 0) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.wearable.app:id/small_icon') | |
.with('content-desc', 'Play Music') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_07_12_Multi_Media") | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:ImageView_NextTrack_2) do | |
$ruiObj = RUIObject.new.with('objectid', -1140743559).with('selfid', -77028276).with('textdescid', -1003311929).with('uniqueparentid', 0).with('classresourceid', 171675282) | |
.with('uitreeindex', 4) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.wearable.app:id/next_track') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait5second) do | |
waitsecond(5) | |
end | |
tcase << TestAction.new(:LogStop) do | |
waitsecond(3) | |
logStopTest("05_01_07_12_Multi_Media") | |
waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.stopMusic(loopTime) | |
tcase = TestCase.new("stopMusic") | |
tcase << TestAction.new(:Check_Watch_Face) do | |
if rand(100) < 0 | |
wakeUp | |
waitsecond(1) | |
pressMenu | |
waitsecond(1) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists | |
$msg = "Watch Face Change Displaying...." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
pressHome | |
$msg = "pressHome >> Watch Face Escape " | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(1) | |
end | |
waitsecond(2) | |
end | |
end | |
tcase << TestAction.new(:LogStart) do | |
logStartTest("05_01_07_13_Multi_Media") | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_Home) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:goto_PlayMusic) do | |
for i in 0..2 | |
swipe_vertical 20 | |
waitsecond(2) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/small_icon").exists | |
uiObj("ImageView").resid("com.google.android.wearable.app:id/small_icon").click | |
break | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:ImageView_PlayPause) do | |
$ruiObj = RUIObject.new.with('objectid', 1702355621).with('selfid', -1528896392).with('textdescid', 1233416731).with('uniqueparentid', 0).with('classresourceid', -1280192834) | |
.with('uitreeindex', 3) | |
.with('classname', 'ImageView') | |
.with('resource-id', 'com.google.android.wearable.app:id/play_pause') | |
$ruiObj.click | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressBack) do | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:close_MusicPlayer) do | |
swipe_vertical_back 20 | |
waitsecond(2) | |
swipe_vertical 20 | |
waitsecond(2) | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_stopMusicApp) do | |
if rand(100) < 0 | |
$res = false | |
for j in 0..20 | |
wakeUp | |
waitsecond(2) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/charging_icon").exists and not uiObj("android.support.v7.widget.RecyclerView").resid("com.google.android.apps.wearable.settings:id/wheel").exists | |
break | |
elsif uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists | |
break | |
elsif uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists and uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
break | |
else | |
wakeUp | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
end | |
end | |
for i in 0..10 | |
puts "i = #{i}" | |
wakeUp | |
waitsecond(2) | |
for j in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/charging_icon").exists | |
wakeUp | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
wakeUp | |
uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").click | |
waitsecond(2) | |
swipe_horizontal_back 10 | |
waitsecond(2) | |
if not uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists | |
$res = true | |
break | |
end | |
else | |
wakeUp | |
swipe_vertical 20 | |
waitsecond(2) | |
end | |
end | |
if ($res) then | |
puts "loop break" | |
break | |
end | |
end | |
waitsecond(2) | |
end | |
end | |
tcase << TestAction.new(:LogStop) do | |
waitsecond(3) | |
logStopTest("05_01_07_13_Multi_Media") | |
waitsecond(2) | |
if !($myTestResult) | |
$myTestResult = true | |
end | |
waitsecond(1) | |
end | |
tcase.run(loopTime) | |
end | |
def self.wifiConnect_GotoApp(loopTime) | |
tcase = TestCase.new("wifiConnect_GotoApp") | |
tcase << TestAction.new(:Check_Watch_Face) do | |
wakeUp | |
pressMenu | |
waitsecond(2) | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists | |
$msg = "Watch Face Change Displaying...." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
pressHome | |
waitsecond(2) | |
$msg = "pressHome >> Watch Face Escape " | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(2) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_1) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Connectivity) do | |
$ruiObj = RUIObject.new.with('objectid', 1792120625).with('selfid', 97097912).with('textdescid', -1797333382).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'Connectivity') | |
$ruiObj.isExist | |
ifFailJumpTo(:TextView_Title_Bluetooth) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:gotoApp_WiFi_1) do | |
gotoApp('Wi-Fi') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:TextView_Title_Bluetooth) do | |
$ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -108668083).with('textdescid', -730639859).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'Bluetooth') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:goto_Home_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Cellular) do | |
$ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -13782805).with('textdescid', -619262533).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 6) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'Cellular') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:goto_Home_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_WiFi) do | |
$ruiObj = RUIObject.new.with('objectid', -170893184).with('selfid', -589731018).with('textdescid', 1589370827).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'WiFi') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_Check_WiFi_On) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home_1) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Settings) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Connectivity) do | |
gotoApp('Connectivity') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_WiFi_2) do | |
gotoApp('Wi-Fi') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_2) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_WiFi_On) do | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists and ($myTestResult) | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) | |
if uiObj("TextView").text("Automatic").exists | |
$msg = "WiFi is turned on already." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
if uiObj("TextView").text("Off").exists | |
if uiObj("TextView").text("Off").click | |
waitsecond(2) | |
$msg = "Click 'Off' for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Off' Fail for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
for i in 0..4 | |
if uiObj("TextView").text("Automatic").exists | |
waitsecond(10) | |
$msg = "Wi-Fi On Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
break | |
elsif uiObj("TextView").text("Off").exists | |
if i == 4 | |
$myFailReason = "Wi-Fi On Fail::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Wi-Fi On Fail" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
if uiObj("TextView").text("Off").click | |
waitsecond(2) | |
$msg = "Click 'Off' retry for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Off' retry Fail for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
else | |
waitsecond(2) | |
end | |
end | |
end | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu in scriptAction_Check_WiFi_On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_WiFi_Forget_Before) do | |
wakeUp | |
for i in 0..9 | |
isNoSavedNetwork = false | |
if $curLoopNum != 0 | |
break | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists and ($myTestResult) | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) and ($myTestResult) | |
for i in 0..4 | |
if uiObj("TextView").text("Saved networks").exists | |
uiObj("TextView").text("Saved networks").click | |
waitsecond(5) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
if uiObj("ImageView").resid("android:id/icon").exists | |
uiObj("ImageView").resid("android:id/icon").click | |
waitsecond(2) | |
if uiObj("ImageButton").resid("android:id/button1").exists | |
uiObj("ImageButton").resid("android:id/button1").click | |
waitsecond(2) | |
$msg = "Saved network was forgotten." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
isNoSavedNetwork = true | |
$msg = "No saved networks." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
break | |
else | |
swipe_vertical(20) | |
waitsecond(2) | |
if i == 4 | |
$myFailReason = "Cannot entry Saved networks Menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot entry Saved networks Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
else | |
swipe_vertical(20) | |
waitsecond(2) | |
if i == 4 | |
$myFailReason = "Cannot find Saved networks Menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find Saved networks Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu in scriptAction_WiFi_Forget_Before" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
if isNoSavedNetwork or !($myTestResult) | |
break | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_10_02_WiFi") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_WiFi_Connect) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists and ($myTestResult) | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) and ($myTestResult) | |
for i in 0..2 | |
if uiObj("TextView").text("Add network").exists | |
uiObj("TextView").text("Add network").click | |
waitsecond(4) | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
for j in 0..4 | |
if !uiObj("ImageView").resid("android:id/icon").exists | |
if j == 4 | |
$myFailReason = "Cannot find available WiFi AP::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find available WiFi AP list_1" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
if uiObj("TextView").text("Connected").exists | |
for k in 0..5 | |
if uiObj("ImageView").resid("android:id/icon").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
else | |
pressKeyCode(4) | |
waitsecond(2) | |
swipe_vertical_back(20) | |
waitsecond(2) | |
uiObj("TextView").text("Add network").click | |
waitsecond(2) | |
end | |
end | |
else | |
break | |
end | |
end | |
if uiObj("ImageView").resid("android:id/icon").exists | |
for l in 0..9 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
$res = WiFi_SearchDown(db('AP_name')[0]) | |
waitsecond(4) | |
$res = WiFi_SearchUp(db('AP_name')[0]) | |
if $res | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(2) | |
swipe_vertical_back(20) | |
waitsecond(2) | |
uiObj("TextView").text("Add network").click | |
waitsecond(2) | |
end | |
end | |
if $res | |
$msg = "WiFi AP search success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$myFailReason = "WiFi AP search fail::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "WiFi AP search fail" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$msg = "Cannot find available WiFi AP list_2" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(2) | |
pressKeyCode(4) | |
waitsecond(2) | |
break | |
else | |
$msg = "Cannot entry 'Add network'" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
swipe_vertical_back(20) | |
waitsecond(2) | |
if i == 2 | |
$msg = "Cannot find 'Add network'" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu in scriptAction_WiFi_Connect" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Subtitle_Recent_1) do | |
$ruiObj = RUIObject.new.with('objectid', 1649016719).with('selfid', 1207222126).with('textdescid', 1837673876).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/subtitle') | |
.with('text', 'RECENT') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_IncomingCall_3) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Settings_1) do | |
$ruiObj = RUIObject.new.with('objectid', 2009070145).with('selfid', -2070602048).with('textdescid', -1793726178).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/title') | |
.with('text', 'Settings') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_IncomingCall_3) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:gotoApp_Settings_Retry_1) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Connectivity_Retry_1) do | |
gotoApp('Connectivity') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_3) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:wait20second_After_Connet) do | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists and ($myTestResult) | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) and ($myTestResult) | |
for i in 0..14 | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
for i in 0..4 | |
waitsecond(2) | |
if uiObj("TextView").text("Connected").exists | |
break | |
end | |
end | |
if uiObj("TextView").text("Connected").exists and ($myTestResult) | |
$msg = "Find success connected AP" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(20) | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
break | |
else | |
if i == 14 | |
$myFailReason = "Cannot find connected AP::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find connected AP" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
if uiObj("TextView").text("Add network").exists | |
uiObj("TextView").text("Add network").click | |
for i in 0..4 | |
waitsecond(2) | |
if uiObj("TextView").text("Connected").exists | |
break | |
end | |
end | |
wakeUp | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
if uiObj("TextView").text("Connected").exists and uiObj("ImageView").resid("android:id/icon").exists | |
$msg = "Find success connected AP in Add Network Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(20) | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
break | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Connected").exists | |
$msg = "Find success connected AP_retry" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
waitsecond(20) | |
wakeUp | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
break | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists and ($myTestResult) | |
uiObj("TextView").text("Wi-Fi").click | |
end | |
end | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu in wait20second_After_Connet" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
tcase << TestAction.new(:TextView_Subtitle_Recent_2) do | |
$ruiObj = RUIObject.new.with('objectid', 1649016719).with('selfid', 1207222126).with('textdescid', 1837673876).with('uniqueparentid', 0) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/subtitle') | |
.with('text', 'RECENT') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_IncomingCall_4) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Settings_2) do | |
$ruiObj = RUIObject.new.with('objectid', 2009070145).with('selfid', -2070602048).with('textdescid', -1793726178).with('uniqueparentid', 0) | |
.with('uitreeindex', 1) | |
.with('classname', 'TextView') | |
.with('resource-id', 'com.google.android.wearable.app:id/title') | |
.with('text', 'Settings') | |
$ruiObj.isExist | |
ifFailJumpTo(:scriptAction_check_IncomingCall_4) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:gotoApp_Settings_Retry_2) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Connectivity_Retry_2) do | |
gotoApp('Connectivity') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_4) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_WiFi_Forget_After) do | |
wakeUp | |
for i in 0..9 | |
isNoSavedNetwork = false | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Saved networks").exists or (uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists)) | |
for i in 0..4 | |
if uiObj("TextView").text("Saved networks").exists | |
uiObj("TextView").text("Saved networks").click | |
waitsecond(5) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
if uiObj("ImageView").resid("android:id/icon").exists | |
uiObj("ImageView").resid("android:id/icon").click | |
waitsecond(2) | |
if uiObj("ImageButton").resid("android:id/button1").exists | |
uiObj("ImageButton").resid("android:id/button1").click | |
waitsecond(2) | |
$myTestResult = true | |
$msg = "Saved network was forgotten." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
if uiObj("TextView").text("No saved networks").exists | |
isNoSavedNetwork = true | |
$msg = "No saved networks._1" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
isNoSavedNetwork = true | |
$msg = "No saved networks._2" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
break | |
else | |
swipe_vertical(20) | |
waitsecond(2) | |
if i == 4 | |
$msg = "Cannot entry Saved networks Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
else | |
swipe_vertical(20) | |
waitsecond(2) | |
if i == 4 | |
$msg = "Cannot find Saved networks Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
end | |
pressKeyCode(4) | |
waitsecond(2) | |
else | |
$msg = "Cannot find WiFi Menu in scriptAction_WiFi_Forget_After" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
if isNoSavedNetwork | |
break | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:logStop) do | |
wakeUp | |
logStopTest("05_01_10_02_WiFi") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_Check_WiFi_Off) do | |
if $curLoopNum == 19 | |
if uiObj("TextView").text("Wi-Fi").exists and uiObj("TextView").text("Connectivity").exists | |
uiObj("TextView").text("Wi-Fi").click | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Saved networks").exists and !uiObj("TextView").text("About Wi-Fi").exists and !uiObj("TextView").text("Add network").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").resid("android:id/title").text("Add network").exists and !uiObj("TextView").text("Automatic").exists and !uiObj("TextView").text("Off").exists and !uiObj("TextView").text("Saved networks").exists | |
pressKeyCode(4) | |
waitsecond(2) | |
end | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) | |
if uiObj("TextView").text("Off").exists | |
$msg = "WiFi is turned off already." | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
if uiObj("TextView").text("Automatic").exists | |
uiObj("TextView").text("Automatic").click | |
waitsecond(5) | |
$msg = "Click 'Automatic' for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
for i in 0..4 | |
if uiObj("TextView").text("Automatic").exists | |
if uiObj("TextView").text("Automatic").click | |
waitsecond(5) | |
$msg = "Click 'Automatic' retry for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Automatic' retry Fail for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
elsif uiObj("TextView").text("Off").exists | |
$msg = "WiFi Off Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
end | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu in scriptAction_Check_WiFi_Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home_2) do | |
if $curLoopNum == 19 or !($myTestResult) | |
$myTestResult = true | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.wifiTurnOnOff_GotoApp(loopTime) | |
tcase = TestCase.new("wifiTurnOnOff_GotoApp") | |
tcase << TestAction.new(:scriptAction_check_IncomingCall) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:LogStart) do | |
wakeUp | |
logStartTest("05_01_10_01_WiFi") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Bluetooth) do | |
$ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -108668083).with('textdescid', -730639859).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 2) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'Bluetooth') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:goto_Home_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_Cellular) do | |
$ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -13782805).with('textdescid', -619262533).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 6) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'Cellular') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:goto_Home_1) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:TextView_Title_WiFi) do | |
$ruiObj = RUIObject.new.with('objectid', -170893184).with('selfid', -589731018).with('textdescid', 1589370827).with('uniqueparentid', 0).with('classresourceid', 490183159) | |
.with('uitreeindex', 0) | |
.with('classname', 'TextView') | |
.with('resource-id', 'android:id/title') | |
.with('text', 'WiFi') | |
$ruiObj.isNotExist | |
ifFailJumpTo(:scriptAction_WiFi_OnOff_Click) | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home_1) do | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:pressMenu) do | |
for i in 0..5 | |
if uiObj("TextView").text("Agenda").exists | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Settings) do | |
gotoApp('Settings') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_Connectivity) do | |
gotoApp('Connectivity') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:wait2second) do | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:gotoApp_WiFi) do | |
gotoApp('Wi-Fi') | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:scriptAction_check_IncomingCall_1) do | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:scriptAction_WiFi_OnOff_Click) do | |
if uiObj("TextView").text("Wi-Fi").exists and (uiObj("TextView").text("Automatic").exists or uiObj("TextView").text("Off").exists) | |
for i in 0..4 | |
if uiObj("TextView").text("Automatic").exists | |
if uiObj("TextView").text("Automatic").click | |
waitsecond(5) | |
$msg = "Click 'Automatic' for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Automatic' Fail for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
elsif uiObj("TextView").text("Off").exists | |
break | |
else | |
waitsecond(2) | |
end | |
end | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("TextView").text("Off").exists | |
if uiObj("TextView").text("Off").click | |
waitsecond(2) | |
$msg = "Click 'Off' for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Off' Fail for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
for i in 0..4 | |
if uiObj("TextView").text("Automatic").exists | |
waitsecond(8) | |
$msg = "Wi-Fi On Success" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
if uiObj("android.view.View").resid("com.google.android.apps.wearable.phone:id/reject").exists | |
$UIDev.pressKeyCode(6) | |
waitsecond(3) | |
end | |
if uiObj("TextView").text("Automatic").click | |
waitsecond(2) | |
$msg = "Click 'Automatic' for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Automatic' Fail for WiFi Off" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
break | |
elsif uiObj("TextView").text("Off").exists | |
if i == 4 | |
$myFailReason = "Wi-Fi On Fail::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Wi-Fi On Fail" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
if uiObj("TextView").text("Off").click | |
waitsecond(2) | |
$msg = "Click 'Off' retry for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
else | |
$msg = "Click 'Off' retry Fail for WiFi On" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
end | |
else | |
waitsecond(2) | |
end | |
end | |
else | |
$myFailReason = "Cannot find 'Off'::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find 'Off'" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
else | |
$myFailReason = "Cannot find WiFi menu::#{takeScreenShot}::screenshot saved" | |
$myTestResult = false | |
$msg = "Cannot find WiFi Menu" | |
puts $msg | |
logcat($msg) | |
writelog($msg) | |
end | |
waitsecond(2) | |
end | |
tcase << TestAction.new(:LogStop) do | |
wakeUp | |
logStopTest("05_01_10_01_WiFi") | |
waitsecond(1) | |
end | |
tcase << TestAction.new(:goto_Home_2) do | |
if $curLoopNum == 19 or !($myTestResult) | |
$myTestResult = true | |
for i in 0..5 | |
if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists | |
pressKeyCode(4) | |
waitsecond(1) | |
break | |
else | |
pressKeyCode(4) | |
waitsecond(1) | |
end | |
end | |
end | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.startTest(loopTime) | |
tcase = TestCase.new("startTest") | |
tcase << TestAction.new(:scriptAction_1) do | |
waitsecond(2) | |
end | |
tcase.run(loopTime) | |
end | |
def self.exception_handler | |
puts "Module Exception Hanlder..." | |
end | |
def self.run(loop) | |
mainLoop loop | |
end | |
end | |
$exceptionPackageNameList = [] | |
$exceptionPackageNameList_exclude = [] | |
def exception_handler | |
Wear_MTBF_170207.exception_handler | |
end | |
$curProjectLogFile = $useLastLogFile | |
$curProjectLogFile = "Wear_MTBF_170207_#{getTimeStamp}.log" if $useLastLogFile.nil? | |
$useLastLogFile = nil | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment