File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,13 @@ python3 open_setting_test.py -c sample_config.yml
94
94
python3 take_photo_test.py -c sample_config.yml
95
95
96
96
97
+ # -----------------------
98
+ # TEST 7
99
+ # -----------------------
100
+
101
+ python3 browser_test.py -c sample_config.yml
102
+
103
+
97
104
# -----------------------
98
105
# TEST ?
99
106
# -----------------------
Original file line number Diff line number Diff line change
1
+ from mobly import base_test
2
+ from mobly import test_runner
3
+ from mobly .controllers import android_device
4
+ import time
5
+
6
+ class BrowserTest (base_test .BaseTestClass ):
7
+ def setup_class (self ):
8
+ # This will run before any test method starts
9
+ print (">>> BrowserTest start" )
10
+ self .ads = self .register_controller (android_device )
11
+ self .dut = self .ads [0 ]
12
+
13
+ def test_open_browser (self ):
14
+ print (">>> Opening browser and visiting www.google.com" )
15
+ # Launch browser and visit www.google.com using adb shell
16
+ self .dut .adb .shell ('am start -a android.intent.action.VIEW -d "http://www.google.com"' )
17
+ time .sleep (5 ) # Wait for the page to load
18
+
19
+ def test_exit_browser (self ):
20
+ print (">>> Exiting browser" )
21
+ # Exit the browser using the back button (back to home screen or app list)
22
+ self .dut .adb .shell ('input keyevent 4' ) # Press back button
23
+ time .sleep (2 ) # Ensure the transition happens
24
+
25
+ def teardown_class (self ):
26
+ # This will run after all tests have finished
27
+ print (">>> BrowserTest completed" )
28
+
29
+ if __name__ == '__main__' :
30
+ test_runner .main ()
You can’t perform that action at this time.
0 commit comments