@@ -85,12 +85,20 @@ def test_background_reset
85
85
86
86
@driver . background_app ( -1 )
87
87
sleep 1 # to wait the app has gone
88
- error = assert_raises ::Selenium ::WebDriver ::Error ::WebDriverError do
89
- @driver . find_element :accessibility_id , 'App'
90
- end
91
- assert 'An element could not be located on the page using the given search parameters.' , error . message
88
+ assert @driver . app_state ( 'io.appium.android.apis' ) != :running_in_foreground
89
+
90
+ # Instrumentation process will crash in Espresso
91
+ if @@core . automation_name == :espresso
92
+ @driver . activate_app ( 'io.appium.android.apis' )
93
+ @@core . wait { assert @driver . app_state ( 'io.appium.android.apis' ) == :running_in_foreground }
94
+ else
95
+ error = assert_raises ::Selenium ::WebDriver ::Error ::WebDriverError do
96
+ @driver . find_element :accessibility_id , 'App'
97
+ end
98
+ assert 'An element could not be located on the page using the given search parameters.' , error . message
92
99
93
- @driver . reset
100
+ @driver . reset
101
+ end
94
102
95
103
e = @@core . wait ( timeout : 60 ) { @driver . find_element :accessibility_id , 'App' }
96
104
assert_equal 'App' , e . text
@@ -132,6 +140,8 @@ def test_app_string
132
140
end
133
141
134
142
def test_re_install
143
+ skip 'Instrumentation process will stop by remove_app in Espresso' if @@core . automation_name == :espresso
144
+
135
145
assert @driver . app_installed? ( 'io.appium.android.apis' )
136
146
137
147
@driver . remove_app 'io.appium.android.apis'
@@ -146,8 +156,11 @@ def test_re_install
146
156
def test_app_management
147
157
assert @driver . app_state ( 'io.appium.android.apis' ) == :running_in_foreground
148
158
149
- assert @driver . terminate_app ( 'io.appium.android.apis' )
150
- @@core . wait { assert @driver . app_state ( 'io.appium.android.apis' ) == :not_running }
159
+ # Instrumentation process will crash in Espresso
160
+ unless @@core . automation_name == :espresso
161
+ assert @driver . terminate_app ( 'io.appium.android.apis' )
162
+ @@core . wait { assert @driver . app_state ( 'io.appium.android.apis' ) == :not_running }
163
+ end
151
164
152
165
assert @driver . activate_app ( 'io.appium.android.apis' ) . nil?
153
166
@@core . wait { assert @driver . app_state ( 'io.appium.android.apis' ) == :running_in_foreground }
0 commit comments