Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 148.66 KB | None | 0 0
  1.  
  2. loadTestDB
  3.  
  4. module Wear_MTBF_160728
  5.  
  6. def self.APP_NAVI_GotoApp(loopTime)
  7.  
  8. tcase = TestCase.new("APP_NAVI_GotoApp")
  9.  
  10. tcase << TestAction.new(:logStart) do
  11. logStartTest("05_01_09_01_Menu_Navigation")
  12.  
  13. waitsecond(1)
  14. end
  15.  
  16. tcase << TestAction.new(:wakeup) do
  17. wakeUp
  18.  
  19. waitsecond(2)
  20. end
  21.  
  22. tcase << TestAction.new(:pressMenu_1) do
  23. for i in 0..5
  24. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  25. break
  26. else
  27. pressKeyCode(4)
  28. waitsecond(1)
  29. end
  30. end
  31.  
  32. waitsecond(2)
  33. end
  34.  
  35. tcase << TestAction.new(:gotoApp_1) do
  36. gotoApp('Phone')
  37.  
  38. waitsecond(2)
  39. end
  40.  
  41. tcase << TestAction.new(:wait4second_1) do
  42. waitsecond(4)
  43. end
  44.  
  45. tcase << TestAction.new(:goto_Home_1) do
  46. for i in 0..5
  47. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  48. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  49. pressKeyCode(4)
  50. waitsecond(1)
  51. else
  52. break
  53. end
  54. else
  55. pressKeyCode(4)
  56. waitsecond(1)
  57. end
  58. end
  59.  
  60. waitsecond(2)
  61. end
  62.  
  63. tcase << TestAction.new(:pressMenu_2) do
  64. for i in 0..5
  65. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  66. break
  67. else
  68. pressKeyCode(4)
  69. waitsecond(1)
  70. end
  71. end
  72.  
  73. waitsecond(2)
  74. end
  75.  
  76. tcase << TestAction.new(:gotoApp_2) do
  77. gotoApp('Settings')
  78.  
  79. waitsecond(2)
  80. end
  81.  
  82. tcase << TestAction.new(:wait4second_2) do
  83. waitsecond(4)
  84. end
  85.  
  86. tcase << TestAction.new(:goto_Home_2) do
  87. for i in 0..5
  88. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  89. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  90. pressKeyCode(4)
  91. waitsecond(1)
  92. else
  93. break
  94. end
  95. else
  96. pressKeyCode(4)
  97. waitsecond(1)
  98. end
  99. end
  100.  
  101. waitsecond(2)
  102. end
  103.  
  104. tcase << TestAction.new(:pressMenu_3) do
  105. for i in 0..5
  106. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  107. break
  108. else
  109. pressKeyCode(4)
  110. waitsecond(1)
  111. end
  112. end
  113.  
  114. waitsecond(2)
  115. end
  116.  
  117. tcase << TestAction.new(:gotoApp_3) do
  118. gotoApp('Alarm')
  119.  
  120. waitsecond(2)
  121. end
  122.  
  123. tcase << TestAction.new(:wait4second_3) do
  124. waitsecond(4)
  125. end
  126.  
  127. tcase << TestAction.new(:goto_Home_3) do
  128. for i in 0..5
  129. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  130. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  131. pressKeyCode(4)
  132. waitsecond(1)
  133. else
  134. break
  135. end
  136. else
  137. pressKeyCode(4)
  138. waitsecond(1)
  139. end
  140. end
  141.  
  142. waitsecond(2)
  143. end
  144.  
  145. tcase << TestAction.new(:pressMenu_4) do
  146. for i in 0..5
  147. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  148. break
  149. else
  150. pressKeyCode(4)
  151. waitsecond(1)
  152. end
  153. end
  154.  
  155. waitsecond(2)
  156. end
  157.  
  158. tcase << TestAction.new(:gotoApp_4) do
  159. gotoApp('Stopwatch')
  160.  
  161. waitsecond(2)
  162. end
  163.  
  164. tcase << TestAction.new(:wait4second_4) do
  165. waitsecond(4)
  166. end
  167.  
  168. tcase << TestAction.new(:goto_Home_4) do
  169. for i in 0..5
  170. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  171. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  172. pressKeyCode(4)
  173. waitsecond(1)
  174. else
  175. break
  176. end
  177. else
  178. pressKeyCode(4)
  179. waitsecond(1)
  180. end
  181. end
  182.  
  183. waitsecond(2)
  184. end
  185.  
  186. tcase << TestAction.new(:pressMenu_5) do
  187. for i in 0..5
  188. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  189. break
  190. else
  191. pressKeyCode(4)
  192. waitsecond(1)
  193. end
  194. end
  195.  
  196. waitsecond(2)
  197. end
  198.  
  199. tcase << TestAction.new(:gotoApp_5) do
  200. gotoApp('Agenda')
  201.  
  202. waitsecond(2)
  203. end
  204.  
  205. tcase << TestAction.new(:wait4second_5) do
  206. waitsecond(4)
  207. end
  208.  
  209. tcase << TestAction.new(:goto_Home_5) do
  210. for i in 0..5
  211. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  212. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  213. pressKeyCode(4)
  214. waitsecond(1)
  215. else
  216. break
  217. end
  218. else
  219. pressKeyCode(4)
  220. waitsecond(1)
  221. end
  222. end
  223.  
  224. waitsecond(2)
  225. end
  226.  
  227. tcase << TestAction.new(:pressMenu_6) do
  228. for i in 0..5
  229. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  230. break
  231. else
  232. pressKeyCode(4)
  233. waitsecond(1)
  234. end
  235. end
  236.  
  237. waitsecond(2)
  238. end
  239.  
  240. tcase << TestAction.new(:gotoApp_6) do
  241. gotoApp('Timer')
  242.  
  243. waitsecond(2)
  244. end
  245.  
  246. tcase << TestAction.new(:wait4second_6) do
  247. waitsecond(4)
  248. end
  249.  
  250. tcase << TestAction.new(:goto_Home_6) do
  251. for i in 0..5
  252. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  253. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  254. pressKeyCode(4)
  255. waitsecond(1)
  256. else
  257. break
  258. end
  259. else
  260. pressKeyCode(4)
  261. waitsecond(1)
  262. end
  263. end
  264.  
  265. waitsecond(2)
  266. end
  267.  
  268. tcase << TestAction.new(:pressMenu_7) do
  269. for i in 0..5
  270. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  271. break
  272. else
  273. pressKeyCode(4)
  274. waitsecond(1)
  275. end
  276. end
  277.  
  278. waitsecond(2)
  279. end
  280.  
  281. tcase << TestAction.new(:gotoApp_7) do
  282. gotoApp('Translate')
  283.  
  284. waitsecond(2)
  285. end
  286.  
  287. tcase << TestAction.new(:wait4second_7) do
  288. waitsecond(4)
  289. end
  290.  
  291. tcase << TestAction.new(:goto_Home_7) do
  292. for i in 0..5
  293. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  294. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  295. pressKeyCode(4)
  296. waitsecond(1)
  297. else
  298. break
  299. end
  300. else
  301. pressKeyCode(4)
  302. waitsecond(1)
  303. end
  304. end
  305.  
  306. waitsecond(2)
  307. end
  308.  
  309. tcase << TestAction.new(:pressMenu_8) do
  310. for i in 0..5
  311. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  312. break
  313. else
  314. pressKeyCode(4)
  315. waitsecond(1)
  316. end
  317. end
  318.  
  319. waitsecond(2)
  320. end
  321.  
  322. tcase << TestAction.new(:gotoApp_8) do
  323. gotoApp('Play Store')
  324.  
  325. waitsecond(2)
  326. end
  327.  
  328. tcase << TestAction.new(:wait4second_8) do
  329. waitsecond(4)
  330. end
  331.  
  332. tcase << TestAction.new(:goto_Home_8) do
  333. for i in 0..5
  334. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  335. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  336. pressKeyCode(4)
  337. waitsecond(1)
  338. else
  339. break
  340. end
  341. else
  342. pressKeyCode(4)
  343. waitsecond(1)
  344. end
  345. end
  346.  
  347. waitsecond(2)
  348. end
  349.  
  350. tcase << TestAction.new(:pressMenu_9) do
  351. for i in 0..5
  352. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  353. break
  354. else
  355. pressKeyCode(4)
  356. waitsecond(1)
  357. end
  358. end
  359.  
  360. waitsecond(2)
  361. end
  362.  
  363. tcase << TestAction.new(:gotoApp_9) do
  364. gotoApp('Fit')
  365.  
  366. waitsecond(2)
  367. end
  368.  
  369. tcase << TestAction.new(:wait4second_9) do
  370. waitsecond(4)
  371. end
  372.  
  373. tcase << TestAction.new(:goto_Home_9) do
  374. for i in 0..5
  375. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  376. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  377. pressKeyCode(4)
  378. waitsecond(1)
  379. else
  380. break
  381. end
  382. else
  383. pressKeyCode(4)
  384. waitsecond(1)
  385. end
  386. end
  387.  
  388. waitsecond(2)
  389. end
  390.  
  391. tcase << TestAction.new(:pressMenu_10) do
  392. for i in 0..5
  393. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  394. break
  395. else
  396. pressKeyCode(4)
  397. waitsecond(1)
  398. end
  399. end
  400.  
  401. waitsecond(2)
  402. end
  403.  
  404. tcase << TestAction.new(:gotoApp_10) do
  405. gotoApp('Play Music')
  406.  
  407. waitsecond(2)
  408. end
  409.  
  410. tcase << TestAction.new(:wait4second_10) do
  411. waitsecond(4)
  412. end
  413.  
  414. tcase << TestAction.new(:goto_Home_10) do
  415. for i in 0..5
  416. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  417. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  418. pressKeyCode(4)
  419. waitsecond(1)
  420. else
  421. break
  422. end
  423. else
  424. pressKeyCode(4)
  425. waitsecond(1)
  426. end
  427. end
  428.  
  429. waitsecond(2)
  430. end
  431.  
  432. tcase << TestAction.new(:pressMenu_11) do
  433. for i in 0..5
  434. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  435. break
  436. else
  437. pressKeyCode(4)
  438. waitsecond(1)
  439. end
  440. end
  441.  
  442. waitsecond(2)
  443. end
  444.  
  445. tcase << TestAction.new(:gotoApp_11) do
  446. gotoApp('Flashlight')
  447.  
  448. waitsecond(2)
  449. end
  450.  
  451. tcase << TestAction.new(:wait4second_11) do
  452. waitsecond(4)
  453. end
  454.  
  455. tcase << TestAction.new(:goto_Home_11) do
  456. for i in 0..5
  457. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  458. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  459. pressKeyCode(4)
  460. waitsecond(1)
  461. else
  462. break
  463. end
  464. else
  465. pressKeyCode(4)
  466. waitsecond(1)
  467. end
  468. end
  469.  
  470. waitsecond(2)
  471. end
  472.  
  473. tcase << TestAction.new(:logStop) do
  474. waitsecond(5)
  475. logStopTest("05_01_09_01_Menu_Navigation")
  476.  
  477. waitsecond(1)
  478. end
  479.  
  480. tcase.run(loopTime)
  481.  
  482. end
  483.  
  484. def self.Clean_Device(loopTime)
  485.  
  486. tcase = TestCase.new("Clean_Device")
  487.  
  488. tcase << TestAction.new(:clean_device) do
  489. wakeUp
  490. waitsecond(4)
  491.  
  492. PDGUiDevice.getInstance.execShellCmd("mkdir /sdcard/uiengine/log/meminfo")
  493. PDGUiDevice.getInstance.execShellCmd("mkdir /sdcard/uiengine/log/top")
  494. waitsecond(5)
  495.  
  496. PDGUiDevice.getInstance.execShellCmd("top -m 10 -n 1 > /sdcard/uiengine/log/top/#{getTimeStamp}_before_top.txt")
  497. waitsecond(5)
  498. PDGUiDevice.getInstance.execShellCmd("cat /proc/meminfo > /sdcard/uiengine/log/meminfo/#{getTimeStamp}_before_meminfo.txt")
  499. waitsecond(5)
  500.  
  501. PDGUiDevice.getInstance.execShellCmd("am force-stop com.lge.wearable.chargingmode")
  502. waitsecond(5)
  503.  
  504. PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.nfc")
  505. waitsecond(5)
  506.  
  507. PDGUiDevice.getInstance.execShellCmd("am kill-all")
  508. waitsecond(10)
  509.  
  510. PDGUiDevice.getInstance.execShellCmd("top -m 10 -n 1 > /sdcard/uiengine/log/top/#{getTimeStamp}_after_top.txt")
  511. waitsecond(5)
  512. PDGUiDevice.getInstance.execShellCmd("cat /proc/meminfo > /sdcard/uiengine/log/meminfo/#{getTimeStamp}_after_meminfo.txt")
  513. waitsecond(5)
  514.  
  515. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.settings")
  516. waitsecond(5)
  517.  
  518. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.wearable.app")
  519. waitsecond(5)
  520.  
  521. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.clockwork.systemui")
  522. waitsecond(5)
  523.  
  524. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.process.gapps")
  525. waitsecond(5)
  526.  
  527.  
  528. waitsecond(2)
  529. end
  530.  
  531. tcase.run(loopTime)
  532.  
  533. end
  534.  
  535. def self.On_Off_NFC(loopTime)
  536.  
  537. tcase = TestCase.new("On_Off_NFC")
  538.  
  539. tcase << TestAction.new(:LogStart) do
  540. logStartTest("05_01_11_01_NFC")
  541.  
  542. waitsecond(2)
  543. end
  544.  
  545. tcase << TestAction.new(:TextView_Title_1) do
  546. $ruiObj = RUIObject.new.with('objectid', -341899195).with('selfid', -434675318).with('textdescid', -1641296144).with('uniqueparentid', 0).with('classresourceid', 490183159)
  547. .with('uitreeindex', 3)
  548. .with('classname', 'TextView')
  549. .with('resource-id', 'android:id/title')
  550. .with('text', 'NFC')
  551.  
  552. $ruiObj.isNotExist
  553. ifFailJumpTo(:Switch_SwitchWidget_On_1)
  554.  
  555. waitsecond(2)
  556. end
  557.  
  558. tcase << TestAction.new(:goto_Home_1) do
  559. for i in 0..5
  560. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  561. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  562. pressKeyCode(4)
  563. waitsecond(1)
  564. else
  565. break
  566. end
  567. else
  568. pressKeyCode(4)
  569. waitsecond(1)
  570. end
  571. end
  572.  
  573. waitsecond(2)
  574. end
  575.  
  576. tcase << TestAction.new(:pressMenu) do
  577. for i in 0..5
  578. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  579. break
  580. else
  581. pressKeyCode(4)
  582. waitsecond(1)
  583. end
  584. end
  585.  
  586. waitsecond(2)
  587. end
  588.  
  589. tcase << TestAction.new(:gotoApp_Settings) do
  590. gotoApp('Settings')
  591.  
  592. waitsecond(2)
  593. end
  594.  
  595. tcase << TestAction.new(:gotoApp_Connectivity) do
  596. gotoApp('Connectivity')
  597.  
  598. waitsecond(2)
  599. end
  600.  
  601. tcase << TestAction.new(:swipeDown) do
  602. swipe_vertical 200
  603.  
  604. waitsecond(2)
  605. end
  606.  
  607. tcase << TestAction.new(:Switch_SwitchWidget_On_1) do
  608. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', 411050777).with('textdescid', -1476314247).with('uniqueparentid', 0).with('classresourceid', -205276468)
  609. .with('uitreeindex', 2)
  610. .with('classname', 'Switch')
  611. .with('resource-id', 'android:id/switch_widget')
  612. .with('text', 'ON')
  613.  
  614. $ruiObj.isExist
  615. ifFailJumpTo(:Switch_SwitchWidget_Off_1)
  616.  
  617. waitsecond(2)
  618. end
  619.  
  620. tcase << TestAction.new(:Switch_SwitchWidget_On_2) do
  621. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', 411050777).with('textdescid', -1476314247).with('uniqueparentid', 0).with('classresourceid', -205276468)
  622. .with('uitreeindex', 2)
  623. .with('classname', 'Switch')
  624. .with('resource-id', 'android:id/switch_widget')
  625. .with('text', 'ON')
  626.  
  627. $ruiObj.click
  628.  
  629. waitsecond(4)
  630. end
  631.  
  632. tcase << TestAction.new(:Switch_SwitchWidget_Off_1) do
  633. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', -142327979).with('textdescid', 1478892121).with('uniqueparentid', 0).with('classresourceid', -205276468)
  634. .with('uitreeindex', 2)
  635. .with('classname', 'Switch')
  636. .with('resource-id', 'android:id/switch_widget')
  637. .with('text', 'OFF')
  638.  
  639. $ruiObj.isNotExist
  640. ifFailJumpTo(:Switch_SwitchWidget_Off_3)
  641.  
  642. waitsecond(2)
  643. end
  644.  
  645. tcase << TestAction.new(:scriptAction_Check_Off_1) do
  646. $myFailReason = "Cannot find NFC Off - 1"
  647. $myTestResult = false
  648.  
  649. waitsecond(2)
  650. end
  651.  
  652. tcase << TestAction.new(:Switch_SwitchWidget_Off_2) do
  653. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', -142327979).with('textdescid', 1478892121).with('uniqueparentid', 0).with('classresourceid', -205276468)
  654. .with('uitreeindex', 2)
  655. .with('classname', 'Switch')
  656. .with('resource-id', 'android:id/switch_widget')
  657. .with('text', 'OFF')
  658.  
  659. $ruiObj.isExist
  660. ifFailJumpTo(:LogStop)
  661.  
  662. waitsecond(2)
  663. end
  664.  
  665. tcase << TestAction.new(:Switch_SwitchWidget_Off_3) do
  666. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', -142327979).with('textdescid', 1478892121).with('uniqueparentid', 0).with('classresourceid', -205276468)
  667. .with('uitreeindex', 2)
  668. .with('classname', 'Switch')
  669. .with('resource-id', 'android:id/switch_widget')
  670. .with('text', 'OFF')
  671.  
  672. $ruiObj.click
  673.  
  674. waitsecond(2)
  675. end
  676.  
  677. tcase << TestAction.new(:wait8second) do
  678. waitsecond(8)
  679. wakeUp
  680. end
  681.  
  682. tcase << TestAction.new(:Switch_SwitchWidget_On_3) do
  683. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', 411050777).with('textdescid', -1476314247).with('uniqueparentid', 0).with('classresourceid', -205276468)
  684. .with('uitreeindex', 2)
  685. .with('classname', 'Switch')
  686. .with('resource-id', 'android:id/switch_widget')
  687. .with('text', 'ON')
  688.  
  689. $ruiObj.isNotExist
  690. ifFailJumpTo(:Switch_SwitchWidget_On_5)
  691.  
  692. waitsecond(2)
  693. end
  694.  
  695. tcase << TestAction.new(:scriptAction_Check_On) do
  696. $myFailReason = "Cannot find NFC On"
  697. $myTestResult = false
  698.  
  699. waitsecond(2)
  700. end
  701.  
  702. tcase << TestAction.new(:Switch_SwitchWidget_On_4) do
  703. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', 411050777).with('textdescid', -1476314247).with('uniqueparentid', 0).with('classresourceid', -205276468)
  704. .with('uitreeindex', 2)
  705. .with('classname', 'Switch')
  706. .with('resource-id', 'android:id/switch_widget')
  707. .with('text', 'ON')
  708.  
  709. $ruiObj.isExist
  710. ifFailJumpTo(:LogStop)
  711.  
  712. waitsecond(2)
  713. end
  714.  
  715. tcase << TestAction.new(:Switch_SwitchWidget_On_5) do
  716. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', 411050777).with('textdescid', -1476314247).with('uniqueparentid', 0).with('classresourceid', -205276468)
  717. .with('uitreeindex', 2)
  718. .with('classname', 'Switch')
  719. .with('resource-id', 'android:id/switch_widget')
  720. .with('text', 'ON')
  721.  
  722. $ruiObj.click
  723.  
  724. waitsecond(4)
  725. end
  726.  
  727. tcase << TestAction.new(:Switch_SwitchWidget_Off_4) do
  728. $ruiObj = RUIObject.new.with('objectid', 964360568).with('selfid', -142327979).with('textdescid', 1478892121).with('uniqueparentid', 0).with('classresourceid', -205276468)
  729. .with('uitreeindex', 2)
  730. .with('classname', 'Switch')
  731. .with('resource-id', 'android:id/switch_widget')
  732. .with('text', 'OFF')
  733.  
  734. $ruiObj.isNotExist
  735. ifFailJumpTo(:LogStop)
  736.  
  737. waitsecond(2)
  738. end
  739.  
  740. tcase << TestAction.new(:scriptAction_Check_Off_2) do
  741. $myFailReason = "Cannot find NFC Off - 2"
  742. $myTestResult = false
  743.  
  744. waitsecond(2)
  745. end
  746.  
  747. tcase << TestAction.new(:LogStop) do
  748. wakeUp
  749. logStopTest("05_01_11_01_NFC")
  750.  
  751. waitsecond(2)
  752. if !($myTestResult)
  753. $myTestResult = true
  754. end
  755.  
  756. waitsecond(2)
  757. end
  758.  
  759. tcase << TestAction.new(:goto_Home_2) do
  760. for i in 0..5
  761. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  762. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  763. pressKeyCode(4)
  764. waitsecond(1)
  765. else
  766. break
  767. end
  768. else
  769. pressKeyCode(4)
  770. waitsecond(1)
  771. end
  772. end
  773.  
  774. waitsecond(2)
  775. end
  776.  
  777. tcase.run(loopTime)
  778.  
  779. end
  780.  
  781. def self.mainLoop(loopTime)
  782.  
  783. WebSocketXServer.setAutoUpdate(false)
  784.  
  785. index = $mainResumeMainLoop
  786. $mainResumeMainLoop = 0
  787.  
  788. writelog("mainLoop::#{index}::Resume") if index > 0
  789.  
  790. while index < loopTime
  791.  
  792. $curMainLoopNum = index
  793.  
  794. $actionParamInput = "none"
  795. make30sSleep 1
  796.  
  797. waitsecond(2)
  798.  
  799. $actionParamInput = "none"
  800. clean_Home 1
  801.  
  802. waitsecond(2)
  803.  
  804. $actionParamInput = "none"
  805. contactCall 50
  806.  
  807. waitsecond(2)
  808.  
  809. $actionParamInput = "none"
  810. clean_Home 1
  811.  
  812. waitsecond(2)
  813.  
  814. $actionParamInput = "none"
  815. recentCall 50
  816.  
  817. waitsecond(2)
  818.  
  819. $actionParamInput = "none"
  820. clean_Home 1
  821.  
  822. waitsecond(2)
  823.  
  824. $actionParamInput = "none"
  825. answerCall 100
  826.  
  827. waitsecond(2)
  828.  
  829. $actionParamInput = "none"
  830. clean_Home 1
  831.  
  832. waitsecond(2)
  833.  
  834. $actionParamInput = "none"
  835. make_Clipboard_Text_160 1
  836.  
  837. waitsecond(2)
  838.  
  839. $actionParamInput = "none"
  840. sendSMS 50
  841.  
  842. waitsecond(2)
  843.  
  844. $actionParamInput = "none"
  845. clean_Home 1
  846.  
  847. waitsecond(2)
  848.  
  849. $actionParamInput = "none"
  850. open_SMS 50
  851.  
  852. waitsecond(2)
  853.  
  854. $actionParamInput = "none"
  855. clean_Home 1
  856.  
  857. waitsecond(2)
  858.  
  859. $actionParamInput = "none"
  860. excutePlayStore 20
  861.  
  862. waitsecond(2)
  863.  
  864. $actionParamInput = "none"
  865. clean_Home 1
  866.  
  867. waitsecond(2)
  868.  
  869. $actionParamInput = "none"
  870. downloadAppByPlayStore 10
  871.  
  872. waitsecond(2)
  873.  
  874. $actionParamInput = "none"
  875. clean_Home 1
  876.  
  877. waitsecond(2)
  878.  
  879. $actionParamInput = "none"
  880. closePlayStore 1
  881.  
  882. waitsecond(2)
  883.  
  884. $actionParamInput = "none"
  885. clean_Home 1
  886.  
  887. waitsecond(2)
  888.  
  889. $actionParamInput = "none"
  890. openDownloadedApp 20
  891.  
  892. waitsecond(2)
  893.  
  894. $actionParamInput = "none"
  895. clean_Home 1
  896.  
  897. waitsecond(2)
  898.  
  899. $actionParamInput = "none"
  900. deleteDownloadedApp 1
  901.  
  902. waitsecond(2)
  903.  
  904. $actionParamInput = "none"
  905. clean_Home 1
  906.  
  907. waitsecond(2)
  908.  
  909. $actionParamInput = "none"
  910. setAlarm_GotoApp 1
  911.  
  912. waitsecond(2)
  913.  
  914. $actionParamInput = "none"
  915. remove_Alarm_GotoApp 1
  916.  
  917. waitsecond(2)
  918.  
  919. $actionParamInput = "none"
  920. clean_Home 1
  921.  
  922. waitsecond(2)
  923.  
  924. $actionParamInput = "none"
  925. playMusic_GoogleMusic 20
  926.  
  927. waitsecond(2)
  928.  
  929. $actionParamInput = "none"
  930. shuffleMusic_GoogleMusic 50
  931.  
  932. waitsecond(2)
  933.  
  934. $actionParamInput = "none"
  935. stopMusic 1
  936.  
  937. waitsecond(2)
  938.  
  939. $actionParamInput = "none"
  940. clean_Home 1
  941.  
  942. waitsecond(2)
  943.  
  944. $actionParamInput = "none"
  945. APP_NAVI_GotoApp 1
  946.  
  947. waitsecond(2)
  948.  
  949. $actionParamInput = "none"
  950. clean_Home 1
  951.  
  952. waitsecond(2)
  953.  
  954. $actionParamInput = "none"
  955. wifiTurnOnOff_GotoApp 20
  956.  
  957. waitsecond(2)
  958.  
  959. $actionParamInput = "none"
  960. wifiConnect_GotoApp 0
  961.  
  962. waitsecond(2)
  963.  
  964. $actionParamInput = "none"
  965. clean_Home 1
  966.  
  967. waitsecond(2)
  968.  
  969. $actionParamInput = "none"
  970. On_Off_NFC 20
  971.  
  972. waitsecond(2)
  973.  
  974. $actionParamInput = "none"
  975. Clean_Device 1
  976.  
  977. waitsecond(2)
  978.  
  979.  
  980. sendStatus("Done::mainLoop::Loop::#{index}")
  981.  
  982.  
  983. writelog("Finish::Loop::#{$curMainLoopNum}")
  984.  
  985.  
  986. saveLogFileToGist if $saveLogToGist
  987.  
  988. index += 1
  989.  
  990. end
  991.  
  992. $engineStatus = "Idle"
  993. resetStatus
  994. sendStatus("Finish::mainLoop::END")
  995.  
  996. end
  997.  
  998. def self.answerCall(loopTime)
  999.  
  1000. tcase = TestCase.new("answerCall")
  1001.  
  1002. tcase << TestAction.new(:Check_Watch_Face) do
  1003. wakeUp
  1004. waitsecond(1)
  1005.  
  1006. pressMenu
  1007. waitsecond(1)
  1008.  
  1009. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  1010. $msg = "Watch Face Change Displaying...."
  1011. puts $msg
  1012. logcat($msg)
  1013. writelog($msg)
  1014. waitsecond(1)
  1015.  
  1016. pressHome
  1017.  
  1018. $msg = "pressHome >> Watch Face Escape "
  1019. puts $msg
  1020. logcat($msg)
  1021. writelog($msg)
  1022. waitsecond(1)
  1023. end
  1024.  
  1025. waitsecond(2)
  1026. end
  1027.  
  1028. tcase << TestAction.new(:LogStart) do
  1029. wakeUp
  1030. logStartTest("05_01_01_05_Telephony")
  1031.  
  1032. waitsecond(2)
  1033. end
  1034.  
  1035. tcase << TestAction.new(:Check_Temperature_Start) do
  1036. wakeUp
  1037.  
  1038. if uiObj("TextView").text("Temperature limit reached").exists
  1039. $msg = "=== AnswerCall Start Temperature limit Popup ==="
  1040. puts($msg)
  1041. logcat($msg)
  1042. writelog($msg)
  1043.  
  1044. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  1045. .with('uitreeindex', 3)
  1046. .with('classname', 'android.view.View')
  1047. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  1048.  
  1049. $ruiObj.click
  1050. end
  1051.  
  1052.  
  1053. waitsecond(2)
  1054. end
  1055.  
  1056. tcase << TestAction.new(:scriptAction_sendBTCmd_makeCall) do
  1057. sendBTCmd("makeCall('#{db('CallNumber')[0]}')")
  1058.  
  1059. waitsecond(2)
  1060. end
  1061.  
  1062. tcase << TestAction.new(:scriptAction_receiveCall_Wear) do
  1063. $res = false
  1064. for i in 0..25
  1065. puts "i = #{i}"
  1066. wakeUp
  1067. 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
  1068. $UIDev.pressKeyCode(5)
  1069. waitsecond(3)
  1070. puts "Receive Call OK"
  1071. end
  1072.  
  1073. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1074. $res = true
  1075. puts "Receive Call Loop Break"
  1076. else
  1077. waitsecond(3)
  1078. end
  1079.  
  1080. if ($res) then
  1081. puts "loop break"
  1082. break
  1083. end
  1084.  
  1085. if (i == 25)
  1086. sendBTCmd("endCall")
  1087. $myFailReason = "Call signal is not reached.::#{takeScreenShot}::screenshot saved"
  1088. $myTestResult = false
  1089. end
  1090. end
  1091.  
  1092. waitsecond(1)
  1093. end
  1094.  
  1095. tcase << TestAction.new(:scriptAction_endCall_Wear) do
  1096. wakeUp
  1097.  
  1098. $res = uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1099. if !$res
  1100. if uiObj("TextView").text("Call in progress").exists
  1101. if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists
  1102. swipe_vertical 20
  1103. waitsecond(2)
  1104. end
  1105. if uiObj("TextView").text("Swipe left to open.").exists
  1106. swipe_horizontal 10
  1107. waitsecond(2)
  1108. click(240,240)
  1109.  
  1110. if uiObj("TextView").text("Call from watch").exists
  1111. puts "Cancel call"
  1112. waitsecond(2)
  1113. gotoApp('Cancel call')
  1114. end
  1115. end
  1116. end
  1117. end
  1118.  
  1119. if $res
  1120. $UIDev.pressKeyCode(6)
  1121. puts "End Call OK"
  1122. elsif uiObj("TextView").text("Call options").exists
  1123. sendBTCmd("endCall")
  1124. waitsecond(2)
  1125.  
  1126. $UIDev.pressKeyCode(6)
  1127. end
  1128.  
  1129. waitsecond(2)
  1130. end
  1131.  
  1132. tcase << TestAction.new(:kill) do
  1133. wakeUp
  1134. waitsecond(1)
  1135. if uiObj("TextView").text("Call in progress").exists
  1136. waitsecond(2)
  1137. $msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved"
  1138. puts $msg
  1139. logcat($msg)
  1140. writelog($msg)
  1141. waitsecond(4)
  1142.  
  1143. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone")
  1144. waitsecond(5)
  1145. PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth")
  1146. waitsecond(5)
  1147. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth")
  1148. waitsecond(5)
  1149. wakeUp
  1150. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  1151. waitsecond(4)
  1152.  
  1153. pressKeyCode(4)
  1154. waitsecond(2)
  1155.  
  1156. wakeUp
  1157. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  1158. waitsecond(4)
  1159.  
  1160. for i in 0..5
  1161. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  1162. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  1163. break
  1164. else
  1165. waitsecond(1)
  1166. end
  1167. end
  1168.  
  1169. pressKeyCode(4)
  1170. waitsecond(2)
  1171. pressKeyCode(4)
  1172. waitsecond(2)
  1173.  
  1174. end
  1175.  
  1176.  
  1177.  
  1178. waitsecond(2)
  1179. end
  1180.  
  1181. tcase << TestAction.new(:LogStop) do
  1182. waitsecond(5)
  1183. logStopTest("05_01_01_05_Telephony")
  1184.  
  1185. waitsecond(1)
  1186. end
  1187.  
  1188. tcase << TestAction.new(:scriptAction_2) do
  1189. if !($myTestResult)
  1190. $myTestResult = true
  1191. wakeUp
  1192.  
  1193. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  1194. waitsecond(2)
  1195.  
  1196. $msg = "Run BTChatWear for turning on discover"
  1197. puts $msg
  1198. logcat($msg)
  1199. writelog($msg)
  1200. waitsecond(4)
  1201.  
  1202. pressKeyCode(4)
  1203. waitsecond(2)
  1204.  
  1205. wakeUp
  1206.  
  1207. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  1208. waitsecond(4)
  1209.  
  1210. for i in 0..5
  1211. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  1212. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  1213. waitsecond(2)
  1214. break
  1215. else
  1216. waitsecond(1)
  1217. end
  1218. end
  1219.  
  1220. pressKeyCode(4)
  1221. waitsecond(2)
  1222. pressKeyCode(4)
  1223. waitsecond(2)
  1224.  
  1225. for i in 0..20
  1226. wakeUp
  1227.  
  1228. PDGUiDevice.getInstance.execShellCmd("am start -n com.android.server.telecom/.components.UserCallActivity -a android.intent.action.CALL -d tel:#{db('CallNumber')[1,1]}")
  1229. waitsecond(5)
  1230.  
  1231. wakeUp
  1232. waitsecond(2)
  1233.  
  1234. if uiObj("TextView").text("Call from watch").exists
  1235. uiObj("TextView").text("Call from watch").clickAndWaitForNewWindow
  1236. waitsecond(2)
  1237. end
  1238.  
  1239. if uiObj("TextView").text("Choose calling device").exists
  1240. uiObj("TextView").text("Call from watch").clickAndWaitForNewWindow
  1241. waitsecond(2)
  1242. end
  1243.  
  1244. waitsecond(5)
  1245.  
  1246. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1247. $UIDev.pressKeyCode(6)
  1248. waitsecond(2)
  1249. break
  1250. end
  1251. end
  1252. end
  1253.  
  1254. waitsecond(2)
  1255. end
  1256.  
  1257. tcase << TestAction.new(:Check_Temperature_End) do
  1258. wakeUp
  1259.  
  1260. if uiObj("TextView").text("Temperature limit reached").exists
  1261. $msg = "=== AnswerCall End Temperature limit Popup ==="
  1262. puts($msg)
  1263. logcat($msg)
  1264. writelog($msg)
  1265.  
  1266. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  1267. .with('uitreeindex', 3)
  1268. .with('classname', 'android.view.View')
  1269. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  1270.  
  1271. $ruiObj.click
  1272. end
  1273.  
  1274.  
  1275. waitsecond(2)
  1276. end
  1277.  
  1278. tcase.run(loopTime)
  1279.  
  1280. end
  1281.  
  1282. def self.clean_Home(loopTime)
  1283.  
  1284. tcase = TestCase.new("clean_Home")
  1285.  
  1286. tcase << TestAction.new(:goto_Home) do
  1287. for i in 0..5
  1288. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  1289. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  1290. pressKeyCode(4)
  1291. waitsecond(1)
  1292. else
  1293. break
  1294. end
  1295. else
  1296. pressKeyCode(4)
  1297. waitsecond(1)
  1298. end
  1299. end
  1300.  
  1301. waitsecond(2)
  1302. end
  1303.  
  1304. tcase << TestAction.new(:clean_HomeScreen) do
  1305. wakeUp
  1306.  
  1307. for i in 0..5
  1308. swipe_vertical(20)
  1309. waitsecond(2)
  1310. swipe_horizontal_back 10
  1311. waitsecond(4)
  1312. end
  1313.  
  1314.  
  1315. waitsecond(2)
  1316. end
  1317.  
  1318. tcase << TestAction.new(:kill) do
  1319. wakeUp
  1320. waitsecond(1)
  1321.  
  1322. if uiObj("TextView").text("Call in progress").exists
  1323. waitsecond(2)
  1324. $msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved"
  1325. puts $msg
  1326. logcat($msg)
  1327. writelog($msg)
  1328. waitsecond(4)
  1329.  
  1330. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone")
  1331. waitsecond(5)
  1332. PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth")
  1333. waitsecond(5)
  1334. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth")
  1335. waitsecond(5)
  1336. wakeUp
  1337. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  1338. waitsecond(4)
  1339.  
  1340. pressKeyCode(4)
  1341. waitsecond(2)
  1342.  
  1343. wakeUp
  1344. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  1345. waitsecond(4)
  1346.  
  1347. for i in 0..5
  1348. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  1349. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  1350. break
  1351. else
  1352. waitsecond(1)
  1353. end
  1354. end
  1355.  
  1356. pressKeyCode(4)
  1357. waitsecond(2)
  1358. pressKeyCode(4)
  1359. waitsecond(2)
  1360.  
  1361. end
  1362.  
  1363. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/title").exists
  1364. pressKeyCode(4)
  1365. waitsecond(1)
  1366. end
  1367.  
  1368.  
  1369. waitsecond(2)
  1370. end
  1371.  
  1372. tcase.run(loopTime)
  1373.  
  1374. end
  1375.  
  1376. def self.closePlayStore(loopTime)
  1377.  
  1378. tcase = TestCase.new("closePlayStore")
  1379.  
  1380. tcase << TestAction.new(:LogStart) do
  1381. logStartTest("05_01_05_04_StoreFrontDownload")
  1382.  
  1383. waitsecond(2)
  1384. end
  1385.  
  1386. tcase << TestAction.new(:pressMenu) do
  1387. for i in 0..5
  1388. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  1389. break
  1390. else
  1391. pressKeyCode(4)
  1392. waitsecond(1)
  1393. end
  1394. end
  1395.  
  1396. waitsecond(2)
  1397. end
  1398.  
  1399. tcase << TestAction.new(:gotoApp) do
  1400. gotoApp('Play Store')
  1401.  
  1402. waitsecond(2)
  1403. end
  1404.  
  1405. tcase << TestAction.new(:Button_Button1_1) do
  1406. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  1407. .with('uitreeindex', 1)
  1408. .with('classname', 'Button')
  1409. .with('resource-id', 'android:id/button1')
  1410. .with('text', 'YES IM IN')
  1411.  
  1412. $ruiObj.isExist
  1413. ifFailJumpTo(:scriptAction_check_PlayStore)
  1414.  
  1415. waitsecond(2)
  1416. end
  1417.  
  1418. tcase << TestAction.new(:Button_Button1_2) do
  1419. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  1420. .with('uitreeindex', 1)
  1421. .with('classname', 'Button')
  1422. .with('resource-id', 'android:id/button1')
  1423. .with('text', 'YES IM IN')
  1424.  
  1425. $ruiObj.click
  1426.  
  1427. waitsecond(2)
  1428. end
  1429.  
  1430. tcase << TestAction.new(:scriptAction_check_PlayStore) do
  1431. for i in 0..9
  1432. waitsecond(3)
  1433.  
  1434. if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists
  1435. break
  1436. elsif i == 9
  1437. $myFailReason = "PlayStore Open 30s timeout"
  1438. $myTestResult = false
  1439. end
  1440. end
  1441.  
  1442. waitsecond(2)
  1443. end
  1444.  
  1445. tcase << TestAction.new(:LogStop) do
  1446. wakeUp
  1447. logStopTest("05_01_05_04_StoreFrontDownload")
  1448.  
  1449. waitsecond(2)
  1450. if !($myTestResult)
  1451. $myTestResult = true
  1452. end
  1453.  
  1454. waitsecond(2)
  1455. end
  1456.  
  1457. tcase << TestAction.new(:goto_Home) do
  1458. for i in 0..5
  1459. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  1460. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  1461. pressKeyCode(4)
  1462. waitsecond(1)
  1463. else
  1464. break
  1465. end
  1466. else
  1467. pressKeyCode(4)
  1468. waitsecond(1)
  1469. end
  1470. end
  1471.  
  1472. waitsecond(2)
  1473. end
  1474.  
  1475. tcase.run(loopTime)
  1476.  
  1477. end
  1478.  
  1479. def self.contactCall(loopTime)
  1480.  
  1481. tcase = TestCase.new("contactCall")
  1482.  
  1483. tcase << TestAction.new(:scriptAction_setUp) do
  1484. wakeUp
  1485. logStartTest("05_01_01_03_Telephony")
  1486.  
  1487. waitsecond(2)
  1488. end
  1489.  
  1490. tcase << TestAction.new(:Check_Temperature_Start) do
  1491. wakeUp
  1492.  
  1493. if uiObj("TextView").text("Temperature limit reached").exists
  1494. $msg = "=== RecentCall Start Temperature limit Popup ==="
  1495. puts($msg)
  1496. logcat($msg)
  1497. writelog($msg)
  1498.  
  1499. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  1500. .with('uitreeindex', 3)
  1501. .with('classname', 'android.view.View')
  1502. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  1503.  
  1504. $ruiObj.click
  1505. end
  1506.  
  1507.  
  1508. waitsecond(2)
  1509. end
  1510.  
  1511. tcase << TestAction.new(:pressMenu) do
  1512. for i in 0..5
  1513. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  1514. break
  1515. else
  1516. pressKeyCode(4)
  1517. waitsecond(1)
  1518. end
  1519. end
  1520.  
  1521. waitsecond(2)
  1522. end
  1523.  
  1524. tcase << TestAction.new(:gotoApp) do
  1525. gotoApp('Contacts')
  1526.  
  1527. waitsecond(2)
  1528. end
  1529.  
  1530. tcase << TestAction.new(:ImageButton_ContactsSearchButton_1) do
  1531. $ruiObj = RUIObject.new.with('objectid', 1237252139).with('selfid', -1766224739).with('textdescid', -299889323).with('uniqueparentid', 0)
  1532. .with('uitreeindex', 6)
  1533. .with('classname', 'ImageButton')
  1534. .with('resource-id', 'com.google.android.wearable.app:id/contacts_search_button')
  1535.  
  1536. $ruiObj.click
  1537.  
  1538. waitsecond(4)
  1539. end
  1540.  
  1541. tcase << TestAction.new(:View_ImeChoice_1) do
  1542. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  1543. .with('uitreeindex', 2)
  1544. .with('classname', 'android.view.View')
  1545. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  1546.  
  1547. $ruiObj.click
  1548.  
  1549. waitsecond(4)
  1550. end
  1551.  
  1552. tcase << TestAction.new(:scriptAction_inputSearchName_1) do
  1553. a = ($curLoopNum+1) / 10
  1554. b = ($curLoopNum+1) - (a * 10)
  1555. pressKeyCode(7 + a)
  1556. pressKeyCode(7 + b)
  1557.  
  1558. waitsecond(1)
  1559. click(338,73)
  1560.  
  1561.  
  1562. waitsecond(2)
  1563. end
  1564.  
  1565. tcase << TestAction.new(:TextView_ContactPhoto_1) do
  1566. $ruiObj = RUIObject.new.with('objectid', 96148669).with('selfid', 741655928).with('textdescid', -1314358525).with('uniqueparentid', 0)
  1567. .with('uitreeindex', 0)
  1568. .with('classname', 'TextView')
  1569. .with('resource-id', 'com.google.android.wearable.app:id/contact_photo')
  1570.  
  1571. $ruiObj.isNotExist
  1572. ifFailJumpTo(:TextView_ContactPhoto_2)
  1573.  
  1574. waitsecond(2)
  1575. end
  1576.  
  1577. tcase << TestAction.new(:ImageButton_ContactsSearchButton_2) do
  1578. $ruiObj = RUIObject.new.with('objectid', 1237252139).with('selfid', -1766224739).with('textdescid', -299889323).with('uniqueparentid', 0)
  1579. .with('uitreeindex', 1)
  1580. .with('classname', 'ImageButton')
  1581. .with('resource-id', 'com.google.android.wearable.app:id/contacts_search_button')
  1582.  
  1583. $ruiObj.click
  1584.  
  1585. waitsecond(4)
  1586. end
  1587.  
  1588. tcase << TestAction.new(:View_ImeChoice_2) do
  1589. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  1590. .with('uitreeindex', 2)
  1591. .with('classname', 'android.view.View')
  1592. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  1593.  
  1594. $ruiObj.click
  1595.  
  1596. waitsecond(4)
  1597. end
  1598.  
  1599. tcase << TestAction.new(:scriptAction_inputSearchName_2) do
  1600. a = 1 / 10
  1601. b = 1 - (a * 10)
  1602. pressKeyCode(7 + a)
  1603. pressKeyCode(7 + b)
  1604.  
  1605. waitsecond(1)
  1606. click(338,73)
  1607.  
  1608. waitsecond(2)
  1609. end
  1610.  
  1611. tcase << TestAction.new(:TextView_ContactPhoto_2) do
  1612. $ruiObj = RUIObject.new.with('objectid', 96148669).with('selfid', 741655928).with('textdescid', -1314358525).with('uniqueparentid', 0)
  1613. .with('uitreeindex', 0)
  1614. .with('classname', 'TextView')
  1615. .with('resource-id', 'com.google.android.wearable.app:id/contact_photo')
  1616.  
  1617. $ruiObj.isExist
  1618. ifFailJumpTo(:scriptAction_endCall_Wear)
  1619.  
  1620. waitsecond(1)
  1621. end
  1622.  
  1623. tcase << TestAction.new(:TextView_ContactPhoto_3) do
  1624. $ruiObj = RUIObject.new.with('objectid', 96148669).with('selfid', 741655928).with('textdescid', -1314358525).with('uniqueparentid', 0)
  1625. .with('uitreeindex', 0)
  1626. .with('classname', 'TextView')
  1627. .with('resource-id', 'com.google.android.wearable.app:id/contact_photo')
  1628.  
  1629. $ruiObj.click
  1630.  
  1631. waitsecond(2)
  1632. end
  1633.  
  1634. tcase << TestAction.new(:TextView_ContactMethodRow2_1) do
  1635. $ruiObj = RUIObject.new.with('objectid', 1816082740).with('selfid', 1316856062).with('textdescid', -1069384526).with('uniqueparentid', 0)
  1636. .with('uitreeindex', 2)
  1637. .with('classname', 'TextView')
  1638. .with('resource-id', 'com.google.android.wearable.app:id/contact_method_row2')
  1639. .with('text', 'Mobile')
  1640.  
  1641. $ruiObj.isExist
  1642. ifFailJumpTo(:scriptAction_endCall_Wear)
  1643.  
  1644. waitsecond(1)
  1645. end
  1646.  
  1647. tcase << TestAction.new(:TextView_ContactMethodRow2_2) do
  1648. $ruiObj = RUIObject.new.with('objectid', 1816082740).with('selfid', 1316856062).with('textdescid', -1069384526).with('uniqueparentid', 0)
  1649. .with('uitreeindex', 2)
  1650. .with('classname', 'TextView')
  1651. .with('resource-id', 'com.google.android.wearable.app:id/contact_method_row2')
  1652. .with('text', 'Mobile')
  1653.  
  1654. $ruiObj.click
  1655.  
  1656. waitsecond(2)
  1657. end
  1658.  
  1659. tcase << TestAction.new(:ImageView_Action_1) do
  1660. $ruiObj = RUIObject.new.with('objectid', -1056937129).with('selfid', 1865264606).with('textdescid', 1594687401).with('uniqueparentid', 0)
  1661. .with('uitreeindex', 13)
  1662. .with('classname', 'ImageView')
  1663. .with('resource-id', 'com.google.android.apps.wearable.phone:id/action')
  1664.  
  1665. $ruiObj.isExist
  1666. ifFailJumpTo(:scriptAction_endCall_Wear)
  1667.  
  1668. waitsecond(1)
  1669. end
  1670.  
  1671. tcase << TestAction.new(:ImageView_Action_2) do
  1672. $ruiObj = RUIObject.new.with('objectid', -1056937129).with('selfid', 1865264606).with('textdescid', 1594687401).with('uniqueparentid', 0)
  1673. .with('uitreeindex', 13)
  1674. .with('classname', 'ImageView')
  1675. .with('resource-id', 'com.google.android.apps.wearable.phone:id/action')
  1676.  
  1677. $ruiObj.click
  1678.  
  1679. waitsecond(2)
  1680. end
  1681.  
  1682. tcase << TestAction.new(:scriptAction_sendBTCmd_answerCall) do
  1683. for i in 0..20
  1684. waitsecond(2)
  1685.  
  1686. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1687. sendBTCmd("answerCall")
  1688. waitsecond(5)
  1689.  
  1690. $res = uiObj("TextView").text("Watch calling").exists
  1691. elsif uiObj("TextView").text("Swipe left to open.").exists
  1692. swipe_horizontal 10
  1693. waitsecond(2)
  1694. $res = uiObj("TextView").text("Watch calling").exists
  1695. elsif uiObj("TextView").text("Call in progress").exists
  1696. if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists
  1697. swipe_vertical 20
  1698. waitsecond(2)
  1699. end
  1700. if uiObj("TextView").text("Swipe left to open.").exists
  1701. swipe_horizontal 10
  1702. waitsecond(2)
  1703.  
  1704. click(240,240)
  1705. waitsecond(2)
  1706.  
  1707. if !uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists and uiObj("TextView").text("Call from watch").exists
  1708. puts "Call from watch"
  1709. gotoApp('watch')
  1710. waitsecond(2)
  1711. end
  1712. end
  1713.  
  1714. waitsecond(2)
  1715.  
  1716. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1717. sendBTCmd("answerCall")
  1718. waitsecond(2)
  1719. $res = uiObj("TextView").text("dialing").exists
  1720. elsif not uiObj("TextView").text("dialing").exists
  1721. $res = true
  1722. else
  1723. $res = true
  1724. $myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved"
  1725. $myTestResult = false
  1726. end
  1727. elsif (i == 20)
  1728. $myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved"
  1729. $myTestResult = false
  1730. else
  1731. waitsecond(2)
  1732. end
  1733.  
  1734. if !$res
  1735. puts "Answer Call OK"
  1736. break
  1737. end
  1738. end
  1739.  
  1740. waitsecond(2)
  1741. end
  1742.  
  1743. tcase << TestAction.new(:scriptAction_endCall_Wear) do
  1744. wakeUp
  1745.  
  1746. $res = uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1747.  
  1748. if uiObj("TextView").text("Swipe left to open.").exists
  1749. swipe_horizontal 10
  1750. waitsecond(2)
  1751.  
  1752. $res = uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  1753. end
  1754.  
  1755. if !$res
  1756. puts "Not exist Hangup"
  1757. if uiObj("TextView").text("Call in progress").exists
  1758. if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists
  1759. swipe_vertical 20
  1760. waitsecond(2)
  1761. end
  1762. if uiObj("TextView").text("Swipe left to open.").exists
  1763. swipe_horizontal 10
  1764. waitsecond(2)
  1765. click(240,240)
  1766. end
  1767. end
  1768. end
  1769.  
  1770.  
  1771. if $res
  1772. $UIDev.pressKeyCode(6)
  1773. puts "End Call OK"
  1774. else
  1775. $UIDev.pressKeyCode(6)
  1776.  
  1777. sendBTCmd("endCall")
  1778. $myFailReason = "Cannot make a Call to phone."
  1779. $myTestResult = false
  1780. end
  1781.  
  1782. waitsecond(2)
  1783. end
  1784.  
  1785. tcase << TestAction.new(:kill) do
  1786. wakeUp
  1787. waitsecond(1)
  1788. if uiObj("TextView").text("Call in progress").exists
  1789. waitsecond(2)
  1790. $msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved"
  1791. puts $msg
  1792. logcat($msg)
  1793. writelog($msg)
  1794. waitsecond(4)
  1795.  
  1796. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone")
  1797. waitsecond(5)
  1798. PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth")
  1799. waitsecond(5)
  1800. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth")
  1801. waitsecond(5)
  1802. wakeUp
  1803. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  1804. waitsecond(4)
  1805.  
  1806. pressKeyCode(4)
  1807. waitsecond(2)
  1808.  
  1809. wakeUp
  1810. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  1811. waitsecond(4)
  1812.  
  1813. for i in 0..5
  1814. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  1815. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  1816. break
  1817. else
  1818. waitsecond(1)
  1819. end
  1820. end
  1821.  
  1822. pressKeyCode(4)
  1823. waitsecond(2)
  1824. pressKeyCode(4)
  1825. waitsecond(2)
  1826.  
  1827. end
  1828.  
  1829.  
  1830.  
  1831. waitsecond(2)
  1832. end
  1833.  
  1834. tcase << TestAction.new(:scriptAction_logStop) do
  1835. waitsecond(5)
  1836. logStopTest("05_01_01_03_Telephony")
  1837.  
  1838.  
  1839. waitsecond(1)
  1840. end
  1841.  
  1842. tcase << TestAction.new(:scriptAction_BTChatWear_Discover) do
  1843. if !($myTestResult)
  1844. $myTestResult = true
  1845. wakeUp
  1846. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  1847.  
  1848. $msg = "Run BTChatWear for turning on discover"
  1849. puts $msg
  1850. logcat($msg)
  1851. writelog($msg)
  1852. waitsecond(4)
  1853.  
  1854. pressKeyCode(4)
  1855. waitsecond(2)
  1856.  
  1857. wakeUp
  1858. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  1859. waitsecond(4)
  1860.  
  1861. for i in 0..5
  1862. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  1863. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  1864. break
  1865. else
  1866. waitsecond(1)
  1867. end
  1868. end
  1869.  
  1870. pressKeyCode(4)
  1871. waitsecond(2)
  1872. pressKeyCode(4)
  1873. waitsecond(2)
  1874. end
  1875.  
  1876. waitsecond(2)
  1877. end
  1878.  
  1879. tcase << TestAction.new(:Check_Temperature_End) do
  1880. wakeUp
  1881.  
  1882. if uiObj("TextView").text("Temperature limit reached").exists
  1883. $msg = "=== RecentCall End Temperature limit Popup ==="
  1884. puts($msg)
  1885. logcat($msg)
  1886. writelog($msg)
  1887.  
  1888. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  1889. .with('uitreeindex', 3)
  1890. .with('classname', 'android.view.View')
  1891. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  1892.  
  1893. $ruiObj.click
  1894. end
  1895.  
  1896.  
  1897. waitsecond(2)
  1898. end
  1899.  
  1900. tcase << TestAction.new(:goto_Home) do
  1901. for i in 0..5
  1902. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  1903. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  1904. pressKeyCode(4)
  1905. waitsecond(1)
  1906. else
  1907. break
  1908. end
  1909. else
  1910. pressKeyCode(4)
  1911. waitsecond(1)
  1912. end
  1913. end
  1914.  
  1915. waitsecond(2)
  1916. end
  1917.  
  1918. tcase.run(loopTime)
  1919.  
  1920. end
  1921.  
  1922. def self.deleteDownloadedApp(loopTime)
  1923.  
  1924. tcase = TestCase.new("deleteDownloadedApp")
  1925.  
  1926. tcase << TestAction.new(:LogStart) do
  1927. logStartTest("05_01_05_08_StoreFrontDownload")
  1928.  
  1929. waitsecond(2)
  1930. end
  1931.  
  1932. tcase << TestAction.new(:pressMenu) do
  1933. for i in 0..5
  1934. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  1935. break
  1936. else
  1937. pressKeyCode(4)
  1938. waitsecond(1)
  1939. end
  1940. end
  1941.  
  1942. waitsecond(2)
  1943. end
  1944.  
  1945. tcase << TestAction.new(:gotoApp) do
  1946. gotoApp('Play Store')
  1947.  
  1948. waitsecond(2)
  1949. end
  1950.  
  1951. tcase << TestAction.new(:Button_Button1_1) do
  1952. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  1953. .with('uitreeindex', 1)
  1954. .with('classname', 'Button')
  1955. .with('resource-id', 'android:id/button1')
  1956. .with('text', 'YES IM IN')
  1957.  
  1958. $ruiObj.isExist
  1959. ifFailJumpTo(:scriptAction_Check_PlayStore)
  1960.  
  1961. waitsecond(2)
  1962. end
  1963.  
  1964. tcase << TestAction.new(:Button_Button1_2) do
  1965. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  1966. .with('uitreeindex', 1)
  1967. .with('classname', 'Button')
  1968. .with('resource-id', 'android:id/button1')
  1969. .with('text', 'YES IM IN')
  1970.  
  1971. $ruiObj.click
  1972.  
  1973. waitsecond(2)
  1974. end
  1975.  
  1976. tcase << TestAction.new(:scriptAction_Check_PlayStore) do
  1977. for i in 0..9
  1978. waitsecond(3)
  1979.  
  1980. if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists
  1981. break
  1982. elsif i == 9
  1983. $myFailReason = "PlayStore Open 30s timeout"
  1984. $myTestResult = false
  1985. end
  1986. end
  1987.  
  1988. waitsecond(2)
  1989. end
  1990.  
  1991. tcase << TestAction.new(:ImageView_SearchIcon_1) do
  1992. $ruiObj = RUIObject.new.with('objectid', -2102339713).with('selfid', -136350747).with('textdescid', -748021631).with('uniqueparentid', 0)
  1993. .with('uitreeindex', 0)
  1994. .with('classname', 'ImageView')
  1995. .with('resource-id', 'com.android.vending:id/search_icon')
  1996.  
  1997. $ruiObj.isExist
  1998. ifFailJumpTo(:LogStop)
  1999.  
  2000. waitsecond(2)
  2001. end
  2002.  
  2003. tcase << TestAction.new(:ImageView_SearchIcon_2) do
  2004. $ruiObj = RUIObject.new.with('objectid', -2102339713).with('selfid', -136350747).with('textdescid', -748021631).with('uniqueparentid', 0)
  2005. .with('uitreeindex', 0)
  2006. .with('classname', 'ImageView')
  2007. .with('resource-id', 'com.android.vending:id/search_icon')
  2008.  
  2009. $ruiObj.click
  2010.  
  2011. waitsecond(2)
  2012. end
  2013.  
  2014. tcase << TestAction.new(:View_ImeChoice) do
  2015. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  2016. .with('uitreeindex', 1)
  2017. .with('classname', 'android.view.View')
  2018. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  2019.  
  2020. $ruiObj.click
  2021.  
  2022. waitsecond(4)
  2023. end
  2024.  
  2025. tcase << TestAction.new(:scriptAction_Input_AppName_Calculator) do
  2026. pressKeyCode(31)
  2027. pressKeyCode(29)
  2028. pressKeyCode(40)
  2029. pressKeyCode(31)
  2030. pressKeyCode(49)
  2031. pressKeyCode(40)
  2032. pressKeyCode(29)
  2033. pressKeyCode(48)
  2034. pressKeyCode(43)
  2035. pressKeyCode(46)
  2036.  
  2037. waitsecond(1)
  2038. click(338,73)
  2039.  
  2040. waitsecond(8)
  2041. end
  2042.  
  2043. tcase << TestAction.new(:gotoApp_1) do
  2044. gotoApp('Google Inc.')
  2045.  
  2046. waitsecond(2)
  2047. end
  2048.  
  2049. tcase << TestAction.new(:scriptAction_Input_AppName_Colornote) do
  2050.  
  2051. if rand(100) < 0
  2052.  
  2053. pressKeyCode(31)
  2054. pressKeyCode(43)
  2055. pressKeyCode(40)
  2056. pressKeyCode(43)
  2057. pressKeyCode(46)
  2058. pressKeyCode(42)
  2059. pressKeyCode(43)
  2060. pressKeyCode(48)
  2061. pressKeyCode(33)
  2062.  
  2063. pressKeyCode(62)
  2064.  
  2065. pressKeyCode(42)
  2066. pressKeyCode(43)
  2067. pressKeyCode(48)
  2068. pressKeyCode(33)
  2069. pressKeyCode(44)
  2070. pressKeyCode(29)
  2071. pressKeyCode(32)
  2072.  
  2073. pressKeyCode(62)
  2074.  
  2075. pressKeyCode(42)
  2076. pressKeyCode(43)
  2077. pressKeyCode(48)
  2078. pressKeyCode(33)
  2079. pressKeyCode(47)
  2080.  
  2081. waitsecond(1)
  2082. click(338,73)
  2083.  
  2084. waitsecond(8)
  2085.  
  2086. end
  2087.  
  2088. end
  2089.  
  2090. tcase << TestAction.new(:TextView_LiTitle_1) do
  2091.  
  2092. if rand(100) < 0
  2093.  
  2094. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2095. .with('uitreeindex', 2)
  2096. .with('classname', 'TextView')
  2097. .with('resource-id', 'com.android.vending:id/li_title')
  2098. .with('text', 'ColorNote Notepad Notes')
  2099.  
  2100. $ruiObj.isNotExist
  2101. ifFailJumpTo(:TextView_LiTitle_3)
  2102.  
  2103. waitsecond(2)
  2104.  
  2105. end
  2106.  
  2107. end
  2108.  
  2109. tcase << TestAction.new(:scriptAction_Check_SearchApp) do
  2110.  
  2111. if rand(100) < 0
  2112.  
  2113. $myFailReason = "Can not search Application"
  2114. $myTestResult = false
  2115.  
  2116. waitsecond(2)
  2117.  
  2118. end
  2119.  
  2120. end
  2121.  
  2122. tcase << TestAction.new(:TextView_LiTitle_2) do
  2123.  
  2124. if rand(100) < 0
  2125.  
  2126. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2127. .with('uitreeindex', 2)
  2128. .with('classname', 'TextView')
  2129. .with('resource-id', 'com.android.vending:id/li_title')
  2130. .with('text', 'ColorNote Notepad Notes')
  2131.  
  2132. $ruiObj.isExist
  2133. ifFailJumpTo(:LogStop)
  2134.  
  2135. waitsecond(2)
  2136.  
  2137. end
  2138.  
  2139. end
  2140.  
  2141. tcase << TestAction.new(:TextView_LiTitle_3) do
  2142.  
  2143. if rand(100) < 0
  2144.  
  2145. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2146. .with('uitreeindex', 2)
  2147. .with('classname', 'TextView')
  2148. .with('resource-id', 'com.android.vending:id/li_title')
  2149. .with('text', 'ColorNote Notepad Notes')
  2150.  
  2151. $ruiObj.click
  2152.  
  2153. waitsecond(2)
  2154.  
  2155. end
  2156.  
  2157. end
  2158.  
  2159. tcase << TestAction.new(:TextView_ButtonText_Install_1) do
  2160. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2161. .with('uitreeindex', 6)
  2162. .with('classname', 'TextView')
  2163. .with('resource-id', 'com.android.vending:id/button_text')
  2164. .with('text', 'Install')
  2165.  
  2166. $ruiObj.isExist
  2167. ifFailJumpTo(:TextView_ButtonText_Uninstall_1)
  2168.  
  2169. waitsecond(2)
  2170. end
  2171.  
  2172. tcase << TestAction.new(:TextView_ButtonText_Install_2) do
  2173. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2174. .with('uitreeindex', 6)
  2175. .with('classname', 'TextView')
  2176. .with('resource-id', 'com.android.vending:id/button_text')
  2177. .with('text', 'Install')
  2178.  
  2179. $ruiObj.click
  2180.  
  2181. waitsecond(2)
  2182. end
  2183.  
  2184. tcase << TestAction.new(:TextView_ButtonText_Accept_1) do
  2185. $ruiObj = RUIObject.new.with('objectid', 1812252228).with('selfid', -974229815).with('textdescid', -1858510308).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2186. .with('uitreeindex', 7)
  2187. .with('classname', 'TextView')
  2188. .with('resource-id', 'com.android.vending:id/button_text')
  2189. .with('text', 'Accept')
  2190.  
  2191. $ruiObj.isExist
  2192. ifFailJumpTo(:scriptAction_Check_InstallComplete_1)
  2193.  
  2194. waitsecond(2)
  2195. end
  2196.  
  2197. tcase << TestAction.new(:TextView_ButtonText_Accept_2) do
  2198. $ruiObj = RUIObject.new.with('objectid', 1812252228).with('selfid', -974229815).with('textdescid', -1858510308).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2199. .with('uitreeindex', 7)
  2200. .with('classname', 'TextView')
  2201. .with('resource-id', 'com.android.vending:id/button_text')
  2202. .with('text', 'Accept')
  2203.  
  2204. $ruiObj.click
  2205.  
  2206. waitsecond(2)
  2207. end
  2208.  
  2209. tcase << TestAction.new(:scriptAction_Check_InstallComplete_1) do
  2210. for i in 0..17
  2211. wakeUp
  2212. waitsecond(5)
  2213.  
  2214. if uiObj("TextView").text("Uninstall").exists
  2215. break
  2216. elsif i == 17
  2217. $myFailReason = "Application install 1m30s timeout"
  2218. $myTestResult = false
  2219. end
  2220. end
  2221.  
  2222. waitsecond(2)
  2223. end
  2224.  
  2225. tcase << TestAction.new(:TextView_ButtonText_Downloading_1) do
  2226. $ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0)
  2227. .with('uitreeindex', 6)
  2228. .with('classname', 'TextView')
  2229. .with('resource-id', 'com.android.vending:id/button_text')
  2230. .with('text', 'Downloading')
  2231.  
  2232. $ruiObj.isExist
  2233. ifFailJumpTo(:TextView_ButtonText_Uninstall_1)
  2234.  
  2235. waitsecond(2)
  2236. end
  2237.  
  2238. tcase << TestAction.new(:TextView_ButtonText_Downloading_2) do
  2239. $ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0)
  2240. .with('uitreeindex', 6)
  2241. .with('classname', 'TextView')
  2242. .with('resource-id', 'com.android.vending:id/button_text')
  2243. .with('text', 'Downloading')
  2244.  
  2245. $ruiObj.click
  2246.  
  2247. waitsecond(2)
  2248. end
  2249.  
  2250. tcase << TestAction.new(:TextView_ButtonText_Uninstall_1) do
  2251. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2252. .with('uitreeindex', 6)
  2253. .with('classname', 'TextView')
  2254. .with('resource-id', 'com.android.vending:id/button_text')
  2255. .with('text', 'Uninstall')
  2256.  
  2257. $ruiObj.isNotExist
  2258. ifFailJumpTo(:TextView_ButtonText_Uninstall_3)
  2259.  
  2260. waitsecond(2)
  2261. end
  2262.  
  2263. tcase << TestAction.new(:scriptAction_Check_UninstallApp_1) do
  2264. $myFailReason = "Can not Uninstall Application - 1"
  2265. $myTestResult = false
  2266.  
  2267. waitsecond(2)
  2268. end
  2269.  
  2270. tcase << TestAction.new(:TextView_ButtonText_Uninstall_2) do
  2271. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2272. .with('uitreeindex', 6)
  2273. .with('classname', 'TextView')
  2274. .with('resource-id', 'com.android.vending:id/button_text')
  2275. .with('text', 'Uninstall')
  2276.  
  2277. $ruiObj.isExist
  2278. ifFailJumpTo(:LogStop)
  2279.  
  2280. waitsecond(2)
  2281. end
  2282.  
  2283. tcase << TestAction.new(:TextView_ButtonText_Uninstall_3) do
  2284. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2285. .with('uitreeindex', 6)
  2286. .with('classname', 'TextView')
  2287. .with('resource-id', 'com.android.vending:id/button_text')
  2288. .with('text', 'Uninstall')
  2289.  
  2290. $ruiObj.click
  2291.  
  2292. waitsecond(2)
  2293. end
  2294.  
  2295. tcase << TestAction.new(:wait8second) do
  2296. if !($myTestResult)
  2297. $myTestResult = true
  2298. end
  2299. waitsecond(8)
  2300. end
  2301.  
  2302. tcase << TestAction.new(:TextView_ButtonText_Install_3) do
  2303. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2304. .with('uitreeindex', 6)
  2305. .with('classname', 'TextView')
  2306. .with('resource-id', 'com.android.vending:id/button_text')
  2307. .with('text', 'Install')
  2308.  
  2309. $ruiObj.isNotExist
  2310. ifFailJumpTo(:LogStop)
  2311.  
  2312. waitsecond(2)
  2313. end
  2314.  
  2315. tcase << TestAction.new(:scriptAction_Check_UninstallApp_2) do
  2316. $myFailReason = "Can not Uninstall Application - 2"
  2317. $myTestResult = false
  2318.  
  2319. waitsecond(2)
  2320. end
  2321.  
  2322. tcase << TestAction.new(:LogStop) do
  2323. wakeUp
  2324. logStopTest("05_01_05_08_StoreFrontDownload")
  2325.  
  2326. waitsecond(2)
  2327. if !($myTestResult)
  2328. $myTestResult = true
  2329. end
  2330.  
  2331. waitsecond(2)
  2332. end
  2333.  
  2334. tcase << TestAction.new(:goto_Home) do
  2335. for i in 0..5
  2336. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  2337. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  2338. pressKeyCode(4)
  2339. waitsecond(1)
  2340. else
  2341. break
  2342. end
  2343. else
  2344. pressKeyCode(4)
  2345. waitsecond(1)
  2346. end
  2347. end
  2348.  
  2349. waitsecond(2)
  2350. end
  2351.  
  2352. tcase << TestAction.new(:TextView_Text_Successfully) do
  2353. $ruiObj = RUIObject.new.with('objectid', 1472509444).with('selfid', 1035549449).with('textdescid', 753694147).with('uniqueparentid', 0)
  2354. .with('uitreeindex', 4)
  2355. .with('classname', 'TextView')
  2356. .with('resource-id', 'com.google.android.wearable.app:id/text')
  2357. .with('text', 'Successfully installed')
  2358.  
  2359. $ruiObj.isExist
  2360. ifFailJumpTo(:scriptAction_End)
  2361.  
  2362. waitsecond(2)
  2363. end
  2364.  
  2365. tcase << TestAction.new(:scriptAction_removePopUp) do
  2366. swipe_horizontal_back 10
  2367.  
  2368. waitsecond(2)
  2369. end
  2370.  
  2371. tcase << TestAction.new(:scriptAction_End) do
  2372.  
  2373.  
  2374. waitsecond(1)
  2375. end
  2376.  
  2377. tcase.run(loopTime)
  2378.  
  2379. end
  2380.  
  2381. def self.downloadAppByPlayStore(loopTime)
  2382.  
  2383. tcase = TestCase.new("downloadAppByPlayStore")
  2384.  
  2385. tcase << TestAction.new(:LogStart) do
  2386. logStartTest("05_01_05_03_StoreFrontDownload")
  2387.  
  2388. waitsecond(2)
  2389. end
  2390.  
  2391. tcase << TestAction.new(:pressMenu) do
  2392. for i in 0..5
  2393. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  2394. break
  2395. else
  2396. pressKeyCode(4)
  2397. waitsecond(1)
  2398. end
  2399. end
  2400.  
  2401. waitsecond(2)
  2402. end
  2403.  
  2404. tcase << TestAction.new(:gotoApp) do
  2405. gotoApp('Play Store')
  2406.  
  2407. waitsecond(2)
  2408. end
  2409.  
  2410. tcase << TestAction.new(:Button_Button1_1) do
  2411. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2412. .with('uitreeindex', 1)
  2413. .with('classname', 'Button')
  2414. .with('resource-id', 'android:id/button1')
  2415. .with('text', 'YES IM IN')
  2416.  
  2417. $ruiObj.isExist
  2418. ifFailJumpTo(:scriptAction_Check_PlayStore)
  2419.  
  2420. waitsecond(2)
  2421. end
  2422.  
  2423. tcase << TestAction.new(:Button_Button1_2) do
  2424. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2425. .with('uitreeindex', 1)
  2426. .with('classname', 'Button')
  2427. .with('resource-id', 'android:id/button1')
  2428. .with('text', 'YES IM IN')
  2429.  
  2430. $ruiObj.click
  2431.  
  2432. waitsecond(2)
  2433. end
  2434.  
  2435. tcase << TestAction.new(:scriptAction_Check_PlayStore) do
  2436. for i in 0..9
  2437. waitsecond(3)
  2438.  
  2439. if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists
  2440. break
  2441. elsif i == 9
  2442. $myFailReason = "PlayStore Open 30s timeout"
  2443. $myTestResult = false
  2444. end
  2445. end
  2446.  
  2447. waitsecond(2)
  2448. end
  2449.  
  2450. tcase << TestAction.new(:ImageView_SearchIcon_1) do
  2451. $ruiObj = RUIObject.new.with('objectid', -2102339713).with('selfid', -136350747).with('textdescid', -748021631).with('uniqueparentid', 0)
  2452. .with('uitreeindex', 0)
  2453. .with('classname', 'ImageView')
  2454. .with('resource-id', 'com.android.vending:id/search_icon')
  2455.  
  2456. $ruiObj.isExist
  2457. ifFailJumpTo(:LogStop)
  2458.  
  2459. waitsecond(2)
  2460. end
  2461.  
  2462. tcase << TestAction.new(:ImageView_SearchIcon_2) do
  2463. $ruiObj = RUIObject.new.with('objectid', -2102339713).with('selfid', -136350747).with('textdescid', -748021631).with('uniqueparentid', 0)
  2464. .with('uitreeindex', 0)
  2465. .with('classname', 'ImageView')
  2466. .with('resource-id', 'com.android.vending:id/search_icon')
  2467.  
  2468. $ruiObj.click
  2469.  
  2470. waitsecond(2)
  2471. end
  2472.  
  2473. tcase << TestAction.new(:View_ImeChoice) do
  2474. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  2475. .with('uitreeindex', 1)
  2476. .with('classname', 'android.view.View')
  2477. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  2478.  
  2479. $ruiObj.click
  2480.  
  2481. waitsecond(4)
  2482. end
  2483.  
  2484. tcase << TestAction.new(:scriptAction_Input_AppName_Calculator) do
  2485. pressKeyCode(31)
  2486. pressKeyCode(29)
  2487. pressKeyCode(40)
  2488. pressKeyCode(31)
  2489. pressKeyCode(49)
  2490. pressKeyCode(40)
  2491. pressKeyCode(29)
  2492. pressKeyCode(48)
  2493. pressKeyCode(43)
  2494. pressKeyCode(46)
  2495.  
  2496. waitsecond(1)
  2497. click(338,73)
  2498.  
  2499. waitsecond(8)
  2500. end
  2501.  
  2502. tcase << TestAction.new(:gotoApp_1) do
  2503. gotoApp('Google Inc.')
  2504.  
  2505. waitsecond(2)
  2506. end
  2507.  
  2508. tcase << TestAction.new(:scriptAction_Input_AppName_Colornote) do
  2509.  
  2510. if rand(100) < 0
  2511.  
  2512. pressKeyCode(31)
  2513. pressKeyCode(43)
  2514. pressKeyCode(40)
  2515. pressKeyCode(43)
  2516. pressKeyCode(46)
  2517. pressKeyCode(42)
  2518. pressKeyCode(43)
  2519. pressKeyCode(48)
  2520. pressKeyCode(33)
  2521.  
  2522. pressKeyCode(62)
  2523.  
  2524. pressKeyCode(42)
  2525. pressKeyCode(43)
  2526. pressKeyCode(48)
  2527. pressKeyCode(33)
  2528. pressKeyCode(44)
  2529. pressKeyCode(29)
  2530. pressKeyCode(32)
  2531.  
  2532. pressKeyCode(62)
  2533.  
  2534. pressKeyCode(42)
  2535. pressKeyCode(43)
  2536. pressKeyCode(48)
  2537. pressKeyCode(33)
  2538. pressKeyCode(47)
  2539.  
  2540. waitsecond(1)
  2541. click(338,73)
  2542.  
  2543. waitsecond(8)
  2544.  
  2545. end
  2546.  
  2547. end
  2548.  
  2549. tcase << TestAction.new(:TextView_LiTitle_1) do
  2550.  
  2551. if rand(100) < 0
  2552.  
  2553. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2554. .with('uitreeindex', 2)
  2555. .with('classname', 'TextView')
  2556. .with('resource-id', 'com.android.vending:id/li_title')
  2557. .with('text', 'ColorNote Notepad Notes')
  2558.  
  2559. $ruiObj.isNotExist
  2560. ifFailJumpTo(:TextView_LiTitle_3)
  2561.  
  2562. waitsecond(2)
  2563.  
  2564. end
  2565.  
  2566. end
  2567.  
  2568. tcase << TestAction.new(:scriptAction_Check_SearchApp) do
  2569.  
  2570. if rand(100) < 0
  2571.  
  2572. $myFailReason = "Can not search Application"
  2573. $myTestResult = false
  2574.  
  2575. waitsecond(2)
  2576.  
  2577. end
  2578.  
  2579. end
  2580.  
  2581. tcase << TestAction.new(:TextView_LiTitle_2) do
  2582.  
  2583. if rand(100) < 0
  2584.  
  2585. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2586. .with('uitreeindex', 2)
  2587. .with('classname', 'TextView')
  2588. .with('resource-id', 'com.android.vending:id/li_title')
  2589. .with('text', 'ColorNote Notepad Notes')
  2590.  
  2591. $ruiObj.isExist
  2592. ifFailJumpTo(:LogStop)
  2593.  
  2594. waitsecond(2)
  2595.  
  2596. end
  2597.  
  2598. end
  2599.  
  2600. tcase << TestAction.new(:TextView_LiTitle_3) do
  2601.  
  2602. if rand(100) < 0
  2603.  
  2604. $ruiObj = RUIObject.new.with('objectid', -942919553).with('selfid', -131787672).with('textdescid', -263254646).with('uniqueparentid', 0)
  2605. .with('uitreeindex', 2)
  2606. .with('classname', 'TextView')
  2607. .with('resource-id', 'com.android.vending:id/li_title')
  2608. .with('text', 'ColorNote Notepad Notes')
  2609.  
  2610. $ruiObj.click
  2611.  
  2612. waitsecond(2)
  2613.  
  2614. end
  2615.  
  2616. end
  2617.  
  2618. tcase << TestAction.new(:TextView_ButtonText_Uninstall_1) do
  2619. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2620. .with('uitreeindex', 6)
  2621. .with('classname', 'TextView')
  2622. .with('resource-id', 'com.android.vending:id/button_text')
  2623. .with('text', 'Uninstall')
  2624.  
  2625. $ruiObj.isExist
  2626. ifFailJumpTo(:TextView_ButtonText_Install_1)
  2627.  
  2628. waitsecond(2)
  2629. end
  2630.  
  2631. tcase << TestAction.new(:TextView_ButtonText_Uninstall_2) do
  2632. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2633. .with('uitreeindex', 6)
  2634. .with('classname', 'TextView')
  2635. .with('resource-id', 'com.android.vending:id/button_text')
  2636. .with('text', 'Uninstall')
  2637.  
  2638. $ruiObj.click
  2639.  
  2640. waitsecond(2)
  2641. end
  2642.  
  2643. tcase << TestAction.new(:wait8second) do
  2644. waitsecond(8)
  2645. end
  2646.  
  2647. tcase << TestAction.new(:TextView_ButtonText_Install_1) do
  2648. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2649. .with('uitreeindex', 6)
  2650. .with('classname', 'TextView')
  2651. .with('resource-id', 'com.android.vending:id/button_text')
  2652. .with('text', 'Install')
  2653.  
  2654. $ruiObj.isNotExist
  2655. ifFailJumpTo(:TextView_ButtonText_Install_3)
  2656.  
  2657. waitsecond(2)
  2658. end
  2659.  
  2660. tcase << TestAction.new(:scriptAction_Check_InstallApp) do
  2661. $myFailReason = "Can not install Application"
  2662. $myTestResult = false
  2663.  
  2664. waitsecond(2)
  2665. end
  2666.  
  2667. tcase << TestAction.new(:TextView_ButtonText_Install_2) do
  2668. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2669. .with('uitreeindex', 6)
  2670. .with('classname', 'TextView')
  2671. .with('resource-id', 'com.android.vending:id/button_text')
  2672. .with('text', 'Install')
  2673.  
  2674. $ruiObj.isExist
  2675. ifFailJumpTo(:LogStop)
  2676.  
  2677. waitsecond(2)
  2678. end
  2679.  
  2680. tcase << TestAction.new(:TextView_ButtonText_Install_3) do
  2681. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -1296129030).with('textdescid', -255886059).with('uniqueparentid', 0)
  2682. .with('uitreeindex', 6)
  2683. .with('classname', 'TextView')
  2684. .with('resource-id', 'com.android.vending:id/button_text')
  2685. .with('text', 'Install')
  2686.  
  2687. $ruiObj.click
  2688.  
  2689. waitsecond(2)
  2690. end
  2691.  
  2692. tcase << TestAction.new(:TextView_ButtonText_Continue_1) do
  2693. $ruiObj = RUIObject.new.with('objectid', -1972067487).with('selfid', 1647344168).with('textdescid', -92190150).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2694. .with('uitreeindex', 3)
  2695. .with('classname', 'TextView')
  2696. .with('resource-id', 'com.android.vending:id/button_text')
  2697. .with('text', 'Continue')
  2698.  
  2699. $ruiObj.isExist
  2700. ifFailJumpTo(:TextView_ButtonText_Accept_1)
  2701.  
  2702. waitsecond(2)
  2703. end
  2704.  
  2705. tcase << TestAction.new(:TextView_ButtonText_Continue_2) do
  2706. $ruiObj = RUIObject.new.with('objectid', -1972067487).with('selfid', 1647344168).with('textdescid', -92190150).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2707. .with('uitreeindex', 3)
  2708. .with('classname', 'TextView')
  2709. .with('resource-id', 'com.android.vending:id/button_text')
  2710. .with('text', 'Continue')
  2711.  
  2712. $ruiObj.click
  2713.  
  2714. waitsecond(2)
  2715. end
  2716.  
  2717. tcase << TestAction.new(:TextView_ButtonText_Accept_1) do
  2718. $ruiObj = RUIObject.new.with('objectid', 1812252228).with('selfid', -974229815).with('textdescid', -1858510308).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2719. .with('uitreeindex', 7)
  2720. .with('classname', 'TextView')
  2721. .with('resource-id', 'com.android.vending:id/button_text')
  2722. .with('text', 'Accept')
  2723.  
  2724. $ruiObj.isExist
  2725. ifFailJumpTo(:scriptAction_Check_InstallComplete)
  2726.  
  2727. waitsecond(2)
  2728. end
  2729.  
  2730. tcase << TestAction.new(:TextView_ButtonText_Accept_2) do
  2731. $ruiObj = RUIObject.new.with('objectid', 1812252228).with('selfid', -974229815).with('textdescid', -1858510308).with('uniqueparentid', 0).with('classresourceid', 1986909815)
  2732. .with('uitreeindex', 7)
  2733. .with('classname', 'TextView')
  2734. .with('resource-id', 'com.android.vending:id/button_text')
  2735. .with('text', 'Accept')
  2736.  
  2737. $ruiObj.click
  2738.  
  2739. waitsecond(2)
  2740. end
  2741.  
  2742. tcase << TestAction.new(:scriptAction_Check_InstallComplete) do
  2743. for i in 0..17
  2744. wakeUp
  2745. waitsecond(5)
  2746.  
  2747. if uiObj("TextView").text("Uninstall").exists
  2748. break
  2749. elsif i == 17
  2750. $myFailReason = "Application install 1m30s timeout"
  2751. $myTestResult = false
  2752. end
  2753. end
  2754.  
  2755. waitsecond(2)
  2756. end
  2757.  
  2758. tcase << TestAction.new(:TextView_ButtonText_Uninstall_3) do
  2759. $ruiObj = RUIObject.new.with('objectid', 74860304).with('selfid', -694121599).with('textdescid', 87611054).with('uniqueparentid', 0)
  2760. .with('uitreeindex', 6)
  2761. .with('classname', 'TextView')
  2762. .with('resource-id', 'com.android.vending:id/button_text')
  2763. .with('text', 'Uninstall')
  2764.  
  2765. $ruiObj.isNotExist
  2766. ifFailJumpTo(:LogStop)
  2767.  
  2768. waitsecond(2)
  2769. end
  2770.  
  2771. tcase << TestAction.new(:scriptAction_Install_Error) do
  2772. $myFailReason = "Can not install complete for Application"
  2773. $myTestResult = false
  2774.  
  2775. waitsecond(2)
  2776. end
  2777.  
  2778. tcase << TestAction.new(:TextView_ButtonText_Downloading_1) do
  2779. $ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0)
  2780. .with('uitreeindex', 6)
  2781. .with('classname', 'TextView')
  2782. .with('resource-id', 'com.android.vending:id/button_text')
  2783. .with('text', 'Downloading')
  2784.  
  2785. $ruiObj.isExist
  2786.  
  2787. waitsecond(2)
  2788. end
  2789.  
  2790. tcase << TestAction.new(:TextView_ButtonText_Downloading_2) do
  2791. $ruiObj = RUIObject.new.with('objectid', -1784868288).with('selfid', 1655429433).with('textdescid', 1567843078).with('uniqueparentid', 0)
  2792. .with('uitreeindex', 6)
  2793. .with('classname', 'TextView')
  2794. .with('resource-id', 'com.android.vending:id/button_text')
  2795. .with('text', 'Downloading')
  2796.  
  2797. $ruiObj.click
  2798.  
  2799. waitsecond(2)
  2800. end
  2801.  
  2802. tcase << TestAction.new(:LogStop) do
  2803. wakeUp
  2804. logStopTest("05_01_05_03_StoreFrontDownload")
  2805.  
  2806. waitsecond(2)
  2807. if !($myTestResult)
  2808. $myTestResult = true
  2809. end
  2810.  
  2811. waitsecond(2)
  2812. end
  2813.  
  2814. tcase << TestAction.new(:goto_Home) do
  2815. for i in 0..5
  2816. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  2817. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  2818. pressKeyCode(4)
  2819. waitsecond(1)
  2820. else
  2821. break
  2822. end
  2823. else
  2824. pressKeyCode(4)
  2825. waitsecond(1)
  2826. end
  2827. end
  2828.  
  2829. waitsecond(2)
  2830. end
  2831.  
  2832. tcase << TestAction.new(:TextView_Text_Successfully) do
  2833. $ruiObj = RUIObject.new.with('objectid', 1472509444).with('selfid', 1035549449).with('textdescid', 753694147).with('uniqueparentid', 0)
  2834. .with('uitreeindex', 4)
  2835. .with('classname', 'TextView')
  2836. .with('resource-id', 'com.google.android.wearable.app:id/text')
  2837. .with('text', 'Successfully installed')
  2838.  
  2839. $ruiObj.isExist
  2840. ifFailJumpTo(:scriptAction_End)
  2841.  
  2842. waitsecond(2)
  2843. end
  2844.  
  2845. tcase << TestAction.new(:scriptAction_removePopUp) do
  2846. swipe_horizontal_back 10
  2847.  
  2848. waitsecond(2)
  2849. end
  2850.  
  2851. tcase << TestAction.new(:scriptAction_End) do
  2852.  
  2853.  
  2854. waitsecond(1)
  2855. end
  2856.  
  2857. tcase.run(loopTime)
  2858.  
  2859. end
  2860.  
  2861. def self.excutePlayStore(loopTime)
  2862.  
  2863. tcase = TestCase.new("excutePlayStore")
  2864.  
  2865. tcase << TestAction.new(:LogStart) do
  2866. logStartTest("05_01_05_01_StoreFrontDownload")
  2867.  
  2868. waitsecond(2)
  2869. end
  2870.  
  2871. tcase << TestAction.new(:pressMenu) do
  2872. for i in 0..5
  2873. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  2874. break
  2875. else
  2876. pressKeyCode(4)
  2877. waitsecond(1)
  2878. end
  2879. end
  2880.  
  2881. waitsecond(2)
  2882. end
  2883.  
  2884. tcase << TestAction.new(:gotoApp) do
  2885. gotoApp('Play Store')
  2886.  
  2887. waitsecond(2)
  2888. end
  2889.  
  2890. tcase << TestAction.new(:Button_Button1_1) do
  2891. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2892. .with('uitreeindex', 1)
  2893. .with('classname', 'Button')
  2894. .with('resource-id', 'android:id/button1')
  2895. .with('text', 'YES IM IN')
  2896.  
  2897. $ruiObj.isExist
  2898. ifFailJumpTo(:scriptAction_check_PlayStore_1)
  2899.  
  2900. waitsecond(2)
  2901. end
  2902.  
  2903. tcase << TestAction.new(:Button_Button1_2) do
  2904. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2905. .with('uitreeindex', 1)
  2906. .with('classname', 'Button')
  2907. .with('resource-id', 'android:id/button1')
  2908. .with('text', 'YES IM IN')
  2909.  
  2910. $ruiObj.click
  2911.  
  2912. waitsecond(2)
  2913. end
  2914.  
  2915. tcase << TestAction.new(:scriptAction_check_PlayStore_1) do
  2916. for i in 0..9
  2917. waitsecond(3)
  2918.  
  2919. if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists
  2920. break
  2921. elsif i == 9
  2922. $myFailReason = "PlayStore Open 30s timeout"
  2923. $myTestResult = false
  2924. end
  2925. end
  2926.  
  2927. waitsecond(2)
  2928. end
  2929.  
  2930. tcase << TestAction.new(:Button_Button1_3) do
  2931. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2932. .with('uitreeindex', 1)
  2933. .with('classname', 'Button')
  2934. .with('resource-id', 'android:id/button1')
  2935. .with('text', 'YES IM IN')
  2936.  
  2937. $ruiObj.isExist
  2938. ifFailJumpTo(:LogStop)
  2939.  
  2940. waitsecond(2)
  2941. end
  2942.  
  2943. tcase << TestAction.new(:Button_Button1_4) do
  2944. $ruiObj = RUIObject.new.with('objectid', -1586480591).with('selfid', 1270675712).with('textdescid', 490747751).with('uniqueparentid', 0).with('classresourceid', 1834539358)
  2945. .with('uitreeindex', 1)
  2946. .with('classname', 'Button')
  2947. .with('resource-id', 'android:id/button1')
  2948. .with('text', 'YES IM IN')
  2949.  
  2950. $ruiObj.click
  2951.  
  2952. waitsecond(2)
  2953. end
  2954.  
  2955. tcase << TestAction.new(:scriptAction_check_PlayStore_2) do
  2956. for i in 0..9
  2957. waitsecond(3)
  2958.  
  2959. if uiObj("ImageView").resid("com.android.vending:id/search_icon").exists
  2960. break
  2961. elsif i == 9
  2962. $myFailReason = "PlayStore Open 30s timeout"
  2963. $myTestResult = false
  2964. end
  2965. end
  2966.  
  2967. waitsecond(2)
  2968. end
  2969.  
  2970. tcase << TestAction.new(:LogStop) do
  2971. wakeUp
  2972. logStopTest("05_01_05_01_StoreFrontDownload")
  2973.  
  2974. waitsecond(2)
  2975. if !($myTestResult)
  2976. $myTestResult = true
  2977. end
  2978.  
  2979. waitsecond(2)
  2980. end
  2981.  
  2982. tcase << TestAction.new(:goto_Home) do
  2983. for i in 0..5
  2984. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  2985. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  2986. pressKeyCode(4)
  2987. waitsecond(1)
  2988. else
  2989. break
  2990. end
  2991. else
  2992. pressKeyCode(4)
  2993. waitsecond(1)
  2994. end
  2995. end
  2996.  
  2997. waitsecond(2)
  2998. end
  2999.  
  3000. tcase.run(loopTime)
  3001.  
  3002. end
  3003.  
  3004. def self.make30sSleep(loopTime)
  3005.  
  3006. tcase = TestCase.new("make30sSleep")
  3007.  
  3008. tcase << TestAction.new(:LogUpload_Enable) do
  3009. $saveLogToGist = true
  3010.  
  3011. waitsecond(2)
  3012. end
  3013.  
  3014. tcase << TestAction.new(:goto_Home) do
  3015. for i in 0..5
  3016. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  3017. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  3018. pressKeyCode(4)
  3019. waitsecond(1)
  3020. else
  3021. break
  3022. end
  3023. else
  3024. pressKeyCode(4)
  3025. waitsecond(1)
  3026. end
  3027. end
  3028.  
  3029. waitsecond(2)
  3030. end
  3031.  
  3032. tcase << TestAction.new(:wait32second_1_1) do
  3033. waitsecond(32)
  3034. end
  3035.  
  3036. tcase.run(loopTime)
  3037.  
  3038. end
  3039.  
  3040. def self.make_Clipboard_Text_160(loopTime)
  3041.  
  3042. tcase = TestCase.new("make_Clipboard_Text_160")
  3043.  
  3044. tcase << TestAction.new(:Messgenger) do
  3045. wakeUp
  3046. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity")
  3047. waitsecond(2)
  3048.  
  3049. waitsecond(2)
  3050. end
  3051.  
  3052. tcase << TestAction.new(:wait_4seconds) do
  3053. waitsecond(4)
  3054. end
  3055.  
  3056. tcase << TestAction.new(:ImageView_Avatar) do
  3057. wakeUp
  3058. $ruiObj = RUIObject.new.with('objectid', 41359753).with('selfid', 632723682).with('textdescid', 1282152375).with('uniqueparentid', 0)
  3059. .with('uitreeindex', 2)
  3060. .with('classname', 'ImageView')
  3061. .with('resource-id', 'com.google.android.apps.messaging:id/conversation_icon')
  3062.  
  3063. $ruiObj.click
  3064.  
  3065. waitsecond(2)
  3066. end
  3067.  
  3068. tcase << TestAction.new(:show_Option) do
  3069. swipe_vertical 20
  3070.  
  3071. waitsecond(2)
  3072. end
  3073.  
  3074. tcase << TestAction.new(:TextView_Reply) do
  3075. $ruiObj = RUIObject.new.with('objectid', -1353661384).with('selfid', -1919466194).with('textdescid', -993711234).with('uniqueparentid', 0)
  3076. .with('uitreeindex', 5)
  3077. .with('classname', 'TextView')
  3078. .with('resource-id', 'com.google.android.apps.messaging:id/main_text')
  3079. .with('text', 'Reply')
  3080.  
  3081. $ruiObj.click
  3082.  
  3083. waitsecond(4)
  3084. end
  3085.  
  3086. tcase << TestAction.new(:View_ImeChoice) do
  3087. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  3088. .with('uitreeindex', 3)
  3089. .with('classname', 'android.view.View')
  3090. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  3091.  
  3092. $ruiObj.click
  3093.  
  3094. waitsecond(4)
  3095. end
  3096.  
  3097. tcase << TestAction.new(:Characters_Input_160) do
  3098. for i in 1..16
  3099. click(78,300)
  3100. click(278,360)
  3101. click(198,360)
  3102. click(158,300)
  3103. click(138,240)
  3104. click(198,300)
  3105. click(238,300)
  3106. click(278,300)
  3107. click(338,240)
  3108. click(318,300)
  3109. end
  3110.  
  3111. waitsecond(2)
  3112. end
  3113.  
  3114. tcase << TestAction.new(:TextView_RemoteInputHeader) do
  3115. $ruiObj = RUIObject.new.with('objectid', -53758611).with('selfid', -908654521).with('textdescid', -1733141908).with('uniqueparentid', 0)
  3116. .with('uitreeindex', 0)
  3117. .with('classname', 'TextView')
  3118. .with('resource-id', 'com.google.android.wearable.app:id/remote_input_header')
  3119. .with('text', 'Message')
  3120.  
  3121. $ruiObj.longClick
  3122.  
  3123. waitsecond(2)
  3124. end
  3125.  
  3126. tcase << TestAction.new(:touch_text) do
  3127. click(240,73)
  3128.  
  3129. waitsecond(2)
  3130. end
  3131.  
  3132. tcase << TestAction.new(:TextView_RemoteInputHeader_1) do
  3133. $ruiObj = RUIObject.new.with('objectid', -53758611).with('selfid', -908654521).with('textdescid', -1733141908).with('uniqueparentid', 0)
  3134. .with('uitreeindex', 0)
  3135. .with('classname', 'TextView')
  3136. .with('resource-id', 'com.google.android.wearable.app:id/remote_input_header')
  3137. .with('text', 'Message')
  3138.  
  3139. $ruiObj.longClick
  3140.  
  3141. waitsecond(2)
  3142. end
  3143.  
  3144. tcase << TestAction.new(:select_Copy_1) do
  3145. click(240,197)
  3146.  
  3147. waitsecond(2)
  3148. end
  3149.  
  3150. tcase << TestAction.new(:TextView_RemoteInputHeader_2) do
  3151. $ruiObj = RUIObject.new.with('objectid', -53758611).with('selfid', -908654521).with('textdescid', -1733141908).with('uniqueparentid', 0)
  3152. .with('uitreeindex', 0)
  3153. .with('classname', 'TextView')
  3154. .with('resource-id', 'com.google.android.wearable.app:id/remote_input_header')
  3155. .with('text', 'Message')
  3156.  
  3157. $ruiObj.longClick
  3158.  
  3159. waitsecond(2)
  3160. end
  3161.  
  3162. tcase << TestAction.new(:select_All) do
  3163. click(378,197)
  3164. waitsecond(2)
  3165. click(318,380)
  3166.  
  3167. waitsecond(2)
  3168. end
  3169.  
  3170. tcase << TestAction.new(:select_Copy_2) do
  3171. click(240,197)
  3172.  
  3173. waitsecond(2)
  3174. end
  3175.  
  3176. tcase << TestAction.new(:goto_Home) do
  3177. for i in 0..5
  3178. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  3179. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  3180. pressKeyCode(4)
  3181. waitsecond(1)
  3182. else
  3183. break
  3184. end
  3185. else
  3186. pressKeyCode(4)
  3187. waitsecond(1)
  3188. end
  3189. end
  3190.  
  3191. waitsecond(4)
  3192. end
  3193.  
  3194. tcase.run(loopTime)
  3195.  
  3196. end
  3197.  
  3198. def self.openDownloadedApp(loopTime)
  3199.  
  3200. tcase = TestCase.new("openDownloadedApp")
  3201.  
  3202. tcase << TestAction.new(:LogStart) do
  3203. logStartTest("05_01_05_06_StoreFrontDownload")
  3204.  
  3205. waitsecond(2)
  3206. end
  3207.  
  3208. tcase << TestAction.new(:pressMenu) do
  3209. for i in 0..5
  3210. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  3211. break
  3212. else
  3213. pressKeyCode(4)
  3214. waitsecond(1)
  3215. end
  3216. end
  3217.  
  3218. waitsecond(2)
  3219. end
  3220.  
  3221. tcase << TestAction.new(:gotoApp) do
  3222. gotoApp('Calculator')
  3223.  
  3224. waitsecond(2)
  3225. end
  3226.  
  3227. tcase << TestAction.new(:scriptAction_check_PlayStore) do
  3228. for i in 0..9
  3229. waitsecond(3)
  3230.  
  3231. if uiObj("TextView").resid("com.google.android.calculator:id/result").exists
  3232. break
  3233. elsif i == 9
  3234. $myFailReason = "Calculator Open 30s timeout"
  3235. $myTestResult = false
  3236. end
  3237. end
  3238.  
  3239. waitsecond(2)
  3240. end
  3241.  
  3242. tcase << TestAction.new(:LogStop) do
  3243. wakeUp
  3244. logStopTest("05_01_05_06_StoreFrontDownload")
  3245.  
  3246. waitsecond(2)
  3247. if !($myTestResult)
  3248. $myTestResult = true
  3249. end
  3250.  
  3251. waitsecond(2)
  3252. end
  3253.  
  3254. tcase << TestAction.new(:goto_Home) do
  3255. for i in 0..5
  3256. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  3257. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  3258. pressKeyCode(4)
  3259. waitsecond(1)
  3260. else
  3261. break
  3262. end
  3263. else
  3264. pressKeyCode(4)
  3265. waitsecond(1)
  3266. end
  3267. end
  3268.  
  3269. waitsecond(2)
  3270. end
  3271.  
  3272. tcase.run(loopTime)
  3273.  
  3274. end
  3275.  
  3276. def self.open_SMS(loopTime)
  3277.  
  3278. tcase = TestCase.new("open_SMS")
  3279.  
  3280. tcase << TestAction.new(:LogStart) do
  3281. wakeUp
  3282. logStartTest("05_01_02_10_Messaging")
  3283.  
  3284. waitsecond(2)
  3285. end
  3286.  
  3287. tcase << TestAction.new(:Messgenger) do
  3288. wakeUp
  3289. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity")
  3290. waitsecond(2)
  3291.  
  3292. waitsecond(2)
  3293. end
  3294.  
  3295. tcase << TestAction.new(:wait4second_10) do
  3296. waitsecond(4)
  3297.  
  3298. end
  3299.  
  3300. tcase << TestAction.new(:ImageView_Avatar_2) do
  3301. wakeUp
  3302. $ruiObj = RUIObject.new.with('objectid', 41359753).with('selfid', 632723682).with('textdescid', 1282152375).with('uniqueparentid', 0)
  3303. .with('uitreeindex', 2)
  3304. .with('classname', 'ImageView')
  3305. .with('resource-id', 'com.google.android.apps.messaging:id/conversation_icon')
  3306.  
  3307. $ruiObj.click
  3308.  
  3309. waitsecond(2)
  3310. end
  3311.  
  3312. tcase << TestAction.new(:wait1second_2) do
  3313. waitsecond(1)
  3314. end
  3315.  
  3316. tcase << TestAction.new(:swipeLeft_4) do
  3317. pressKeyCode(4)
  3318.  
  3319. waitsecond(1)
  3320. end
  3321.  
  3322. tcase << TestAction.new(:swipeLeft_6) do
  3323. pressKeyCode(4)
  3324.  
  3325. waitsecond(1)
  3326. end
  3327.  
  3328. tcase << TestAction.new(:LogStop) do
  3329. waitsecond(5)
  3330. logStopTest("05_01_02_10_Messaging")
  3331.  
  3332. waitsecond(1)
  3333. end
  3334.  
  3335. tcase.run(loopTime)
  3336.  
  3337. end
  3338.  
  3339. def self.playMusic_GoogleMusic(loopTime)
  3340.  
  3341. tcase = TestCase.new("playMusic_GoogleMusic")
  3342.  
  3343. tcase << TestAction.new(:Check_Watch_Face_1) do
  3344. wakeUp
  3345. waitsecond(1)
  3346.  
  3347. pressMenu
  3348. waitsecond(1)
  3349.  
  3350. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  3351. $msg = "Watch Face Change Displaying...."
  3352. puts $msg
  3353. logcat($msg)
  3354. writelog($msg)
  3355. waitsecond(1)
  3356.  
  3357. pressHome
  3358.  
  3359. $msg = "pressHome >> Watch Face Escape "
  3360. puts $msg
  3361. logcat($msg)
  3362. writelog($msg)
  3363. waitsecond(1)
  3364. end
  3365.  
  3366. waitsecond(2)
  3367. end
  3368.  
  3369. tcase << TestAction.new(:LogStart) do
  3370. logStartTest("05_01_07_11_Multi_Media")
  3371. waitsecond(2)
  3372.  
  3373. waitsecond(2)
  3374. end
  3375.  
  3376. tcase << TestAction.new(:pressMenu_5) do
  3377. for i in 0..5
  3378. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  3379. break
  3380. else
  3381. pressKeyCode(4)
  3382. waitsecond(1)
  3383. end
  3384. end
  3385.  
  3386. waitsecond(2)
  3387. end
  3388.  
  3389. tcase << TestAction.new(:gotoApp_2) do
  3390. gotoApp('Play Music')
  3391.  
  3392. waitsecond(4)
  3393. end
  3394.  
  3395. tcase << TestAction.new(:closeApp_1) do
  3396. pressKeyCode(4)
  3397.  
  3398. waitsecond(2)
  3399. end
  3400.  
  3401. tcase << TestAction.new(:LogStop) do
  3402. waitsecond(5)
  3403. logStopTest("05_01_07_11_Multi_Media")
  3404.  
  3405. waitsecond(1)
  3406. end
  3407.  
  3408. tcase.run(loopTime)
  3409.  
  3410. end
  3411.  
  3412. def self.recentCall(loopTime)
  3413.  
  3414. tcase = TestCase.new("recentCall")
  3415.  
  3416. tcase << TestAction.new(:scriptAction_setUp) do
  3417. wakeUp
  3418. logStartTest("05_01_01_03_Telephony")
  3419.  
  3420. waitsecond(2)
  3421. end
  3422.  
  3423. tcase << TestAction.new(:Check_Temperature_Start_1) do
  3424. wakeUp
  3425.  
  3426. if uiObj("TextView").text("Temperature limit reached").exists
  3427. $msg = "=== RecentCall Start Temperature limit Popup ==="
  3428. puts($msg)
  3429. logcat($msg)
  3430. writelog($msg)
  3431.  
  3432. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  3433. .with('uitreeindex', 3)
  3434. .with('classname', 'android.view.View')
  3435. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  3436.  
  3437. $ruiObj.click
  3438. end
  3439.  
  3440.  
  3441. waitsecond(2)
  3442. end
  3443.  
  3444. tcase << TestAction.new(:open_recentCallList) do
  3445. num = 0
  3446. $res = false
  3447.  
  3448. until (num > 5) or ($res)
  3449. puts "num = #{num}"
  3450.  
  3451. wakeUp
  3452. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.phone/com.google.android.clockwork.phone.dialer.DialerActivity")
  3453. waitsecond(5)
  3454.  
  3455. wakeUp
  3456. swipe_horizontal 10
  3457.  
  3458. if uiObj("ImageView").resid("com.google.android.apps.wearable.phone:id/action").exists
  3459. pressKeyCode(4)
  3460. waitsecond(2)
  3461. end
  3462.  
  3463. if uiObj("TextView").text("Recents").exists
  3464. $res = true
  3465. else
  3466. puts "retry"
  3467. pressMenu
  3468. waitsecond(2)
  3469. num += 1
  3470. end
  3471. end
  3472.  
  3473. waitsecond(8)
  3474. end
  3475.  
  3476. tcase << TestAction.new(:check_RecentCall) do
  3477. wakeUp
  3478. $ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0)
  3479. .with('uitreeindex', 2)
  3480. .with('classname', 'TextView')
  3481. .with('resource-id', 'com.google.android.apps.wearable.phone:id/number')
  3482. .with('text', db('CallNumber')[1])
  3483.  
  3484. $ruiObj.isNotExist
  3485. ifFailJumpTo(:click_RecentCall)
  3486.  
  3487. waitsecond(2)
  3488. end
  3489.  
  3490. tcase << TestAction.new(:swipeDown_4) do
  3491. swipe_vertical 20
  3492.  
  3493. waitsecond(2)
  3494. end
  3495.  
  3496. tcase << TestAction.new(:click_RecentCall) do
  3497. wakeUp
  3498. $ruiObj = RUIObject.new.with('objectid', 1207491418).with('selfid', 1738044886).with('textdescid', 1827351693).with('uniqueparentid', 0)
  3499. .with('uitreeindex', 2)
  3500. .with('classname', 'TextView')
  3501. .with('resource-id', 'com.google.android.apps.wearable.phone:id/number')
  3502. .with('text', db('CallNumber')[1])
  3503.  
  3504. $ruiObj.click
  3505.  
  3506. waitsecond(2)
  3507. end
  3508.  
  3509. tcase << TestAction.new(:Check_Recents_Text) do
  3510. $ruiObj = RUIObject.new.with('objectid', -1881912599).with('selfid', 968934138).with('textdescid', -328378081).with('uniqueparentid', 0)
  3511. .with('uitreeindex', 0)
  3512. .with('classname', 'TextView')
  3513. .with('resource-id', 'com.google.android.apps.wearable.phone:id/title')
  3514. .with('text', 'Recents')
  3515.  
  3516. $ruiObj.isNotExist
  3517. ifFailJumpTo(:check_RecentCall)
  3518.  
  3519. waitsecond(1)
  3520. end
  3521.  
  3522. tcase << TestAction.new(:scriptAction_sendBTCmd_answerCall) do
  3523. for i in 0..20
  3524. waitsecond(2)
  3525.  
  3526. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  3527. sendBTCmd("answerCall")
  3528. waitsecond(5)
  3529.  
  3530. $res = uiObj("TextView").text("Watch calling").exists
  3531. elsif uiObj("TextView").text("Swipe left to open.").exists
  3532. swipe_horizontal 10
  3533. waitsecond(2)
  3534. $res = uiObj("TextView").text("Watch calling").exists
  3535. elsif uiObj("TextView").text("Call in progress").exists
  3536. if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists
  3537. swipe_vertical 20
  3538. waitsecond(2)
  3539. end
  3540. if uiObj("TextView").text("Swipe left to open.").exists
  3541. swipe_horizontal 10
  3542. waitsecond(2)
  3543.  
  3544. click(240,240)
  3545. waitsecond(2)
  3546.  
  3547. if !uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists and uiObj("TextView").text("Call from watch").exists
  3548. puts "Call from watch"
  3549. gotoApp('watch')
  3550. waitsecond(2)
  3551. end
  3552. end
  3553.  
  3554. waitsecond(2)
  3555.  
  3556. if uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  3557. sendBTCmd("answerCall")
  3558. waitsecond(2)
  3559. $res = uiObj("TextView").text("dialing").exists
  3560. elsif not uiObj("TextView").text("dialing").exists
  3561. $res = true
  3562. else
  3563. $res = true
  3564. $myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved"
  3565. $myTestResult = false
  3566. end
  3567. elsif (i == 20)
  3568. $myFailReason = "Cannot make a Call to phone.::#{takeScreenShot}::screenshot saved"
  3569. $myTestResult = false
  3570. else
  3571. waitsecond(2)
  3572. end
  3573.  
  3574. if !$res
  3575. puts "Answer Call OK"
  3576. break
  3577. end
  3578. end
  3579.  
  3580. waitsecond(2)
  3581. end
  3582.  
  3583. tcase << TestAction.new(:scriptAction_endCall_Wear) do
  3584. wakeUp
  3585.  
  3586. $res = uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  3587.  
  3588. if uiObj("TextView").text("Swipe left to open.").exists
  3589. swipe_horizontal 10
  3590. waitsecond(2)
  3591.  
  3592. $res = uiObj("ImageButton").resid("com.google.android.apps.wearable.phone:id/hangup").exists
  3593. end
  3594.  
  3595. if !$res
  3596. puts "Not exist Hangup"
  3597. if uiObj("TextView").text("Call in progress").exists
  3598. if uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists
  3599. swipe_vertical 20
  3600. waitsecond(2)
  3601. end
  3602. if uiObj("TextView").text("Swipe left to open.").exists
  3603. swipe_horizontal 10
  3604. waitsecond(2)
  3605. click(240,240)
  3606. end
  3607. end
  3608. end
  3609.  
  3610.  
  3611. if $res
  3612. $UIDev.pressKeyCode(6)
  3613. puts "End Call OK"
  3614. else
  3615. $UIDev.pressKeyCode(6)
  3616.  
  3617. sendBTCmd("endCall")
  3618. $myFailReason = "Cannot make a Call to phone."
  3619. $myTestResult = false
  3620. end
  3621.  
  3622. waitsecond(2)
  3623. end
  3624.  
  3625. tcase << TestAction.new(:kill) do
  3626. wakeUp
  3627. waitsecond(1)
  3628. if uiObj("TextView").text("Call in progress").exists
  3629. waitsecond(2)
  3630. $msg = "Kill Call in progress::#{takeScreenShot}::screenshot saved"
  3631. puts $msg
  3632. logcat($msg)
  3633. writelog($msg)
  3634. waitsecond(4)
  3635.  
  3636. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.phone")
  3637. waitsecond(5)
  3638. PDGUiDevice.getInstance.execShellCmd("am force-stop com.android.bluetooth")
  3639. waitsecond(5)
  3640. PDGUiDevice.getInstance.execShellCmd("am force-stop com.google.android.apps.wearable.bluetooth")
  3641. waitsecond(5)
  3642. wakeUp
  3643. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  3644. waitsecond(4)
  3645.  
  3646. pressKeyCode(4)
  3647. waitsecond(2)
  3648.  
  3649. wakeUp
  3650. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  3651. waitsecond(4)
  3652.  
  3653. for i in 0..5
  3654. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  3655. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  3656. break
  3657. else
  3658. waitsecond(1)
  3659. end
  3660. end
  3661.  
  3662. pressKeyCode(4)
  3663. waitsecond(2)
  3664. pressKeyCode(4)
  3665. waitsecond(2)
  3666.  
  3667. end
  3668.  
  3669.  
  3670.  
  3671. waitsecond(2)
  3672. end
  3673.  
  3674. tcase << TestAction.new(:scriptAction_logStop) do
  3675. waitsecond(5)
  3676. logStopTest("05_01_01_03_Telephony")
  3677.  
  3678.  
  3679. waitsecond(1)
  3680. end
  3681.  
  3682. tcase << TestAction.new(:scriptAction_2_1_1) do
  3683. if !($myTestResult)
  3684. $myTestResult = true
  3685. wakeUp
  3686. PDGUiDevice.getInstance.execShellCmd("am start -n com.lge.androidwear.boottimeanalyzerwear/com.lge.androidwear.boottimeanalyzerwear.MainActivity")
  3687.  
  3688. $msg = "Run BTChatWear for turning on discover"
  3689. puts $msg
  3690. logcat($msg)
  3691. writelog($msg)
  3692. waitsecond(4)
  3693.  
  3694. pressKeyCode(4)
  3695. waitsecond(2)
  3696.  
  3697. wakeUp
  3698. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.BluetoothRequestDiscoverableActivity")
  3699. waitsecond(4)
  3700.  
  3701. for i in 0..5
  3702. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  3703. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  3704. break
  3705. else
  3706. waitsecond(1)
  3707. end
  3708. end
  3709.  
  3710. pressKeyCode(4)
  3711. waitsecond(2)
  3712. pressKeyCode(4)
  3713. waitsecond(2)
  3714. end
  3715.  
  3716. waitsecond(2)
  3717. end
  3718.  
  3719. tcase << TestAction.new(:Check_Temperature_End_1) do
  3720. wakeUp
  3721.  
  3722. if uiObj("TextView").text("Temperature limit reached").exists
  3723. $msg = "=== RecentCall End Temperature limit Popup ==="
  3724. puts($msg)
  3725. logcat($msg)
  3726. writelog($msg)
  3727.  
  3728. $ruiObj = RUIObject.new.with('objectid', -1945186212).with('selfid', 371672096).with('textdescid', -171230396).with('uniqueparentid', 0)
  3729. .with('uitreeindex', 3)
  3730. .with('classname', 'android.view.View')
  3731. .with('resource-id', 'com.google.android.apps.wearable.phone:id/check_button')
  3732.  
  3733. $ruiObj.click
  3734. end
  3735.  
  3736.  
  3737. waitsecond(2)
  3738. end
  3739.  
  3740. tcase.run(loopTime)
  3741.  
  3742. end
  3743.  
  3744. def self.remove_Alarm_GotoApp(loopTime)
  3745.  
  3746. tcase = TestCase.new("remove_Alarm_GotoApp")
  3747.  
  3748. tcase << TestAction.new(:wakeUp) do
  3749. wakeUp
  3750.  
  3751. waitsecond(2)
  3752. end
  3753.  
  3754. tcase << TestAction.new(:pressMenu_5_1_1_1_1_1) do
  3755. for i in 0..5
  3756. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  3757. break
  3758. else
  3759. pressKeyCode(4)
  3760. waitsecond(1)
  3761. end
  3762. end
  3763.  
  3764. waitsecond(2)
  3765. end
  3766.  
  3767. tcase << TestAction.new(:wait2second_3) do
  3768. waitsecond(2)
  3769. end
  3770.  
  3771. tcase << TestAction.new(:gotoApp_4) do
  3772. gotoApp('Alarm')
  3773.  
  3774. waitsecond(2)
  3775. end
  3776.  
  3777. tcase << TestAction.new(:logStart) do
  3778. logStartTest("05_01_06_04_PIM")
  3779.  
  3780. waitsecond(2)
  3781. end
  3782.  
  3783. tcase << TestAction.new(:Remove_Alarm) do
  3784. wakeUp
  3785. waitsecond(2)
  3786.  
  3787. if uiObj("TextView").text("New alarm").exists or uiObj('TextView').resid("com.google.android.deskclock:id/repeating_days").exists
  3788. $msg = "New alarm"
  3789. puts $msg
  3790. logcat($msg)
  3791. writelog($msg)
  3792. waitsecond(2)
  3793.  
  3794. for i in 0..5
  3795. if uiObj("TextView").text("One time").exists
  3796. uiObj('TextView').text("One time").click
  3797. $msg = "New alarm >> One time"
  3798. puts $msg
  3799. logcat($msg)
  3800. writelog($msg)
  3801.  
  3802. waitsecond(2)
  3803.  
  3804. if uiObj("TextView").text("Repeat").exists
  3805. swipe_vertical 20
  3806. waitsecond(1)
  3807.  
  3808. uiObj('TextView').text("Remove").click
  3809.  
  3810. $msg = "New alarm >> Remove OK"
  3811. puts $msg
  3812. logcat($msg)
  3813. writelog($msg)
  3814.  
  3815. waitsecond(2)
  3816. end
  3817. end
  3818.  
  3819. if uiObj("TextView").text("No alarms set").exists
  3820. waitsecond(2)
  3821. break
  3822. end
  3823. end
  3824.  
  3825. waitsecond(2)
  3826.  
  3827. pressKeyCode(4)
  3828. waitsecond(2)
  3829. end
  3830.  
  3831. waitsecond(2)
  3832. end
  3833.  
  3834. tcase << TestAction.new(:logStop) do
  3835. waitsecond(5)
  3836. logStopTest("05_01_06_04_PIM")
  3837.  
  3838. waitsecond(1)
  3839. end
  3840.  
  3841. tcase.run(loopTime)
  3842.  
  3843. end
  3844.  
  3845. def self.sendSMS(loopTime)
  3846.  
  3847. tcase = TestCase.new("sendSMS")
  3848.  
  3849. tcase << TestAction.new(:LogStart) do
  3850. logStartTest("05_01_02_03_Messaging")
  3851.  
  3852. waitsecond(2)
  3853. end
  3854.  
  3855. tcase << TestAction.new(:Messgenger) do
  3856. wakeUp
  3857. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.messaging/com.google.android.apps.messaging.MainActivity")
  3858. waitsecond(2)
  3859.  
  3860. waitsecond(2)
  3861. end
  3862.  
  3863. tcase << TestAction.new(:wait_4seconds) do
  3864. waitsecond(4)
  3865. end
  3866.  
  3867. tcase << TestAction.new(:TextView_DescriptionText) do
  3868. $ruiObj = RUIObject.new.with('objectid', -1172628426).with('selfid', -742062757).with('textdescid', 294867016).with('uniqueparentid', 0).with('classresourceid', 574161329)
  3869. .with('uitreeindex', 2)
  3870. .with('classname', 'TextView')
  3871. .with('resource-id', 'com.google.android.apps.messaging:id/description_text')
  3872. .with('text', 'With Messenger on your phone you can reply to all your phones conversations from your watch')
  3873.  
  3874. $ruiObj.isExist
  3875. ifFailJumpTo(:ImageView_Avatar)
  3876.  
  3877. waitsecond(2)
  3878. end
  3879.  
  3880. tcase << TestAction.new(:scriptAction_Back) do
  3881. pressKeyCode(4)
  3882.  
  3883. waitsecond(2)
  3884. end
  3885.  
  3886. tcase << TestAction.new(:ImageView_Avatar) do
  3887. wakeUp
  3888. $ruiObj = RUIObject.new.with('objectid', 41359753).with('selfid', 632723682).with('textdescid', 1282152375).with('uniqueparentid', 0)
  3889. .with('uitreeindex', 2)
  3890. .with('classname', 'ImageView')
  3891. .with('resource-id', 'com.google.android.apps.messaging:id/conversation_icon')
  3892.  
  3893. $ruiObj.click
  3894.  
  3895. waitsecond(2)
  3896. end
  3897.  
  3898. tcase << TestAction.new(:show_Option) do
  3899. swipe_vertical 20
  3900.  
  3901. waitsecond(2)
  3902. end
  3903.  
  3904. tcase << TestAction.new(:TextView_Reply) do
  3905. $ruiObj = RUIObject.new.with('objectid', -1353661384).with('selfid', -1919466194).with('textdescid', -993711234).with('uniqueparentid', 0)
  3906. .with('uitreeindex', 5)
  3907. .with('classname', 'TextView')
  3908. .with('resource-id', 'com.google.android.apps.messaging:id/main_text')
  3909. .with('text', 'Reply')
  3910.  
  3911. $ruiObj.click
  3912.  
  3913. waitsecond(4)
  3914. end
  3915.  
  3916. tcase << TestAction.new(:View_ImeChoice_1) do
  3917. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  3918. .with('uitreeindex', 3)
  3919. .with('classname', 'android.view.View')
  3920. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  3921.  
  3922. $ruiObj.click
  3923.  
  3924. waitsecond(4)
  3925. end
  3926.  
  3927. tcase << TestAction.new(:TextView_RemoteInputHeader_1) do
  3928. $ruiObj = RUIObject.new.with('objectid', -53758611).with('selfid', -908654521).with('textdescid', -1733141908).with('uniqueparentid', 0)
  3929. .with('uitreeindex', 0)
  3930. .with('classname', 'TextView')
  3931. .with('resource-id', 'com.google.android.wearable.app:id/remote_input_header')
  3932. .with('text', 'Message')
  3933.  
  3934. $ruiObj.click
  3935.  
  3936. waitsecond(2)
  3937. end
  3938.  
  3939. tcase << TestAction.new(:TextView_RemoteInputHeader_2) do
  3940. $ruiObj = RUIObject.new.with('objectid', -53758611).with('selfid', -908654521).with('textdescid', -1733141908).with('uniqueparentid', 0)
  3941. .with('uitreeindex', 0)
  3942. .with('classname', 'TextView')
  3943. .with('resource-id', 'com.google.android.wearable.app:id/remote_input_header')
  3944. .with('text', 'Message')
  3945.  
  3946. $ruiObj.longClick
  3947.  
  3948. waitsecond(2)
  3949. end
  3950.  
  3951. tcase << TestAction.new(:select_Paste) do
  3952. click(299,183)
  3953.  
  3954. waitsecond(2)
  3955. end
  3956.  
  3957. tcase << TestAction.new(:select_Send_Icon) do
  3958. click(338,73)
  3959.  
  3960. waitsecond(2)
  3961. end
  3962.  
  3963. tcase << TestAction.new(:View_ImeChoice_2) do
  3964. $ruiObj = RUIObject.new.with('objectid', 1177637689).with('selfid', -2078862819).with('textdescid', 2147030023).with('uniqueparentid', 0)
  3965. .with('uitreeindex', 3)
  3966. .with('classname', 'android.view.View')
  3967. .with('resource-id', 'com.google.android.wearable.app:id/ime_choice')
  3968.  
  3969. $ruiObj.isNotExist
  3970. ifFailJumpTo(:View_ImeChoice_1)
  3971.  
  3972. waitsecond(2)
  3973. end
  3974.  
  3975. tcase << TestAction.new(:wait16second_1) do
  3976. waitsecond(16)
  3977. end
  3978.  
  3979. tcase << TestAction.new(:TextView_BottomTimestamp_1) do
  3980. $ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0)
  3981. .with('uitreeindex', 1)
  3982. .with('classname', 'TextView')
  3983. .with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp')
  3984. .with('text', 'You Now')
  3985.  
  3986. $ruiObj.isNotExist
  3987. ifFailJumpTo(:LogStop)
  3988.  
  3989. waitsecond(2)
  3990. end
  3991.  
  3992. tcase << TestAction.new(:wait16second_2) do
  3993. wakeUp
  3994. waitsecond(16)
  3995. end
  3996.  
  3997. tcase << TestAction.new(:check_SendingError) do
  3998. for i in 0..2
  3999. if uiObj("TextView").resid("com.google.android.apps.messaging:id/error_text").exists
  4000. if i == 2
  4001. $myFailReason = "Cannot send SMS"
  4002. $myTestResult = false
  4003. break
  4004. else
  4005. uiObj("TextView").resid("com.google.android.apps.messaging:id/error_text").click
  4006. waitsecond(2)
  4007.  
  4008. if uiObj("TextView").text("Resend").exists
  4009. uiObj("TextView").text("Resend").click
  4010.  
  4011. waitsecond(16)
  4012. wakeUp
  4013. waitsecond(16)
  4014. end
  4015. end
  4016. end
  4017. end
  4018.  
  4019. waitsecond(2)
  4020. end
  4021.  
  4022. tcase << TestAction.new(:TextView_BottomTimestamp_2) do
  4023. $ruiObj = RUIObject.new.with('objectid', 944028986).with('selfid', 845999888).with('textdescid', -865834621).with('uniqueparentid', 0)
  4024. .with('uitreeindex', 1)
  4025. .with('classname', 'TextView')
  4026. .with('resource-id', 'com.google.android.apps.messaging:id/bottom_timestamp')
  4027. .with('text', 'You Now')
  4028.  
  4029. $ruiObj.isNotExist
  4030. ifFailJumpTo(:LogStop)
  4031.  
  4032. waitsecond(2)
  4033. end
  4034.  
  4035. tcase << TestAction.new(:send_SMS_Fail) do
  4036. $myFailReason = "SMS send Fail::#{takeScreenShot}::screenshot saved"
  4037. $myTestResult = false
  4038.  
  4039. waitsecond(2)
  4040. end
  4041.  
  4042. tcase << TestAction.new(:LogStop) do
  4043. wakeUp
  4044. logStopTest("05_01_02_03_Messaging")
  4045.  
  4046. waitsecond(2)
  4047. if !($myTestResult)
  4048. $myTestResult = true
  4049. end
  4050.  
  4051. waitsecond(2)
  4052. end
  4053.  
  4054. tcase << TestAction.new(:TextView_MessageText) do
  4055. $ruiObj = RUIObject.new.with('objectid', -1187987555).with('selfid', -1370099946).with('textdescid', 1674132369).with('uniqueparentid', 0)
  4056. .with('uitreeindex', 1)
  4057. .with('classname', 'TextView')
  4058. .with('resource-id', 'com.google.android.apps.messaging:id/message_text')
  4059. .with('text', 'Hello')
  4060.  
  4061. $ruiObj.isNotExist
  4062. ifFailJumpTo(:goto_Home)
  4063.  
  4064. waitsecond(2)
  4065. end
  4066.  
  4067. tcase << TestAction.new(:show_Option_2) do
  4068. for i in 0..4
  4069. swipe_vertical 20
  4070. waitsecond(2)
  4071.  
  4072. if uiObj("TextView").resid("com.google.android.apps.messaging:id/reply_menu_header").exists
  4073. break
  4074. elsif uiObj("android.view.View").resid("com.google.android.googlequicksearchbox:id/ime_choice").exists
  4075. pressKeyCode(4)
  4076. waitsecond(2)
  4077. end
  4078. end
  4079.  
  4080. waitsecond(2)
  4081. end
  4082.  
  4083. tcase << TestAction.new(:gotoApp_deleteSMS) do
  4084. gotoApp('Delete last message')
  4085.  
  4086. waitsecond(2)
  4087. end
  4088.  
  4089. tcase << TestAction.new(:Button_ConfirmButton) do
  4090. $ruiObj = RUIObject.new.with('objectid', 1462699923).with('selfid', -630553976).with('textdescid', -1900942611).with('uniqueparentid', 0)
  4091. .with('uitreeindex', 2)
  4092. .with('classname', 'Button')
  4093. .with('resource-id', 'com.google.android.apps.messaging:id/confirm_button')
  4094.  
  4095. $ruiObj.click
  4096.  
  4097. waitsecond(2)
  4098. end
  4099.  
  4100. tcase << TestAction.new(:goto_Home_2) do
  4101. for i in 0..5
  4102. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  4103. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  4104. pressKeyCode(4)
  4105. waitsecond(1)
  4106. else
  4107. break
  4108. end
  4109. else
  4110. pressKeyCode(4)
  4111. waitsecond(1)
  4112. end
  4113. end
  4114.  
  4115. waitsecond(2)
  4116. end
  4117.  
  4118. tcase.run(loopTime)
  4119.  
  4120. end
  4121.  
  4122. def self.setAlarm_GotoApp(loopTime)
  4123.  
  4124. tcase = TestCase.new("setAlarm_GotoApp")
  4125.  
  4126. tcase << TestAction.new(:wakeUp) do
  4127. wakeUp
  4128.  
  4129. waitsecond(2)
  4130. end
  4131.  
  4132. tcase << TestAction.new(:pressMenu_5_1_1_1_1) do
  4133. for i in 0..5
  4134. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  4135. break
  4136. else
  4137. pressKeyCode(4)
  4138. waitsecond(1)
  4139. end
  4140. end
  4141.  
  4142. waitsecond(2)
  4143. end
  4144.  
  4145. tcase << TestAction.new(:swipeRight_7_1_1_1_1) do
  4146. swipe_horizontal 10
  4147.  
  4148. waitsecond(2)
  4149. end
  4150.  
  4151. tcase << TestAction.new(:gotoApp_3) do
  4152. gotoApp('Alarm')
  4153.  
  4154. waitsecond(2)
  4155. end
  4156.  
  4157. tcase << TestAction.new(:Check_New_Alarm) do
  4158. wakeUp
  4159. waitsecond(1)
  4160.  
  4161. if uiObj("TextView").text("New alarm").exists
  4162. $msg = "New alarm"
  4163. puts $msg
  4164. logcat($msg)
  4165. writelog($msg)
  4166. waitsecond(2)
  4167.  
  4168. for i in 0..5
  4169. $msg = "i = #{i}"
  4170. puts $msg
  4171. logcat($msg)
  4172. writelog($msg)
  4173. waitsecond(2)
  4174.  
  4175. if uiObj("TextView").text("One time").exists
  4176. uiObj('TextView').text("One time").click
  4177. $msg = "New alarm >> One time"
  4178. puts $msg
  4179. logcat($msg)
  4180. writelog($msg)
  4181.  
  4182. waitsecond(2)
  4183.  
  4184. if uiObj("TextView").text("Repeat").exists
  4185. uiObj('TextView').text("Remove").click
  4186.  
  4187. $msg = "New alarm >> Remove OK"
  4188. puts $msg
  4189. logcat($msg)
  4190. writelog($msg)
  4191.  
  4192. waitsecond(2)
  4193. end
  4194. end
  4195.  
  4196. if uiObj("TextView").text("No alarms set").exists
  4197. waitsecond(2)
  4198. break
  4199. end
  4200. end
  4201.  
  4202. waitsecond(2)
  4203.  
  4204. pressKeyCode(4)
  4205. waitsecond(2)
  4206.  
  4207. pressMenu
  4208. waitsecond(2)
  4209.  
  4210. swipe_horizontal 10
  4211. waitsecond(2)
  4212.  
  4213. gotoApp('Alarm')
  4214. waitsecond(2)
  4215. end
  4216.  
  4217. waitsecond(2)
  4218. end
  4219.  
  4220. tcase << TestAction.new(:LogStart) do
  4221. logStartTest("05_01_06_02_PIM")
  4222.  
  4223. waitsecond(2)
  4224. end
  4225.  
  4226. tcase << TestAction.new(:swipeDown_4) do
  4227. wakeUp
  4228. swipe_vertical 20
  4229.  
  4230. waitsecond(2)
  4231. end
  4232.  
  4233. tcase << TestAction.new(:swipeRight_4) do
  4234. swipe_horizontal 10
  4235.  
  4236. waitsecond(2)
  4237. end
  4238.  
  4239. tcase << TestAction.new(:swipeRight_4_1) do
  4240. swipe_horizontal 10
  4241.  
  4242. waitsecond(2)
  4243. end
  4244.  
  4245. tcase << TestAction.new(:swipeRight_2) do
  4246. swipe_horizontal 10
  4247.  
  4248. waitsecond(2)
  4249. end
  4250.  
  4251. tcase << TestAction.new(:Set_Alarm) do
  4252. $ruiObj = RUIObject.new.with('objectid', -337373855).with('selfid', -1105113556).with('textdescid', -1537748564).with('uniqueparentid', 0)
  4253. .with('uitreeindex', 2)
  4254. .with('classname', 'TextView')
  4255. .with('resource-id', 'com.google.android.deskclock:id/text')
  4256. .with('text', 'Set alarm')
  4257.  
  4258. $ruiObj.click
  4259.  
  4260. waitsecond(2)
  4261. end
  4262.  
  4263. tcase << TestAction.new(:LogStop) do
  4264. waitsecond(5)
  4265. logStopTest("05_01_06_02_PIM")
  4266.  
  4267. waitsecond(1)
  4268. end
  4269.  
  4270. tcase.run(loopTime)
  4271.  
  4272. end
  4273.  
  4274. def self.shuffleMusic_GoogleMusic(loopTime)
  4275.  
  4276. tcase = TestCase.new("shuffleMusic_GoogleMusic")
  4277.  
  4278. tcase << TestAction.new(:Check_Watch_Face) do
  4279.  
  4280. if rand(100) < 0
  4281.  
  4282. wakeUp
  4283. waitsecond(1)
  4284.  
  4285. pressMenu
  4286. waitsecond(1)
  4287.  
  4288. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  4289. $msg = "Watch Face Change Displaying...."
  4290. puts $msg
  4291. logcat($msg)
  4292. writelog($msg)
  4293. waitsecond(1)
  4294.  
  4295. pressHome
  4296.  
  4297. $msg = "pressHome >> Watch Face Escape "
  4298. puts $msg
  4299. logcat($msg)
  4300. writelog($msg)
  4301. waitsecond(1)
  4302. end
  4303.  
  4304. waitsecond(2)
  4305.  
  4306. end
  4307.  
  4308. end
  4309.  
  4310. tcase << TestAction.new(:ImageView_NextTrack_1) do
  4311. $ruiObj = RUIObject.new.with('objectid', -1140743559).with('selfid', -77028276).with('textdescid', -1003311929).with('uniqueparentid', 0).with('classresourceid', 171675282)
  4312. .with('uitreeindex', 4)
  4313. .with('classname', 'ImageView')
  4314. .with('resource-id', 'com.google.android.wearable.app:id/next_track')
  4315.  
  4316. $ruiObj.isNotExist
  4317. ifFailJumpTo(:LogStart)
  4318.  
  4319. waitsecond(2)
  4320. end
  4321.  
  4322. tcase << TestAction.new(:pressMenu) do
  4323. for i in 0..5
  4324. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  4325. break
  4326. else
  4327. pressKeyCode(4)
  4328. waitsecond(1)
  4329. end
  4330. end
  4331.  
  4332. waitsecond(2)
  4333. end
  4334.  
  4335. tcase << TestAction.new(:gotoApp) do
  4336. gotoApp('Play Music')
  4337.  
  4338. waitsecond(2)
  4339. end
  4340.  
  4341. tcase << TestAction.new(:TextView_Title_1) do
  4342. $ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', -42316734).with('textdescid', -1845768772).with('uniqueparentid', 0)
  4343. .with('uitreeindex', 3)
  4344. .with('classname', 'TextView')
  4345. .with('resource-id', 'com.google.android.music:id/title')
  4346. .with('text', 'Play on Wear')
  4347.  
  4348. $ruiObj.isExist
  4349. ifFailJumpTo(:TextView_PlaylistTitle)
  4350.  
  4351. waitsecond(2)
  4352. end
  4353.  
  4354. tcase << TestAction.new(:TextView_Title_2) do
  4355. $ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', -42316734).with('textdescid', -1845768772).with('uniqueparentid', 0)
  4356. .with('uitreeindex', 3)
  4357. .with('classname', 'TextView')
  4358. .with('resource-id', 'com.google.android.music:id/title')
  4359. .with('text', 'Play on Wear')
  4360.  
  4361. $ruiObj.click
  4362.  
  4363. waitsecond(2)
  4364. end
  4365.  
  4366. tcase << TestAction.new(:TextView_PlaylistTitle) do
  4367. $ruiObj = RUIObject.new.with('objectid', 1928194679).with('selfid', -1627616556).with('textdescid', 300968312).with('uniqueparentid', 0)
  4368. .with('uitreeindex', 3)
  4369. .with('classname', 'TextView')
  4370. .with('resource-id', 'com.google.android.music:id/playlist_title')
  4371. .with('text', 'Wear')
  4372.  
  4373. $ruiObj.click
  4374.  
  4375. waitsecond(2)
  4376. end
  4377.  
  4378. tcase << TestAction.new(:TextView_SelectOutput) do
  4379. $ruiObj = RUIObject.new.with('objectid', -1627054395).with('selfid', 2109702396).with('textdescid', -1665923823).with('uniqueparentid', 0)
  4380. .with('uitreeindex', 4)
  4381. .with('classname', 'TextView')
  4382. .with('resource-id', 'com.google.android.music:id/title')
  4383. .with('text', 'Choose output')
  4384.  
  4385. $ruiObj.isExist
  4386. ifFailJumpTo(:goto_Home)
  4387.  
  4388. waitsecond(2)
  4389. end
  4390.  
  4391. tcase << TestAction.new(:TextView_Speaker) do
  4392. $ruiObj = RUIObject.new.with('objectid', 1197182896).with('selfid', 1915081553).with('textdescid', -723584367).with('uniqueparentid', 0)
  4393. .with('uitreeindex', 1)
  4394. .with('classname', 'TextView')
  4395. .with('resource-id', 'com.google.android.music:id/title')
  4396. .with('text', 'Speaker')
  4397.  
  4398. $ruiObj.click
  4399.  
  4400. waitsecond(2)
  4401. end
  4402.  
  4403. tcase << TestAction.new(:goto_Home) do
  4404. for i in 0..5
  4405. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  4406. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  4407. pressKeyCode(4)
  4408. waitsecond(1)
  4409. else
  4410. break
  4411. end
  4412. else
  4413. pressKeyCode(4)
  4414. waitsecond(1)
  4415. end
  4416. end
  4417.  
  4418. waitsecond(2)
  4419. end
  4420.  
  4421. tcase << TestAction.new(:Activation_MusicW) do
  4422. wakeUp
  4423.  
  4424. for i in 0..7
  4425. if !uiObj("TextView").text("Agenda").exists
  4426. swipe_vertical 20
  4427. waitsecond(2)
  4428.  
  4429. if uiObj("TextView").resid("com.google.android.wearable.app:id/start_time").exists
  4430. break
  4431. else
  4432. pressKeyCode(4)
  4433. waitsecond(1)
  4434. end
  4435. else
  4436. pressKeyCode(4)
  4437. waitsecond(1)
  4438. end
  4439. end
  4440.  
  4441. waitsecond(2)
  4442.  
  4443. waitsecond(2)
  4444. end
  4445.  
  4446. tcase << TestAction.new(:TextView_StartTime) do
  4447. $ruiObj = RUIObject.new.with('objectid', -1097734111).with('selfid', -1419618899).with('textdescid', 2123859129).with('uniqueparentid', 0)
  4448. .with('uitreeindex', 2)
  4449. .with('classname', 'TextView')
  4450. .with('resource-id', 'com.google.android.wearable.app:id/start_time')
  4451. .with('text', '1427')
  4452.  
  4453. $ruiObj.click
  4454.  
  4455. waitsecond(2)
  4456. end
  4457.  
  4458. tcase << TestAction.new(:LogStart) do
  4459. wakeUp
  4460. logStartTest("05_01_07_12_Multi_Media")
  4461.  
  4462. waitsecond(2)
  4463. end
  4464.  
  4465. tcase << TestAction.new(:ImageView_NextTrack_2) do
  4466. $ruiObj = RUIObject.new.with('objectid', -1140743559).with('selfid', -77028276).with('textdescid', -1003311929).with('uniqueparentid', 0).with('classresourceid', 171675282)
  4467. .with('uitreeindex', 4)
  4468. .with('classname', 'ImageView')
  4469. .with('resource-id', 'com.google.android.wearable.app:id/next_track')
  4470.  
  4471. $ruiObj.click
  4472.  
  4473. waitsecond(2)
  4474. end
  4475.  
  4476. tcase << TestAction.new(:wait5second) do
  4477. waitsecond(5)
  4478. end
  4479.  
  4480. tcase << TestAction.new(:LogStop) do
  4481. waitsecond(5)
  4482. logStopTest("05_01_07_12_Multi_Media")
  4483.  
  4484. waitsecond(1)
  4485. end
  4486.  
  4487. tcase.run(loopTime)
  4488.  
  4489. end
  4490.  
  4491. def self.startTest(loopTime)
  4492.  
  4493. tcase = TestCase.new("startTest")
  4494.  
  4495. tcase << TestAction.new(:scriptAction_1) do
  4496.  
  4497.  
  4498. waitsecond(2)
  4499. end
  4500.  
  4501. tcase.run(loopTime)
  4502.  
  4503. end
  4504.  
  4505. def self.stopMusic(loopTime)
  4506.  
  4507. tcase = TestCase.new("stopMusic")
  4508.  
  4509. tcase << TestAction.new(:Check_Watch_Face) do
  4510.  
  4511. if rand(100) < 0
  4512.  
  4513. wakeUp
  4514. waitsecond(1)
  4515.  
  4516. pressMenu
  4517. waitsecond(1)
  4518.  
  4519. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  4520. $msg = "Watch Face Change Displaying...."
  4521. puts $msg
  4522. logcat($msg)
  4523. writelog($msg)
  4524. waitsecond(1)
  4525.  
  4526. pressHome
  4527.  
  4528. $msg = "pressHome >> Watch Face Escape "
  4529. puts $msg
  4530. logcat($msg)
  4531. writelog($msg)
  4532. waitsecond(1)
  4533. end
  4534.  
  4535. waitsecond(2)
  4536.  
  4537. end
  4538.  
  4539. end
  4540.  
  4541. tcase << TestAction.new(:LogStart) do
  4542. logStartTest("05_01_07_13_Multi_Media")
  4543.  
  4544. waitsecond(2)
  4545. end
  4546.  
  4547. tcase << TestAction.new(:goto_Home) do
  4548. for i in 0..5
  4549. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  4550. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  4551. pressKeyCode(4)
  4552. waitsecond(1)
  4553. else
  4554. break
  4555. end
  4556. else
  4557. pressKeyCode(4)
  4558. waitsecond(1)
  4559. end
  4560. end
  4561.  
  4562. waitsecond(2)
  4563. end
  4564.  
  4565. tcase << TestAction.new(:goto_PlayMusic) do
  4566. for i in 0..2
  4567. swipe_vertical 20
  4568. waitsecond(2)
  4569.  
  4570. if uiObj("TextView").resid("com.google.android.wearable.app:id/start_time").exists
  4571. uiObj("TextView").resid("com.google.android.wearable.app:id/start_time").click
  4572. break
  4573. end
  4574. end
  4575.  
  4576. waitsecond(2)
  4577. end
  4578.  
  4579. tcase << TestAction.new(:ImageView_PlayPause_4) do
  4580. $ruiObj = RUIObject.new.with('objectid', 1702355621).with('selfid', -1528896392).with('textdescid', 1233416731).with('uniqueparentid', 0).with('classresourceid', -1280192834)
  4581. .with('uitreeindex', 3)
  4582. .with('classname', 'ImageView')
  4583. .with('resource-id', 'com.google.android.wearable.app:id/play_pause')
  4584.  
  4585. $ruiObj.click
  4586.  
  4587. waitsecond(2)
  4588. end
  4589.  
  4590. tcase << TestAction.new(:pressBack) do
  4591. pressKeyCode(4)
  4592.  
  4593. waitsecond(2)
  4594. end
  4595.  
  4596. tcase << TestAction.new(:close_MusicPlayer) do
  4597. swipe_vertical_back 20
  4598. waitsecond(2)
  4599. swipe_vertical 20
  4600. waitsecond(2)
  4601. swipe_horizontal_back 10
  4602.  
  4603. waitsecond(2)
  4604. end
  4605.  
  4606. tcase << TestAction.new(:scriptAction_stopMusicApp) do
  4607.  
  4608. if rand(100) < 0
  4609.  
  4610. $res = false
  4611.  
  4612. for j in 0..20
  4613. wakeUp
  4614. waitsecond(2)
  4615.  
  4616. 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
  4617. break
  4618. elsif uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists
  4619. break
  4620. elsif uiObj("TextView").resid("com.google.android.wearable.app:id/snippet").exists and uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  4621. break
  4622. else
  4623. wakeUp
  4624. swipe_horizontal_back 10
  4625. waitsecond(2)
  4626. end
  4627. end
  4628.  
  4629. for i in 0..10
  4630. puts "i = #{i}"
  4631. wakeUp
  4632. waitsecond(2)
  4633.  
  4634. for j in 0..5
  4635. if uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists
  4636. if uiObj("ImageView").resid("com.google.android.wearable.app:id/charging_icon").exists
  4637. wakeUp
  4638. swipe_vertical 20
  4639. waitsecond(2)
  4640. end
  4641.  
  4642. wakeUp
  4643. uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").click
  4644. waitsecond(2)
  4645. swipe_horizontal_back 10
  4646. waitsecond(2)
  4647.  
  4648. if not uiObj("ImageView").resid("com.google.android.wearable.app:id/big_action_icon").exists
  4649. $res = true
  4650. break
  4651. end
  4652. else
  4653. wakeUp
  4654. swipe_vertical 20
  4655. waitsecond(2)
  4656. end
  4657. end
  4658.  
  4659. if ($res) then
  4660. puts "loop break"
  4661. break
  4662. end
  4663. end
  4664.  
  4665.  
  4666. waitsecond(2)
  4667.  
  4668. end
  4669.  
  4670. end
  4671.  
  4672. tcase << TestAction.new(:LogStop) do
  4673. waitsecond(5)
  4674. logStopTest("05_01_07_13_Multi_Media")
  4675.  
  4676. waitsecond(1)
  4677. end
  4678.  
  4679. tcase.run(loopTime)
  4680.  
  4681. end
  4682.  
  4683. def self.wifiConnect_GotoApp(loopTime)
  4684.  
  4685. tcase = TestCase.new("wifiConnect_GotoApp")
  4686.  
  4687. tcase << TestAction.new(:Check_Watch_Face) do
  4688. wakeUp
  4689.  
  4690. pressMenu
  4691. waitsecond(2)
  4692.  
  4693. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  4694. $msg = "Watch Face Change Displaying...."
  4695. puts $msg
  4696. logcat($msg)
  4697. writelog($msg)
  4698. waitsecond(2)
  4699.  
  4700. pressHome
  4701. waitsecond(2)
  4702.  
  4703. $msg = "pressHome >> Watch Face Escape "
  4704. puts $msg
  4705. logcat($msg)
  4706. writelog($msg)
  4707. waitsecond(2)
  4708. end
  4709.  
  4710.  
  4711. waitsecond(2)
  4712. end
  4713.  
  4714. tcase << TestAction.new(:pressMenu) do
  4715. for i in 0..5
  4716. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  4717. break
  4718. else
  4719. pressKeyCode(4)
  4720. waitsecond(1)
  4721. end
  4722. end
  4723.  
  4724. waitsecond(2)
  4725. end
  4726.  
  4727. tcase << TestAction.new(:swipeRight_4) do
  4728. swipe_horizontal 10
  4729.  
  4730. waitsecond(2)
  4731. end
  4732.  
  4733. tcase << TestAction.new(:gotoApp_Settings) do
  4734. gotoApp('Settings')
  4735.  
  4736. waitsecond(2)
  4737. end
  4738.  
  4739. tcase << TestAction.new(:Settings) do
  4740.  
  4741. if rand(100) < 0
  4742.  
  4743. wakeUp
  4744.  
  4745. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.SettingsActivity")
  4746.  
  4747.  
  4748.  
  4749. waitsecond(2)
  4750.  
  4751. end
  4752.  
  4753. end
  4754.  
  4755. tcase << TestAction.new(:gotoApp_Settings_1) do
  4756. gotoApp('Connectivity')
  4757.  
  4758. waitsecond(2)
  4759. end
  4760.  
  4761. tcase << TestAction.new(:wait2second_2) do
  4762. waitsecond(4)
  4763. wakeUp
  4764. end
  4765.  
  4766. tcase << TestAction.new(:gotoApp_WiFi) do
  4767. gotoApp('Wi-Fi')
  4768.  
  4769. waitsecond(2)
  4770. end
  4771.  
  4772. tcase << TestAction.new(:check_WiFi_SyncPopup) do
  4773. wakeUp
  4774.  
  4775. if uiObj("TextView").resid("android:id/message").exists and uiObj("TextView").text("Connect your watch to Wi-Fi with Wear cloud sync").exists
  4776. $msg = "Connect your watch to Wi-Fi with Wear cloud sync Popup "
  4777. puts $msg
  4778. logcat($msg)
  4779. writelog($msg)
  4780. waitsecond(2)
  4781.  
  4782. swipe_vertical 20
  4783. waitsecond(2)
  4784.  
  4785. swipe_vertical 20
  4786. waitsecond(2)
  4787.  
  4788. swipe_vertical 20
  4789. waitsecond(2)
  4790.  
  4791. if uiObj("Button").text("Accept").exists
  4792. uiObj("Button").text("Accept").clickAndWaitForNewWindow
  4793. waitsecond(2)
  4794.  
  4795. $msg = "Connect your watch to Wi-Fi with Wear cloud sync Popup >> Accept Click OK "
  4796. puts $msg
  4797. logcat($msg)
  4798. writelog($msg)
  4799. waitsecond(2)
  4800. end
  4801. end
  4802.  
  4803.  
  4804. waitsecond(2)
  4805. end
  4806.  
  4807. tcase << TestAction.new(:check_WiFi_Setting) do
  4808. for i in 0..5
  4809. wakeUp
  4810.  
  4811. if !uiObj("TextView").resid("com.google.android.apps.wearable.settings:id/header").exists and !uiObj("TextView").text("Wi-Fi").exists
  4812. $msg = "Wi-Fi Connect > check_WiFi_Setting :: Wi-Fi Setting Not Exists"
  4813. puts $msg
  4814. logcat($msg)
  4815. writelog($msg)
  4816. waitsecond(2)
  4817.  
  4818. if uiObj("ImageView").resid("com.google.android.wearable.app:id/preview").exists and uiObj("TextView").resid("com.google.android.wearable.app:id/name").exists
  4819. $msg = "Wi-Fi Connect > check_WiFi_Setting :: Wi-Fi Setting Not Exists -> Watch Face Select "
  4820. puts $msg
  4821. logcat($msg)
  4822. writelog($msg)
  4823. waitsecond(2)
  4824.  
  4825. pressHome
  4826. waitsecond(2)
  4827.  
  4828. wakeUp
  4829. waitsecond(2)
  4830.  
  4831. PDGUiDevice.getInstance.execShellCmd("am start -n com.google.android.apps.wearable.settings/com.google.android.clockwork.settings.SettingsActivity")
  4832. waitsecond(2)
  4833.  
  4834. gotoApp('Wi-Fi settings')
  4835. waitsecond(2)
  4836.  
  4837. if uiObj("TextView").resid("com.google.android.apps.wearable.settings:id/header").exists
  4838. $msg = "Wi-Fi Connect > check_WiFi_Setting :: Wi-Fi Setting ReStart"
  4839. puts $msg
  4840. logcat($msg)
  4841. writelog($msg)
  4842. waitsecond(2)
  4843.  
  4844. break
  4845. end
  4846. end
  4847. else
  4848. $msg = "Wi-Fi Connect > check_WiFi_Setting :: Wi-Fi Setting Exists"
  4849. puts $msg
  4850. break
  4851. end
  4852. end
  4853.  
  4854. waitsecond(2)
  4855. end
  4856.  
  4857. tcase << TestAction.new(:LogStart) do
  4858. logStartTest("05_01_10_02_WiFi")
  4859.  
  4860. waitsecond(2)
  4861. end
  4862.  
  4863. tcase << TestAction.new(:Check_WiFi_Off) do
  4864.  
  4865. if rand(100) < 0
  4866.  
  4867. wakeUp
  4868. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', 1501564852).with('textdescid', 1685752262).with('uniqueparentid', 1671061964)
  4869. .with('uitreeindex', 2)
  4870. .with('classname', 'TextView')
  4871. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4872. .with('text', 'OFF')
  4873.  
  4874. $ruiObj.isExist
  4875. ifFailJumpTo(:OpenAP_Down)
  4876.  
  4877. waitsecond(2)
  4878.  
  4879. end
  4880.  
  4881. end
  4882.  
  4883. tcase << TestAction.new(:Check_WiFi_Off) do
  4884. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  4885. .with('uitreeindex', 2)
  4886. .with('pretext', 'WiFi')
  4887. .with('classname', 'EditText')
  4888. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4889.  
  4890. $ruiObj.isExist
  4891. ifFailJumpTo(:OpenAP_Down)
  4892.  
  4893. waitsecond(2)
  4894. end
  4895.  
  4896. tcase << TestAction.new(:Click_WiFi_Off) do
  4897.  
  4898. if rand(100) < 0
  4899.  
  4900. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', 1501564852).with('textdescid', 1685752262).with('uniqueparentid', 0)
  4901. .with('uitreeindex', 2)
  4902. .with('classname', 'TextView')
  4903. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4904. .with('text', 'OFF')
  4905.  
  4906. $ruiObj.click
  4907.  
  4908. waitsecond(2)
  4909.  
  4910. end
  4911.  
  4912. end
  4913.  
  4914. tcase << TestAction.new(:Click_WiFi_Off) do
  4915. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  4916. .with('uitreeindex', 2)
  4917. .with('pretext', 'WiFi')
  4918. .with('classname', 'EditText')
  4919. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4920.  
  4921. $ruiObj.click
  4922.  
  4923. waitsecond(2)
  4924. end
  4925.  
  4926. tcase << TestAction.new(:wait4second_3) do
  4927. waitsecond(4)
  4928. end
  4929.  
  4930. tcase << TestAction.new(:OpenAP_Down) do
  4931. wakeUp
  4932.  
  4933. $res = WiFi_SearchDown(db('AP_name')[0])
  4934.  
  4935. if $res
  4936. puts " OpenAP Click OK"
  4937. end
  4938.  
  4939.  
  4940. waitsecond(2)
  4941. end
  4942.  
  4943. tcase << TestAction.new(:Connected_Check) do
  4944.  
  4945. if rand(100) < 0
  4946.  
  4947. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', -1641950834).with('textdescid', 396228524).with('uniqueparentid', 0)
  4948. .with('uitreeindex', 2)
  4949. .with('classname', 'TextView')
  4950. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4951. .with('text', 'Connected')
  4952.  
  4953. $ruiObj.isNotExist
  4954. ifFailJumpTo(:SavedNet_Down)
  4955.  
  4956. waitsecond(2)
  4957.  
  4958. end
  4959.  
  4960. end
  4961.  
  4962. tcase << TestAction.new(:Connected_Check) do
  4963. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  4964. .with('uitreeindex', 2)
  4965. .with('pretext', 'Connected')
  4966. .with('classname', 'EditText')
  4967. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4968.  
  4969. $ruiObj.isNotExist
  4970. ifFailJumpTo(:SavedNet_Down)
  4971.  
  4972. waitsecond(2)
  4973. end
  4974.  
  4975. tcase << TestAction.new(:OpenAP_Up) do
  4976. wakeUp
  4977.  
  4978. $res = WiFi_SearchUp(db('AP_name')[0])
  4979.  
  4980. if $res
  4981. puts " OpenAP Click OK"
  4982. end
  4983.  
  4984.  
  4985.  
  4986. waitsecond(2)
  4987. end
  4988.  
  4989. tcase << TestAction.new(:Connected_Check_1) do
  4990.  
  4991. if rand(100) < 0
  4992.  
  4993. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', -1641950834).with('textdescid', 396228524).with('uniqueparentid', 0)
  4994. .with('uitreeindex', 2)
  4995. .with('classname', 'TextView')
  4996. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  4997. .with('text', 'Connected')
  4998.  
  4999. $ruiObj.isNotExist
  5000. ifFailJumpTo(:SavedNet_Down)
  5001.  
  5002. waitsecond(2)
  5003.  
  5004. end
  5005.  
  5006. end
  5007.  
  5008. tcase << TestAction.new(:Connected_Check_1) do
  5009. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  5010. .with('uitreeindex', 2)
  5011. .with('pretext', 'Connected')
  5012. .with('classname', 'EditText')
  5013. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5014.  
  5015. $ruiObj.isNotExist
  5016. ifFailJumpTo(:SavedNet_Down)
  5017.  
  5018. waitsecond(2)
  5019. end
  5020.  
  5021. tcase << TestAction.new(:OpenAP_Down_1) do
  5022. wakeUp
  5023.  
  5024. $res = WiFi_SearchDown(db('AP_name')[0])
  5025.  
  5026. if $res
  5027. puts " OpenAP Click OK"
  5028. end
  5029.  
  5030.  
  5031.  
  5032. waitsecond(2)
  5033. end
  5034.  
  5035. tcase << TestAction.new(:Connected_Check_2) do
  5036.  
  5037. if rand(100) < 0
  5038.  
  5039. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', -1641950834).with('textdescid', 396228524).with('uniqueparentid', 0)
  5040. .with('uitreeindex', 2)
  5041. .with('classname', 'TextView')
  5042. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5043. .with('text', 'Connected')
  5044.  
  5045. $ruiObj.isNotExist
  5046. ifFailJumpTo(:SavedNet_Down)
  5047.  
  5048. waitsecond(2)
  5049.  
  5050. end
  5051.  
  5052. end
  5053.  
  5054. tcase << TestAction.new(:Connected_Check_2) do
  5055. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  5056. .with('uitreeindex', 2)
  5057. .with('pretext', 'Connected')
  5058. .with('classname', 'EditText')
  5059. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5060.  
  5061. $ruiObj.isNotExist
  5062. ifFailJumpTo(:SavedNet_Down)
  5063.  
  5064. waitsecond(2)
  5065. end
  5066.  
  5067. tcase << TestAction.new(:OpenAP_Up_1) do
  5068. wakeUp
  5069.  
  5070. $res = WiFi_SearchUp(db('AP_name')[0])
  5071.  
  5072. if $res
  5073. puts " OpenAP Click OK"
  5074. end
  5075.  
  5076. waitsecond(2)
  5077. end
  5078.  
  5079. tcase << TestAction.new(:Connected_Check_3) do
  5080.  
  5081. if rand(100) < 0
  5082.  
  5083. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', -1641950834).with('textdescid', 396228524).with('uniqueparentid', 0)
  5084. .with('uitreeindex', 2)
  5085. .with('classname', 'TextView')
  5086. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5087. .with('text', 'Connected')
  5088.  
  5089. $ruiObj.isNotExist
  5090. ifFailJumpTo(:SavedNet_Down)
  5091.  
  5092. waitsecond(2)
  5093.  
  5094. end
  5095.  
  5096. end
  5097.  
  5098. tcase << TestAction.new(:Connected_Check_3) do
  5099. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  5100. .with('uitreeindex', 2)
  5101. .with('classname', 'EditText')
  5102. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5103.  
  5104. $ruiObj.isNotExist
  5105. ifFailJumpTo(:SavedNet_Down)
  5106.  
  5107. waitsecond(2)
  5108. end
  5109.  
  5110. tcase << TestAction.new(:OpenAP_Down_2) do
  5111. wakeUp
  5112.  
  5113. $res = WiFi_SearchDown(db('AP_name')[0])
  5114.  
  5115. if $res
  5116. puts " OpenAP Click OK"
  5117. end
  5118.  
  5119.  
  5120. waitsecond(2)
  5121. end
  5122.  
  5123. tcase << TestAction.new(:Connected_Check_4) do
  5124.  
  5125. if rand(100) < 0
  5126.  
  5127. $ruiObj = RUIObject.new.with('objectid', -948971029).with('selfid', -1641950834).with('textdescid', 396228524).with('uniqueparentid', 0)
  5128. .with('uitreeindex', 2)
  5129. .with('classname', 'TextView')
  5130. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5131. .with('text', 'Connected')
  5132.  
  5133. $ruiObj.isNotExist
  5134. ifFailJumpTo(:SavedNet_Down)
  5135.  
  5136. waitsecond(2)
  5137.  
  5138. end
  5139.  
  5140. end
  5141.  
  5142. tcase << TestAction.new(:Connected_Check_4) do
  5143. $ruiObj = RUIObject.new.with('objectid', -302409456).with('selfid', -1258299808).with('textdescid', -784758512).with('uniqueparentid', 0)
  5144. .with('uitreeindex', 2)
  5145. .with('pretext', 'Connected')
  5146. .with('classname', 'EditText')
  5147. .with('resource-id', 'com.google.android.apps.wearable.settings:id/summary')
  5148.  
  5149. $ruiObj.isNotExist
  5150. ifFailJumpTo(:SavedNet_Down)
  5151.  
  5152. waitsecond(2)
  5153. end
  5154.  
  5155. tcase << TestAction.new(:OpenAP_Up_2) do
  5156. wakeUp
  5157.  
  5158. $res = WiFi_SearchUp(db('AP_name')[0])
  5159.  
  5160. if $res
  5161. puts " OpenAP Click OK"
  5162. end
  5163.  
  5164.  
  5165. waitsecond(2)
  5166. end
  5167.  
  5168. tcase << TestAction.new(:SavedNet_Down) do
  5169. wakeUp
  5170.  
  5171. $res = WiFi_SearchDown('Saved networks')
  5172.  
  5173. if $res
  5174. puts " Saved networks Click OK"
  5175. uiObj("TextView").text(db('AP_name')[0]).click
  5176. waitsecond(2)
  5177. uiObj("TextView").text(db('AP_name')[0]).click
  5178. waitsecond(2)
  5179.  
  5180. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  5181. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  5182. waitsecond(2)
  5183. end
  5184. end
  5185.  
  5186.  
  5187. waitsecond(2)
  5188. end
  5189.  
  5190. tcase << TestAction.new(:Saved_Check) do
  5191. $ruiObj = RUIObject.new.with('objectid', -606732848).with('selfid', 145677622).with('textdescid', 211532786).with('uniqueparentid', 0)
  5192. .with('uitreeindex', 2)
  5193. .with('classname', 'TextView')
  5194. .with('resource-id', 'com.google.android.apps.wearable.settings:id/header')
  5195. .with('text', 'Saved networks')
  5196.  
  5197. $ruiObj.isNotExist
  5198. ifFailJumpTo(:pressHome)
  5199.  
  5200. waitsecond(2)
  5201. end
  5202.  
  5203. tcase << TestAction.new(:SavedNet_Up) do
  5204. wakeUp
  5205.  
  5206. $res = WiFi_SearchUp('Saved networks')
  5207.  
  5208. if $res
  5209. puts " Saved networks Click OK"
  5210. uiObj("TextView").text(db('AP_name')[0]).click
  5211. waitsecond(2)
  5212. uiObj("TextView").text(db('AP_name')[0]).click
  5213. waitsecond(2)
  5214.  
  5215. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  5216. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  5217. waitsecond(2)
  5218. end
  5219. end
  5220.  
  5221.  
  5222. waitsecond(2)
  5223. end
  5224.  
  5225. tcase << TestAction.new(:Saved_Check_2) do
  5226. $ruiObj = RUIObject.new.with('objectid', -606732848).with('selfid', 145677622).with('textdescid', 211532786).with('uniqueparentid', 0)
  5227. .with('uitreeindex', 2)
  5228. .with('classname', 'TextView')
  5229. .with('resource-id', 'com.google.android.apps.wearable.settings:id/header')
  5230. .with('text', 'Saved networks')
  5231.  
  5232. $ruiObj.isNotExist
  5233. ifFailJumpTo(:pressHome)
  5234.  
  5235. waitsecond(2)
  5236. end
  5237.  
  5238. tcase << TestAction.new(:SavedNet_Down_1) do
  5239. wakeUp
  5240.  
  5241. $res = WiFi_SearchDown('Saved networks')
  5242.  
  5243. if $res
  5244. puts " Saved networks Click OK"
  5245. uiObj("TextView").text(db('AP_name')[0]).click
  5246. waitsecond(2)
  5247. uiObj("TextView").text(db('AP_name')[0]).click
  5248. waitsecond(2)
  5249.  
  5250. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  5251. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  5252. waitsecond(2)
  5253. end
  5254. end
  5255.  
  5256.  
  5257. waitsecond(2)
  5258. end
  5259.  
  5260. tcase << TestAction.new(:Saved_Check_3) do
  5261. $ruiObj = RUIObject.new.with('objectid', -606732848).with('selfid', 145677622).with('textdescid', 211532786).with('uniqueparentid', 0)
  5262. .with('uitreeindex', 2)
  5263. .with('classname', 'TextView')
  5264. .with('resource-id', 'com.google.android.apps.wearable.settings:id/header')
  5265. .with('text', 'Saved networks')
  5266.  
  5267. $ruiObj.isNotExist
  5268. ifFailJumpTo(:pressHome)
  5269.  
  5270. waitsecond(2)
  5271. end
  5272.  
  5273. tcase << TestAction.new(:SavedNet_Up_1) do
  5274. wakeUp
  5275.  
  5276. $res = WiFi_SearchUp('Saved networks')
  5277.  
  5278. if $res
  5279. puts " Saved networks Click OK"
  5280. uiObj("TextView").text(db('AP_name')[0]).click
  5281. waitsecond(2)
  5282. uiObj("TextView").text(db('AP_name')[0]).click
  5283. waitsecond(2)
  5284.  
  5285. if uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").exists
  5286. uiObj("Button").resid("com.google.android.apps.wearable.settings:id/confirm_button").clickAndWaitForNewWindow
  5287. waitsecond(2)
  5288. end
  5289. end
  5290.  
  5291.  
  5292. waitsecond(2)
  5293. end
  5294.  
  5295. tcase << TestAction.new(:pressHome) do
  5296. pressHome
  5297.  
  5298. waitsecond(2)
  5299. end
  5300.  
  5301. tcase << TestAction.new(:logStop) do
  5302. waitsecond(5)
  5303. logStopTest("05_01_10_02_WiFi")
  5304.  
  5305. waitsecond(2)
  5306. end
  5307.  
  5308. tcase.run(loopTime)
  5309.  
  5310. end
  5311.  
  5312. def self.wifiTurnOnOff_GotoApp(loopTime)
  5313.  
  5314. tcase = TestCase.new("wifiTurnOnOff_GotoApp")
  5315.  
  5316. tcase << TestAction.new(:LogStart) do
  5317. logStartTest("05_01_10_01_WiFi")
  5318.  
  5319. waitsecond(2)
  5320. end
  5321.  
  5322. tcase << TestAction.new(:pressMenu) do
  5323. for i in 0..5
  5324. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists and uiObj("TextView").text("Agenda").exists
  5325. break
  5326. else
  5327. pressKeyCode(4)
  5328. waitsecond(1)
  5329. end
  5330. end
  5331.  
  5332. waitsecond(2)
  5333. end
  5334.  
  5335. tcase << TestAction.new(:gotoApp_Settings) do
  5336. gotoApp('Settings')
  5337.  
  5338. waitsecond(2)
  5339. end
  5340.  
  5341. tcase << TestAction.new(:gotoApp_Connectivity) do
  5342. gotoApp('Connectivity')
  5343.  
  5344. waitsecond(2)
  5345. end
  5346.  
  5347. tcase << TestAction.new(:wait2second) do
  5348. waitsecond(2)
  5349. end
  5350.  
  5351. tcase << TestAction.new(:gotoApp_WiFi) do
  5352. gotoApp('Wi-Fi')
  5353.  
  5354. waitsecond(2)
  5355. end
  5356.  
  5357. tcase << TestAction.new(:TextView_Summary_Off_1) do
  5358. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', -196560128).with('textdescid', 893819486).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5359. .with('uitreeindex', 2)
  5360. .with('classname', 'TextView')
  5361. .with('resource-id', 'android:id/summary')
  5362. .with('text', 'Off')
  5363.  
  5364. $ruiObj.isNotExist
  5365. ifFailJumpTo(:TextView_Summary_Off_4)
  5366.  
  5367. waitsecond(2)
  5368. end
  5369.  
  5370. tcase << TestAction.new(:TextView_Summary_Automatic_1) do
  5371. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5372. .with('uitreeindex', 2)
  5373. .with('classname', 'TextView')
  5374. .with('resource-id', 'android:id/summary')
  5375. .with('text', 'Automatic')
  5376.  
  5377. $ruiObj.isNotExist
  5378. ifFailJumpTo(:TextView_Summary_Automatic_3)
  5379.  
  5380. waitsecond(2)
  5381. end
  5382.  
  5383. tcase << TestAction.new(:scriptAction_Check_On_1) do
  5384. $myFailReason = "WiFi is not Automatic and Off"
  5385. $myTestResult = false
  5386.  
  5387. waitsecond(2)
  5388. end
  5389.  
  5390. tcase << TestAction.new(:TextView_Summary_Automatic_2) do
  5391. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5392. .with('uitreeindex', 2)
  5393. .with('classname', 'TextView')
  5394. .with('resource-id', 'android:id/summary')
  5395. .with('text', 'Automatic')
  5396.  
  5397. $ruiObj.isExist
  5398. ifFailJumpTo(:LogStop)
  5399.  
  5400. waitsecond(2)
  5401. end
  5402.  
  5403. tcase << TestAction.new(:TextView_Summary_Automatic_3) do
  5404. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5405. .with('uitreeindex', 2)
  5406. .with('classname', 'TextView')
  5407. .with('resource-id', 'android:id/summary')
  5408. .with('text', 'Automatic')
  5409.  
  5410. $ruiObj.click
  5411.  
  5412. waitsecond(2)
  5413. end
  5414.  
  5415. tcase << TestAction.new(:CheckedTextView_Text1_AlwaysOff_1) do
  5416. $ruiObj = RUIObject.new.with('objectid', -1785732069).with('selfid', 1717427634).with('textdescid', 1930770269).with('uniqueparentid', 0).with('classresourceid', 2074814108)
  5417. .with('uitreeindex', 1)
  5418. .with('classname', 'CheckedTextView')
  5419. .with('resource-id', 'android:id/text1')
  5420. .with('text', 'Always off')
  5421.  
  5422. $ruiObj.click
  5423.  
  5424. waitsecond(8)
  5425. end
  5426.  
  5427. tcase << TestAction.new(:TextView_Summary_Off_2) do
  5428. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', -196560128).with('textdescid', 893819486).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5429. .with('uitreeindex', 2)
  5430. .with('classname', 'TextView')
  5431. .with('resource-id', 'android:id/summary')
  5432. .with('text', 'Off')
  5433.  
  5434. $ruiObj.isNotExist
  5435. ifFailJumpTo(:TextView_Summary_Off_4)
  5436.  
  5437. waitsecond(2)
  5438. end
  5439.  
  5440. tcase << TestAction.new(:scriptAction_Check_Off_1) do
  5441. $myFailReason = "Cannot Turn Off WiFi"
  5442. $myTestResult = false
  5443.  
  5444. waitsecond(2)
  5445. end
  5446.  
  5447. tcase << TestAction.new(:TextView_Summary_Off_3) do
  5448. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', -196560128).with('textdescid', 893819486).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5449. .with('uitreeindex', 2)
  5450. .with('classname', 'TextView')
  5451. .with('resource-id', 'android:id/summary')
  5452. .with('text', 'Off')
  5453.  
  5454. $ruiObj.isExist
  5455. ifFailJumpTo(:LogStop)
  5456.  
  5457. waitsecond(2)
  5458. end
  5459.  
  5460. tcase << TestAction.new(:TextView_Summary_Off_4) do
  5461. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', -196560128).with('textdescid', 893819486).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5462. .with('uitreeindex', 2)
  5463. .with('classname', 'TextView')
  5464. .with('resource-id', 'android:id/summary')
  5465. .with('text', 'Off')
  5466.  
  5467. $ruiObj.click
  5468.  
  5469. waitsecond(2)
  5470. end
  5471.  
  5472. tcase << TestAction.new(:CheckedTextView_Text1_Automatic) do
  5473. $ruiObj = RUIObject.new.with('objectid', -1785732069).with('selfid', 444003799).with('textdescid', -637381478).with('uniqueparentid', 0).with('classresourceid', 2074814108)
  5474. .with('uitreeindex', 0)
  5475. .with('classname', 'CheckedTextView')
  5476. .with('resource-id', 'android:id/text1')
  5477. .with('text', 'Automatic')
  5478.  
  5479. $ruiObj.click
  5480.  
  5481. waitsecond(2)
  5482. end
  5483.  
  5484. tcase << TestAction.new(:wait8second_1) do
  5485. waitsecond(8)
  5486. wakeUp
  5487. end
  5488.  
  5489. tcase << TestAction.new(:TextView_Summary_Automatic_4) do
  5490. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5491. .with('uitreeindex', 2)
  5492. .with('classname', 'TextView')
  5493. .with('resource-id', 'android:id/summary')
  5494. .with('text', 'Automatic')
  5495.  
  5496. $ruiObj.isNotExist
  5497. ifFailJumpTo(:TextView_Summary_Automatic_6)
  5498.  
  5499. waitsecond(2)
  5500. end
  5501.  
  5502. tcase << TestAction.new(:scriptAction_Check_On_2) do
  5503. $myFailReason = "Cannot Turn On WiFi"
  5504. $myTestResult = false
  5505.  
  5506. waitsecond(2)
  5507. end
  5508.  
  5509. tcase << TestAction.new(:TextView_Summary_Automatic_5) do
  5510. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5511. .with('uitreeindex', 2)
  5512. .with('classname', 'TextView')
  5513. .with('resource-id', 'android:id/summary')
  5514. .with('text', 'Automatic')
  5515.  
  5516. $ruiObj.isExist
  5517. ifFailJumpTo(:LogStop)
  5518.  
  5519. waitsecond(2)
  5520. end
  5521.  
  5522. tcase << TestAction.new(:TextView_Summary_Automatic_6) do
  5523. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', 1848839932).with('textdescid', -1445109918).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5524. .with('uitreeindex', 2)
  5525. .with('classname', 'TextView')
  5526. .with('resource-id', 'android:id/summary')
  5527. .with('text', 'Automatic')
  5528.  
  5529. $ruiObj.click
  5530.  
  5531. waitsecond(2)
  5532. end
  5533.  
  5534. tcase << TestAction.new(:CheckedTextView_Text1_AlwaysOff_2) do
  5535. $ruiObj = RUIObject.new.with('objectid', -1785732069).with('selfid', 1717427634).with('textdescid', 1930770269).with('uniqueparentid', 0).with('classresourceid', 2074814108)
  5536. .with('uitreeindex', 1)
  5537. .with('classname', 'CheckedTextView')
  5538. .with('resource-id', 'android:id/text1')
  5539. .with('text', 'Always off')
  5540.  
  5541. $ruiObj.click
  5542.  
  5543. waitsecond(2)
  5544. end
  5545.  
  5546. tcase << TestAction.new(:wait8second_2) do
  5547. waitsecond(8)
  5548. wakeUp
  5549. end
  5550.  
  5551. tcase << TestAction.new(:TextView_Summary_Off_5) do
  5552. $ruiObj = RUIObject.new.with('objectid', 1596966483).with('selfid', -196560128).with('textdescid', 893819486).with('uniqueparentid', 0).with('classresourceid', -1930775675)
  5553. .with('uitreeindex', 2)
  5554. .with('classname', 'TextView')
  5555. .with('resource-id', 'android:id/summary')
  5556. .with('text', 'Off')
  5557.  
  5558. $ruiObj.isNotExist
  5559. ifFailJumpTo(:LogStop)
  5560.  
  5561. waitsecond(2)
  5562. end
  5563.  
  5564. tcase << TestAction.new(:scriptAction_Check_Off_2) do
  5565. $myFailReason = "Cannot Turn Off WiFi"
  5566. $myTestResult = false
  5567.  
  5568. waitsecond(2)
  5569. end
  5570.  
  5571. tcase << TestAction.new(:LogStop) do
  5572. waitsecond(5)
  5573. logStopTest("05_01_10_01_WiFi")
  5574.  
  5575. waitsecond(2)
  5576. end
  5577.  
  5578. tcase << TestAction.new(:goto_Home) do
  5579. for i in 0..5
  5580. if uiObj("ImageView").resid("com.google.android.wearable.app:id/no_phone_icon").exists
  5581. if uiObj("ImageView").resid("com.google.android.wearable.app:id/icon").exists
  5582. pressKeyCode(4)
  5583. waitsecond(1)
  5584. else
  5585. break
  5586. end
  5587. else
  5588. pressKeyCode(4)
  5589. waitsecond(1)
  5590. end
  5591. end
  5592.  
  5593. waitsecond(2)
  5594. end
  5595.  
  5596. tcase.run(loopTime)
  5597.  
  5598. end
  5599.  
  5600. def self.exception_handler
  5601. puts "Module Exception Hanlder..."
  5602. end
  5603.  
  5604. def self.run(loop)
  5605. mainLoop loop
  5606. end
  5607.  
  5608. end
  5609.  
  5610. $exceptionPackageNameList = []
  5611. $exceptionPackageNameList_exclude = []
  5612.  
  5613. def exception_handler
  5614. Wear_MTBF_160728.exception_handler
  5615. end
  5616.  
  5617. $curProjectLogFile = $useLastLogFile
  5618.  
  5619. $curProjectLogFile = "Wear_MTBF_160728_#{getTimeStamp}.log" if $useLastLogFile.nil?
  5620.  
  5621. $useLastLogFile = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement