@@ -40,17 +40,21 @@ def setUpClass(cls):
40
40
Tns .create_app (cls .app_name )
41
41
Tns .platform_add_android (attributes = {"--path" : cls .app_name , "--frameworkPath" : ANDROID_RUNTIME_PATH })
42
42
43
+ # Add release and debug configs
44
+ debug = os .path .join (cls .app_name , 'app' , 'config.debug.json' )
45
+ release = os .path .join (cls .app_name , 'app' , 'config.release.json' )
46
+ File .write (file_path = debug , text = '{"config":"debug"}' )
47
+ File .write (file_path = release , text = '{"config":"release"}' )
48
+
43
49
def setUp (self ):
44
50
BaseClass .setUp (self )
45
51
46
52
def tearDown (self ):
47
53
# Verify application state at the end of the test is correct
48
54
if File .exists (self .app_name ):
49
55
data = TnsAsserts .get_package_json (self .app_name )
50
- assert "tns-android" in data [
51
- "nativescript" ], "'tns-android' not found under `nativescript` inside package.json"
52
- assert "tns-android" not in data [
53
- "dependencies" ], "'tns-android' found under `dependencies` inside package.json"
56
+ assert "tns-android" in data ["nativescript" ], "'tns-android' not found under `nativescript` in package.json"
57
+ assert "tns-android" not in data ["dependencies" ], "'tns-android' found under `dependencies` in package.json"
54
58
55
59
BaseClass .tearDown (self )
56
60
Folder .cleanup (self .platforms_android + '/build/outputs' )
@@ -64,13 +68,15 @@ def tearDownClass(cls):
64
68
pass
65
69
66
70
def test_001_build_android (self ):
67
- # Default `tns run android`
68
71
Tns .build_android (attributes = {"--path" : self .app_name })
69
72
assert File .pattern_exists (self .platforms_android , "*.aar" )
70
73
assert not File .pattern_exists (self .platforms_android , "*.plist" )
71
74
assert not File .pattern_exists (self .platforms_android , "*.android.js" )
72
75
assert not File .pattern_exists (self .platforms_android , "*.ios.js" )
73
76
77
+ # Configs are respected
78
+ assert 'debug' in File .read (os .path .join (self .app_name , TnsAsserts .PLATFORM_ANDROID_APP_PATH , 'config.json' ))
79
+
74
80
# And new platform specific file and verify next build is ok (test for issue #2697)
75
81
src = os .path .join (self .app_name , 'app' , 'app.js' )
76
82
dest_1 = os .path .join (self .app_name , 'app' , 'new.android.js' )
@@ -101,6 +107,9 @@ def test_002_build_android_release(self):
101
107
"--release" : ""
102
108
})
103
109
110
+ # Configs are respected
111
+ assert 'release' in File .read (os .path .join (self .app_name , TnsAsserts .PLATFORM_ANDROID_APP_PATH , 'config.json' ))
112
+
104
113
def test_200_build_android_inside_project_folder (self ):
105
114
Folder .navigate_to (self .app_name )
106
115
output = Tns .build_android (tns_path = os .path .join (".." , TNS_PATH ), attributes = {"--path" : self .app_name },
0 commit comments