5
5
from core .device .emulator import Emulator
6
6
from core .device .simulator import Simulator
7
7
from core .npm .npm import Npm
8
+ from core .osutils .file import File
8
9
from core .osutils .os_type import OSType
9
10
from core .settings .settings import ANDROID_KEYSTORE_PATH , \
10
11
ANDROID_KEYSTORE_PASS , ANDROID_KEYSTORE_ALIAS , ANDROID_KEYSTORE_ALIAS_PASS , EMULATOR_ID , CURRENT_OS , \
@@ -61,16 +62,15 @@ def apply_changes(app_name, log, platform):
61
62
ReplaceHelper .replace (app_name , WebPackHelloWorldTS .ts_change , sleep = 10 )
62
63
if platform == Platform .ANDROID :
63
64
text_changed = Device .wait_for_text (device_id = EMULATOR_ID , text = '42 clicks left' , timeout = 20 )
64
- assert text_changed , 'Changes in JS file not applied (UI is not refreshed).'
65
+ assert text_changed , 'Changes in TS file not applied (UI is not refreshed).'
65
66
66
67
ReplaceHelper .replace (app_name , WebPackHelloWorldTS .xml_change , sleep = 10 )
67
68
if platform == Platform .ANDROID :
68
69
text_changed = Device .wait_for_text (device_id = EMULATOR_ID , text = 'TEST' )
69
70
assert text_changed , 'Changes in XML file not applied (UI is not refreshed).'
70
71
71
72
ReplaceHelper .replace (app_name , WebPackHelloWorldTS .css_change , sleep = 10 )
72
- if platform == Platform .ANDROID :
73
- Tns .wait_for_log (log_file = log , string_list = ['app.css' ], clean_log = False )
73
+ Tns .wait_for_log (log_file = log , string_list = ['app.css' ], clean_log = False )
74
74
75
75
Tns .wait_for_log (log_file = log , string_list = Helpers .wp_sync , not_existing_string_list = Helpers .wp_errors ,
76
76
timeout = 120 )
@@ -84,10 +84,26 @@ def apply_changes(app_name, log, platform):
84
84
85
85
@staticmethod
86
86
def revert_changes (app_name , log , platform ):
87
+
88
+ # Clean old logs
89
+ if CURRENT_OS is not OSType .WINDOWS :
90
+ File .write (file_path = log , text = "" )
91
+
87
92
# Revert changes
88
- ReplaceHelper .rollback (app_name , WebPackHelloWorldTS .ts_change , sleep = 10 )
89
93
ReplaceHelper .rollback (app_name , WebPackHelloWorldTS .xml_change , sleep = 10 )
94
+ Tns .wait_for_log (log_file = log , string_list = ['main-page.xml' ], clean_log = False )
95
+ if platform == Platform .ANDROID :
96
+ text_changed = Device .wait_for_text (device_id = EMULATOR_ID , text = 'TAP' )
97
+ assert text_changed , 'Changes in XML file not applied (UI is not refreshed).'
98
+
99
+ ReplaceHelper .rollback (app_name , WebPackHelloWorldTS .ts_change , sleep = 10 )
100
+ Tns .wait_for_log (log_file = log , string_list = ['main-view-model.ts' ], clean_log = False )
101
+ if platform == Platform .ANDROID :
102
+ text_changed = Device .wait_for_text (device_id = EMULATOR_ID , text = '42 taps left' , timeout = 20 )
103
+ assert text_changed , 'Changes in TS file not applied (UI is not refreshed).'
104
+
90
105
ReplaceHelper .rollback (app_name , WebPackHelloWorldTS .css_change , sleep = 10 )
106
+ Tns .wait_for_log (log_file = log , string_list = ['app.css' ], clean_log = False )
91
107
92
108
# Verify application looks correct
93
109
Tns .wait_for_log (log_file = log , string_list = Helpers .wp_sync , not_existing_string_list = Helpers .wp_errors ,
@@ -133,10 +149,6 @@ def test_100_android_build_release_with_bundle_and_uglify(self):
133
149
134
150
@unittest .skipIf (CURRENT_OS != OSType .OSX , "Run only on macOS." )
135
151
def test_100_ios_build_release_with_bundle_and_uglify (self ):
136
- # Hack due to https://github.com/NativeScript/nativescript-cli/issues/3415
137
- Tns .platform_remove (platform = Platform .IOS , attributes = {"--path" : self .app_name })
138
- Tns .platform_add_ios (attributes = {'--path' : self .app_name , '--frameworkPath' : IOS_PACKAGE })
139
-
140
152
Tns .build_ios (attributes = {"--path" : self .app_name , "--release" : "" , "--for-device" : "" , "--bundle" : "" ,
141
153
"--env.uglify" : "" })
142
154
@@ -181,7 +193,7 @@ def test_200_run_android_with_bundle_sync_changes(self):
181
193
"--bundle" : "" ,
182
194
'--device' : EMULATOR_ID }, wait = False , assert_success = False )
183
195
Tns .wait_for_log (log_file = log , string_list = Helpers .wp_run , not_existing_string_list = Helpers .wp_errors ,
184
- timeout = 180 )
196
+ timeout = 240 , check_interval = 10 )
185
197
Helpers .android_screen_match (image = self .image_original , timeout = 120 )
186
198
Helpers .wait_webpack_watcher ()
187
199
@@ -206,7 +218,7 @@ def test_210_run_android_with_bundle_uglify_sync_changes(self):
206
218
"--env.uglify" : "" ,
207
219
'--device' : EMULATOR_ID }, wait = False , assert_success = False )
208
220
Tns .wait_for_log (log_file = log , string_list = Helpers .wp_run , not_existing_string_list = Helpers .wp_errors ,
209
- timeout = 180 )
221
+ timeout = 240 )
210
222
Helpers .android_screen_match (image = self .image_original , timeout = 120 )
211
223
Helpers .wait_webpack_watcher ()
212
224
0 commit comments