1
+ describe 'common/device' do
2
+ # Not yet implemented
3
+ t 'shake' do
4
+ end
5
+
6
+ t 'remove & install' do
7
+ #remove 'com.example.android.apis'
8
+ #install ENV['APP_PATH']
9
+ end
10
+
11
+ t 'background_app' do
12
+ background_app 5
13
+ end
14
+
15
+ t 'is_installed' do
16
+ is_installed? ( 'fake_app' ) . must_equal false
17
+ end
18
+
19
+ t 'reset' do
20
+ reset
21
+ s_texts [ 0 ] . must_equal 'API Demos'
22
+ end
23
+
24
+ t 'close & launch' do
25
+ closeApp
26
+ launch
27
+ end
28
+
29
+ t 'current_activity' do
30
+ current_activity . must_equal '.ApiDemos'
31
+ end
32
+
33
+ t 'available_contexts' do
34
+ available_contexts . must_equal [ "NATIVE_APP" ]
35
+ end
36
+
37
+ t 'current_context' do
38
+ current_context . must_equal "NATIVE_APP"
39
+ end
40
+
41
+ t 'current_context=' do
42
+ current_context = "WEBVIEW"
43
+ current_context . must_equal "WEBVIEW"
44
+ end
45
+
46
+ t 'within_context' do
47
+ $driver. within_context "NATIVE_APP" do
48
+ current_context . must_equal "NATIVE_APP"
49
+ end
50
+ end
51
+
52
+ t 'switch_to_default_context' do
53
+ switch_to_default_context
54
+ current_context . must_equal 'NATIVE_APP'
55
+ end
56
+
57
+ t 'app_strings' do
58
+ strs = app_strings
59
+ strs . has_key? ( "activity_save_restore" ) . must_equal true
60
+ end
61
+
62
+ t 'complex_find' do
63
+ act = complex_find [ [ 3 , 'Accessibility' ] , [ 14 , true ] ]
64
+ act . class . must_equal Selenium ::WebDriver ::Element
65
+ end
66
+
67
+ t 'action_chain' do
68
+ e = find_element ( :name , "Accessibility" )
69
+ Appium ::TouchAction . new . press ( :element => e , x : 0.5 , y : 0.5 ) . release ( :element => e ) . perform
70
+ sleep 2
71
+ find_element ( :name , "Custom View" )
72
+ back
73
+ end
74
+
75
+ t 'swipe' do
76
+ Appium ::TouchAction . new . swipe ( start_x : 0.75 , start_y : 0.25 , end_x : 0.75 , end_y : 0.5 , duration : 1.5 ) . perform
77
+ end
78
+
79
+ t 'pinch & zoom' do
80
+ s_text ( 'Graphics' ) . click
81
+ s_text ( 'BitmapMesh' ) . click
82
+ zoom 200
83
+ pinch 75
84
+ end
85
+
86
+ t 'push and pull file' do
87
+ file = "A Fine Day"
88
+ path = "/data/local/tmp/remote.txt"
89
+ push_file path , file
90
+ read_file = pull_file path
91
+ read_file . must_equal file
92
+ end
93
+ end
0 commit comments