@@ -16,11 +16,39 @@ def test_open_browser(self):
16
16
self .dut .adb .shell ('am start -a android.intent.action.VIEW -d "http://www.google.com"' )
17
17
time .sleep (5 ) # Wait for the page to load
18
18
19
+ self .dut .adb .shell ('am start -a android.intent.action.VIEW -d "http://www.github.com"' )
20
+ time .sleep (5 ) # Wait for the page to load
21
+ self .search_github ()
22
+
23
+
24
+ def search_github (self ):
25
+ print (">>> Searching for 'github' on Google" )
26
+
27
+ # Focus on the search bar: tapping on the search bar (coordinates need to be accurate)
28
+ self .dut .adb .shell ('input tap 540 160' ) # Coordinates for the Google search bar (adjust as needed)
29
+ time .sleep (1 ) # Give it some time to focus
30
+
31
+ # Simulate typing 'github' into the search box
32
+ self .dut .adb .shell ('input text "github"' )
33
+ time .sleep (1 ) # Allow time for the text to be typed in
34
+
35
+ # Simulate pressing the search button (Enter key)
36
+ self .dut .adb .shell ('input keyevent 66' ) # Enter key (search)
37
+ time .sleep (3 ) # Wait for the search results to load
38
+
39
+ def test_click_first_result (self ):
40
+ print (">>> Clicking the first search result for GitHub" )
41
+ # Simulate clicking the first result (coordinates of the first result)
42
+ # Coordinates for first result can be different based on your device or screen resolution,
43
+ # you may need to adjust it based on your test device's screen size.
44
+ self .dut .adb .shell ('input tap 540 960' ) # Example coordinates for tapping on the first result
45
+ time .sleep (5 ) # Wait for the page to load
46
+
19
47
def test_exit_browser (self ):
20
48
print (">>> Exiting browser" )
21
49
# Exit the browser using the back button (back to home screen or app list)
22
50
self .dut .adb .shell ('input keyevent 4' ) # Press back button
23
- time .sleep (2 ) # Ensure the transition happens
51
+ time .sleep (1 ) # Ensure the transition happens
24
52
25
53
def teardown_class (self ):
26
54
# This will run after all tests have finished
0 commit comments