@@ -158,3 +158,61 @@ def test_202_test_foreground_service_without_oncreate_method_is_working(self):
158
158
assert service_name not in service_info , "{0} service found! Logs: {1}" .format (service_name , service_info )
159
159
assert pid not in service_info , "{0} service with id {1} found! Logs: {2}" .format (service_name , pid ,
160
160
service_info )
161
+
162
+ def test_203_test_foreground__intent_service_without_oncreate_method_is_working_api23 (self ):
163
+ """
164
+ https://github.com/NativeScript/android-runtime/issues/1426
165
+ """
166
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
167
+ 'android-runtime-1426' , 'AndroidManifest.xml' ),
168
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'App_Resources' , 'Android' , 'src' , 'main' ,
169
+ 'AndroidManifest.xml' ), True )
170
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
171
+ 'android-runtime-1426' , 'app.js' ),
172
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'app.js' ), True )
173
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
174
+ 'android-runtime-1426' , 'main-view-model.js' ),
175
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'main-view-model.js' ), True )
176
+ log = Tns .run_android (APP_NAME , device = self .emulator .id , wait = False , verify = False )
177
+ strings = ['Successfully synced application' , 'on device' , self .emulator .id ]
178
+ test_result = Wait .until (lambda : all (string in File .read (log .log_file ) for string in strings ), timeout = 240 ,
179
+ period = 5 )
180
+ assert test_result , "App not build correctly ! Logs: " + File .read (log .log_file )
181
+
182
+ Device .wait_for_text (self .emulator , text = 'TAP' , timeout = 20 )
183
+ Device .click (self .emulator , text = "TAP" , case_sensitive = True )
184
+ time .sleep (5 )
185
+ test_result = Wait .until (lambda : "Intent Handled!" in File .read (log .log_file ), timeout = 30 ,
186
+ period = 5 )
187
+ assert test_result , "Intent service is not working! Missing Log! Logs: " + File .read (log .log_file )
188
+
189
+ def test_204_test_foreground__intent_service_without_oncreate_method_is_working_api28 (self ):
190
+ """
191
+ https://github.com/NativeScript/android-runtime/issues/1426
192
+ """
193
+ DeviceManager .Emulator .stop ()
194
+ self .emulator = DeviceManager .Emulator .ensure_available (Emulators .EMU_API_28 )
195
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
196
+ 'android-runtime-1426' , 'AndroidManifest.xml' ),
197
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'App_Resources' , 'Android' , 'src' , 'main' ,
198
+ 'AndroidManifest.xml' ), True )
199
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
200
+ 'android-runtime-1426' , 'app.js' ),
201
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'app.js' ), True )
202
+ File .copy (os .path .join (TEST_RUN_HOME , 'assets' , 'runtime' , 'android' , 'files' ,
203
+ 'android-runtime-1426' , 'main-view-model.js' ),
204
+ os .path .join (TEST_RUN_HOME , APP_NAME , 'app' , 'main-view-model.js' ), True )
205
+ log = Tns .run_android (APP_NAME , device = self .emulator .id , wait = False , verify = False )
206
+ strings = ['Successfully synced application' , 'on device' , self .emulator .id ]
207
+ test_result = Wait .until (lambda : all (string in File .read (log .log_file ) for string in strings ), timeout = 240 ,
208
+ period = 5 )
209
+ assert test_result , "App not build correctly ! Logs: " + File .read (log .log_file )
210
+
211
+ Device .wait_for_text (self .emulator , text = 'TAP' , timeout = 20 )
212
+ Device .click (self .emulator , text = "TAP" , case_sensitive = True )
213
+ time .sleep (5 )
214
+ test_result = Wait .until (lambda : "Intent Handled!" in File .read (log .log_file ), timeout = 30 ,
215
+ period = 5 )
216
+ assert test_result , "Intent service is not working! Missing Log! Logs: " + File .read (log .log_file )
217
+ DeviceManager .Emulator .stop ()
218
+ self .emulator = DeviceManager .Emulator .ensure_available (Emulators .DEFAULT )
0 commit comments