Skip to content

Commit b970166

Browse files
committed
1 parent 8534cf8 commit b970166

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

tests/build/android/build_android_tests.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@ def setUpClass(cls):
4040
Tns.create_app(cls.app_name)
4141
Tns.platform_add_android(attributes={"--path": cls.app_name, "--frameworkPath": ANDROID_RUNTIME_PATH})
4242

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+
4349
def setUp(self):
4450
BaseClass.setUp(self)
4551

4652
def tearDown(self):
4753
# Verify application state at the end of the test is correct
4854
if File.exists(self.app_name):
4955
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"
5458

5559
BaseClass.tearDown(self)
5660
Folder.cleanup(self.platforms_android + '/build/outputs')
@@ -64,13 +68,15 @@ def tearDownClass(cls):
6468
pass
6569

6670
def test_001_build_android(self):
67-
# Default `tns run android`
6871
Tns.build_android(attributes={"--path": self.app_name})
6972
assert File.pattern_exists(self.platforms_android, "*.aar")
7073
assert not File.pattern_exists(self.platforms_android, "*.plist")
7174
assert not File.pattern_exists(self.platforms_android, "*.android.js")
7275
assert not File.pattern_exists(self.platforms_android, "*.ios.js")
7376

77+
# Configs are respected
78+
assert 'debug' in File.read(os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, 'config.json'))
79+
7480
# And new platform specific file and verify next build is ok (test for issue #2697)
7581
src = os.path.join(self.app_name, 'app', 'app.js')
7682
dest_1 = os.path.join(self.app_name, 'app', 'new.android.js')
@@ -101,6 +107,9 @@ def test_002_build_android_release(self):
101107
"--release": ""
102108
})
103109

110+
# Configs are respected
111+
assert 'release' in File.read(os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, 'config.json'))
112+
104113
def test_200_build_android_inside_project_folder(self):
105114
Folder.navigate_to(self.app_name)
106115
output = Tns.build_android(tns_path=os.path.join("..", TNS_PATH), attributes={"--path": self.app_name},

0 commit comments

Comments
 (0)