3
3
"""
4
4
5
5
import os
6
+
6
7
from core .enums .app_type import AppType
7
8
from core .enums .platform_type import Platform
8
9
from core .settings import Settings
9
10
from data .changes import Changes , Sync
10
11
from data .const import Colors
12
+ from products .nativescript .preview_helpers import Preview
11
13
from products .nativescript .run_type import RunType
12
14
from products .nativescript .tns import Tns
13
15
from products .nativescript .tns_logs import TnsLogs
14
- from products .nativescript .preview_helpers import Preview
15
16
16
17
17
18
def sync_hello_world_ng (app_name , platform , device , bundle = False , uglify = False , aot = False , hmr = False ,
18
- instrumented = True , app_type = AppType . NG ):
19
+ instrumented = True ):
19
20
result = Tns .run (app_name = app_name , platform = platform , emulator = True , wait = False ,
20
21
bundle = bundle , aot = aot , uglify = uglify , hmr = hmr )
21
22
# Check logs
22
- strings = TnsLogs .run_messages (app_name = app_name , platform = platform , bundle = bundle ,
23
- hmr = hmr , instrumented = instrumented , app_type = app_type )
23
+ strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType . UNKNOWN , bundle = bundle ,
24
+ hmr = hmr , instrumented = instrumented , app_type = AppType . NG )
24
25
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 300 )
25
26
26
27
# Verify it looks properly
@@ -33,7 +34,7 @@ def sync_hello_world_ng(app_name, platform, device, bundle=False, uglify=False,
33
34
Sync .replace (app_name = app_name , change_set = Changes .NGHelloWorld .TS )
34
35
device .wait_for_text (text = Changes .NGHelloWorld .TS .new_text )
35
36
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
36
- file_name = 'item.service.ts' , hmr = hmr , instrumented = instrumented , app_type = app_type )
37
+ file_name = 'item.service.ts' , hmr = hmr , instrumented = instrumented , app_type = AppType . NG )
37
38
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
38
39
39
40
Sync .replace (app_name = app_name , change_set = Changes .NGHelloWorld .HTML )
@@ -46,7 +47,7 @@ def sync_hello_world_ng(app_name, platform, device, bundle=False, uglify=False,
46
47
assert not device .is_text_visible (text = Changes .NGHelloWorld .TS .new_text )
47
48
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
48
49
file_name = 'items.component.html' , hmr = hmr , instrumented = instrumented ,
49
- app_type = app_type , aot = aot )
50
+ app_type = AppType . NG , aot = aot )
50
51
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
51
52
52
53
Sync .replace (app_name = app_name , change_set = Changes .NGHelloWorld .CSS )
@@ -59,38 +60,37 @@ def sync_hello_world_ng(app_name, platform, device, bundle=False, uglify=False,
59
60
device .wait_for_text (text = number )
60
61
assert not device .is_text_visible (text = Changes .NGHelloWorld .TS .new_text )
61
62
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
62
- file_name = 'app.css' , hmr = hmr , instrumented = instrumented , app_type = app_type )
63
+ file_name = 'app.css' , hmr = hmr , instrumented = instrumented , app_type = AppType . NG )
63
64
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
64
65
65
66
# Revert changes
66
67
Sync .revert (app_name = app_name , change_set = Changes .NGHelloWorld .HTML )
67
68
device .wait_for_text (text = Changes .NGHelloWorld .TS .new_text )
68
69
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
69
70
file_name = 'items.component.html' , hmr = hmr , instrumented = instrumented ,
70
- app_type = app_type , aot = aot )
71
+ app_type = AppType . NG , aot = aot )
71
72
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
72
73
73
74
Sync .revert (app_name = app_name , change_set = Changes .NGHelloWorld .TS )
74
75
device .wait_for_text (text = Changes .NGHelloWorld .TS .old_text )
75
76
device .wait_for_main_color (color = Colors .DARK )
76
77
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
77
- file_name = 'item.service.ts' , hmr = hmr , instrumented = instrumented , app_type = app_type )
78
+ file_name = 'item.service.ts' , hmr = hmr , instrumented = instrumented , app_type = AppType . NG )
78
79
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
79
80
80
81
Sync .revert (app_name = app_name , change_set = Changes .NGHelloWorld .CSS )
81
82
device .wait_for_main_color (color = Colors .WHITE )
82
83
device .wait_for_text (text = Changes .NGHelloWorld .TS .old_text )
83
84
strings = TnsLogs .run_messages (app_name = app_name , platform = platform , run_type = RunType .INCREMENTAL , bundle = bundle ,
84
- file_name = 'app.css' , hmr = hmr , instrumented = instrumented , app_type = app_type )
85
+ file_name = 'app.css' , hmr = hmr , instrumented = instrumented , app_type = AppType . NG )
85
86
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 180 )
86
87
87
88
# Assert final and initial states are same
88
89
device .screen_match (expected_image = initial_state , tolerance = 1.0 , timeout = 30 )
89
90
90
91
91
- def preview_hello_world_ng (app_name , platform , device , bundle = False , hmr = False , uglify = False , aot = False ,
92
- instrumented = False ):
93
- result = Preview .run_app (app_name = app_name , bundle = bundle , hmr = hmr , aot = aot , uglify = uglify , platform = platform ,
92
+ def preview_hello_world_ng (app_name , platform , device , bundle = False , hmr = False , instrumented = False ):
93
+ result = Preview .run_app (app_name = app_name , bundle = bundle , hmr = hmr , platform = platform ,
94
94
device = device , instrumented = instrumented )
95
95
96
96
# Verify app looks properly
@@ -101,10 +101,9 @@ def preview_hello_world_ng(app_name, platform, device, bundle=False, hmr=False,
101
101
return result
102
102
103
103
104
- def preview_sync_hello_world_ng (app_name , platform , device , bundle = False , hmr = False , uglify = False ,
105
- aot = False , instrumented = False ):
104
+ def preview_sync_hello_world_ng (app_name , platform , device , bundle = False , hmr = False , instrumented = False ):
106
105
result = preview_hello_world_ng (app_name = app_name , platform = platform , device = device , bundle = bundle , hmr = hmr ,
107
- uglify = uglify , aot = aot , instrumented = instrumented )
106
+ instrumented = instrumented )
108
107
109
108
# Edit TS file and verify changes are applied
110
109
Sync .replace (app_name = app_name , change_set = Changes .NGHelloWorld .TS )
0 commit comments