1
1
import os
2
2
3
3
from core .base_test .tns_test import TnsTest
4
- from core .enums . app_type import AppType
4
+ from core .utils . file_utils import Folder
5
5
from data .apps import Apps
6
6
from core .settings import Settings
7
7
from data .templates import Template
8
8
from products .nativescript .tns import Tns
9
9
10
10
11
11
class CreateTests (TnsTest ):
12
- app_name_dash = "tns-app"
13
- app_name_space = "TNS App"
14
- app_name_123 = "123"
15
- app_name_app = "app"
16
12
app_data_JS = Apps .HELLO_WORLD_JS
17
13
app_data_TS = Apps .HELLO_WORLD_TS
18
14
app_data_NG = Apps .HELLO_WORLD_NG
19
15
20
16
js_app = Settings .AppName .DEFAULT + 'JS'
21
- js_source_project_dir = os .path .join (Settings .TEST_RUN_HOME , js_app )
22
- js_target_project_dir = os .path .join (Settings .TEST_RUN_HOME , 'data' , 'temp' , js_app )
23
-
24
17
ts_app = Settings .AppName .DEFAULT + 'TS'
25
-
26
18
ng_app = Settings .AppName .DEFAULT + 'NG'
27
- ng_source_project_dir = os .path .join (Settings .TEST_RUN_HOME , ng_app )
28
- ng_target_project_dir = os .path .join (Settings .TEST_RUN_HOME , 'data' , 'temp' , ng_app )
29
19
30
20
js_app_space = Settings .AppName .WITH_SPACE
21
+ js_app_dash = Settings .AppName .WITH_DASH
22
+ js_app_number = Settings .AppName .WITH_NUMBER
31
23
32
24
@classmethod
33
25
def setUpClass (cls ):
34
26
TnsTest .setUpClass ()
35
27
36
28
def setUp (self ):
37
29
TnsTest .setUp (self )
30
+ Folder .clean (os .path .join (Settings .TEST_RUN_HOME , 'folder' ))
31
+ Folder .clean (os .path .join (Settings .TEST_RUN_HOME , 'js_app_space' ))
32
+ Folder .clean (os .path .join (Settings .TEST_RUN_HOME , 'js_app_dash' ))
33
+ Folder .clean (os .path .join (Settings .TEST_RUN_HOME , 'js_app_number' ))
38
34
39
35
@classmethod
40
36
def tearDownClass (cls ):
41
37
TnsTest .tearDownClass ()
42
38
43
39
def test_001_create_app_like_real_user (self ):
44
40
Tns .create (app_name = self .js_app , app_data = None )
45
- s
41
+
46
42
def test_002_create_app_template_js (self ):
47
- Tns .create (app_name = self .js_app , template = Template .HELLO_WORLD_JS .local_package , app_data = self .app_data_JS )
43
+ """Create app with --template js project without update modules"""
44
+ Tns .create (app_name = self .js_app , template = Template .HELLO_WORLD_JS .local_package ,
45
+ app_data = self .app_data_JS , update = False , verify = False )
48
46
49
47
def test_003_create_app_template_ts (self ):
50
- Tns .create (app_name = self .ts_app , template = Template .HELLO_WORLD_TS .local_package , app_data = self .app_data_TS )
48
+ """Create app with --template ts project without update modules"""
49
+ Tns .create (app_name = self .ts_app , template = Template .HELLO_WORLD_TS .local_package ,
50
+ app_data = self .app_data_TS , update = False , verify = False )
51
51
52
52
def test_004_create_app_template_ng (self ):
53
- Tns .create (app_name = self .ng_app , template = Template .HELLO_WORLD_NG .local_package , app_data = self .app_data_NG )
53
+ """Create app with --template ng project without update modules"""
54
+ Tns .create (app_name = self .ng_app , template = Template .HELLO_WORLD_NG .local_package ,
55
+ app_data = self .app_data_NG , update = False , verify = False )
54
56
55
57
def test_005_create_project_with_path (self ):
56
58
"""Create project with --path option"""
59
+ Tns .create (app_name = self .js_app , template = Template .HELLO_WORLD_JS .local_package ,
60
+ app_data = self .app_data_JS , path = os .path .join (Settings .TEST_RUN_HOME , 'folder' , 'subfolder' ),
61
+ update = False , verify = False )
62
+ assert Folder .exists (os .path .join (Settings .TEST_RUN_HOME , 'folder' , 'subfolder' , 'TestAppJS' ))
57
63
58
64
def test_006_create_project_with_space (self ):
59
65
""" Create project with space is possible, but packageId will skip the space symbol"""
60
- Tns .create (app_name = self .js_app_space , template = Template .HELLO_WORLD_JS .local_package , app_data = self .app_data_JS )
66
+ Tns .create (app_name = self .js_app_space , template = Template .HELLO_WORLD_JS .local_package ,
67
+ app_data = self .app_data_JS , update = False , verify = False )
68
+
69
+ def test_007_create_project_with_space (self ):
70
+ """ Create project with dash is possible, but packageId will skip the dash symbol"""
71
+ Tns .create (app_name = self .js_app_dash , template = Template .HELLO_WORLD_JS .local_package ,
72
+ app_data = self .app_data_JS , update = False , verify = False )
73
+
74
+ def test_008_create_project_named_123 (self ):
75
+ """Create app starting with digits should not be possible without --force option"""
76
+ Tns .create (app_name = self .js_app_number , template = Template .HELLO_WORLD_JS .local_package ,
77
+ app_data = self .app_data_JS , update = False , verify = False )
78
+ #TODO: package_json contains
79
+
80
+ def test_009_create_project_with_appid (self ):
81
+ """Create project with --appid option"""
82
+ Tns .create (app_name = self .js_app , template = Template .HELLO_WORLD_JS .local_package ,app_data = self .app_data_JS ,
83
+ update = False , verify = False , app_id = 'org.nativescript.MyApp' )
0 commit comments