Skip to content

Commit b8b5c8d

Browse files
committed
1 parent 3f5f8b8 commit b8b5c8d

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

core/tns/tns.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,16 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
351351
else:
352352
assert config_debug in output
353353

354+
entitlements_path = app_name + '/platforms/ios/' + app_id + '/' + app_id + '.entitlements'
355+
assert File.exists(entitlements_path), "Entitlements file is missing!"
356+
assert 'dict' in File.read(entitlements_path), "Entitlements file content is wrong!"
357+
354358
# Verify simulator/device builds
355359
device_folder = app_name + "/platforms/ios/build/device/"
356360
emu_folder = app_name + "/platforms/ios/build/emulator/"
357361
if "--forDevice" in attributes.keys() or "--for-device" in attributes.keys():
358362
assert "build/device/" + app_id + ".app" in output
359-
assert File.exists(device_folder + app_id + ".ipa")
363+
assert File.exists(device_folder + app_id + ".ipa"), "IPA file not found!"
360364
bundle_content = File.read(device_folder + app_id + ".app/" + app_id)
361365
else:
362366
assert "build/emulator/" + app_id + ".app" in output
@@ -445,7 +449,8 @@ def disable_reporting():
445449
Tns.run_tns_command("error-reporting disable")
446450

447451
@staticmethod
448-
def wait_for_log(log_file, string_list, not_existing_string_list=None, timeout=30, check_interval=3, clean_log=True):
452+
def wait_for_log(log_file, string_list, not_existing_string_list=None, timeout=30, check_interval=3,
453+
clean_log=True):
449454
"""
450455
Wait until log file contains list of string.
451456
:param log_file: Path to log file.

data/entitlements/app.entitlements

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>aps-environment</key>
6+
<string>development</string>
7+
</dict>
8+
</plist>

tests/build/ios/build_ios_tests.py

+18
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,24 @@ def test_311_build_ios_release_with_copy_to(self):
138138
Tns.build_ios(attributes={"--path": self.app_name, "--forDevice": "", "--release": "", "--copy-to": "./"})
139139
assert File.exists("TestApp.ipa")
140140

141+
def test_320_build_ios_with_custom_entitlements(self):
142+
Tns.create_app(self.app_name)
143+
Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
144+
Tns.build_ios(attributes={"--path": self.app_name})
145+
146+
# Add entitlements in app/App_Resources/iOS/app.entitlements
147+
source = os.path.join(TEST_RUN_HOME, 'data', 'entitlements', 'app.entitlements')
148+
target = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'app.entitlements')
149+
File.copy(src=source, dest=target)
150+
151+
# Build again and verify entitlements are merged
152+
Tns.build_ios(attributes={"--path": self.app_name})
153+
entitlements_path = self.app_name + '/platforms/ios/' + self.app_name + '/' + self.app_name + '.entitlements'
154+
assert File.exists(entitlements_path), "Entitlements file is missing!"
155+
entitlements_content = File.read(entitlements_path)
156+
assert '<key>aps-environment</key>' in entitlements_content, "Entitlements file content is wrong!"
157+
assert '<string>development</string>' in entitlements_content, "Entitlements file content is wrong!"
158+
141159
def test_400_build_ios_with_wrong_param(self):
142160
Tns.create_app(self.app_name_noplatform)
143161
output = Tns.build_ios(attributes={"--path": self.app_name_noplatform, "--" + invalid: ""},

0 commit comments

Comments
 (0)