Skip to content

Commit 44f4735

Browse files
committed
1 parent a870832 commit 44f4735

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

core/settings/strings.py

-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
deployed_on_device = "Successfully deployed on device"
5454
installed_plugin = "Successfully installed plugin {0}"
5555
tns_plugin = "tns-plugin"
56-
codesign = "CodeSign"
57-
nativescript_theme_core = "nativescript-theme-core"
5856
devDependencies = "devDependencies"
5957
started_on_device = "Successfully started on device with identifier"
6058

core/tns/tns.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
A wrapper of tns commands.
33
"""
44
import os
5+
56
import time
67

78
from core.npm.npm import Npm
@@ -10,9 +11,8 @@
1011
from core.osutils.folder import Folder
1112
from core.osutils.os_type import OSType
1213
from core.osutils.process import Process
13-
from core.settings.settings import TNS_PATH, SUT_FOLDER, DEVELOPMENT_TEAM, TEST_RUN_HOME, \
14-
COMMAND_TIMEOUT, CURRENT_OS, TAG
15-
from core.settings.strings import codesign
14+
from core.settings.settings import COMMAND_TIMEOUT, TNS_PATH, TAG, TEST_RUN_HOME, DEVELOPMENT_TEAM, CURRENT_OS, \
15+
SUT_FOLDER
1616
from core.tns.tns_platform_type import Platform
1717
from core.tns.tns_verifications import TnsAsserts
1818
from core.xcode.xcode import Xcode
@@ -231,10 +231,7 @@ def platform_add(platform=Platform.NONE, version=None, attributes={}, assert_suc
231231
output = Tns.run_tns_command("platform add " + platform_string, attributes=attributes, log_trace=log_trace,
232232
tns_path=tns_path)
233233

234-
#######################################################################################
235-
# Verify platforms added (if assert_success=True)
236-
#######################################################################################
237-
234+
# Verify platforms added
238235
app_name = Tns.__get_app_name_from_attributes(attributes)
239236
if assert_success:
240237
TnsAsserts.platform_added(app_name=app_name, platform=platform, output=output)
@@ -331,6 +328,14 @@ def prepare_ios(attributes={}, assert_success=True, log_trace=False, tns_path=No
331328
output = Tns.run_tns_command("prepare ios ", attributes=attributes, log_trace=log_trace, tns_path=tns_path)
332329
if assert_success:
333330
assert "Project successfully prepared" in output
331+
332+
# Verify TEAM_ID
333+
if "--for-device" in attributes.keys() or "--forDevice" in attributes.keys():
334+
app_name = Tns.__get_app_name_from_attributes(attributes=attributes)
335+
app_id = Tns.__get_final_package_name(app_name, platform=Platform.IOS)
336+
output = File.read(app_name + '/platforms/ios/' + app_id + 'TestApp' + '.xcodeproj/project.pbxproj')
337+
assert DEVELOPMENT_TEAM in output, "TeamID not passed to Xcode project!"
338+
334339
return output
335340

336341
@staticmethod
@@ -370,15 +375,17 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
370375
attr = {"--teamId": DEVELOPMENT_TEAM}
371376
attributes.update(attr)
372377
output = Tns.run_tns_command("build ios", attributes=attributes, tns_path=tns_path)
378+
379+
app_name = Tns.__get_app_name_from_attributes(attributes=attributes)
380+
app_name = app_name.replace("\"", "") # Handle projects with space
381+
app_id = Tns.__get_final_package_name(app_name, platform=Platform.IOS)
382+
373383
if assert_success:
374384
assert "BUILD SUCCEEDED" in output
375385
assert "Project successfully built" in output
376386
assert "ERROR" not in output
377387
assert "malformed" not in output
378-
assert codesign in output
379-
app_name = Tns.__get_app_name_from_attributes(attributes=attributes)
380-
app_id = Tns.__get_final_package_name(app_name, platform=Platform.IOS)
381-
app_name = app_name.replace("\"", "") # Handle projects with space
388+
assert "CodeSign" in output
382389

383390
# Verify release/debug builds
384391
if "--release" in attributes.keys():
@@ -399,6 +406,9 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
399406
assert "EXPORT SUCCEEDED" in output
400407
assert File.exists(device_folder + app_id + ".ipa"), "IPA file not found!"
401408
bundle_content = File.read(device_folder + app_id + ".app/" + app_id)
409+
410+
output = File.read(app_name + '/platforms/ios/' + app_id + '.xcodeproj/project.pbxproj')
411+
assert DEVELOPMENT_TEAM in output, "TeamID not passed to Xcode project!"
402412
else:
403413
assert "build/emulator/" + app_id + ".app" in output
404414
assert File.exists(app_name + "/platforms/ios/" + app_id + "/" + app_id + "-Prefix.pch")

tests/build/ios/build_ios_ng_tests.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import os
22

33
from core.base_class.BaseClass import BaseClass
4-
from core.osutils.file import File
54
from core.osutils.folder import Folder
65
from core.settings.settings import IOS_RUNTIME_PATH
76
from core.tns.tns import Tns
87
from core.xcode.xcode import Xcode
9-
from core.settings.strings import *
108

119

1210
class BuildiOSNGTests(BaseClass):
1311
@classmethod
1412
def setUpClass(cls):
1513
logfile = os.path.join("out", cls.__name__ + ".txt")
1614
BaseClass.setUpClass(logfile)
17-
1815
Xcode.cleanup_cache()
1916

20-
Tns.create_app_ng(app_name=cls.app_name)
17+
Tns.create_app_ng(app_name=cls.app_name, update_modules=True)
2118
Tns.platform_add_ios(attributes={"--path": cls.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
2219

2320
@classmethod
@@ -26,15 +23,7 @@ def tearDownClass(cls):
2623
Folder.cleanup(cls.app_name)
2724

2825
def test_100_build_ios_ng_project(self):
29-
output = Tns.build_ios(attributes={"--path": self.app_name})
30-
assert "build/emulator/TestApp.app" in output
31-
assert File.exists(self.app_name + "/platforms/ios/build/emulator/TestApp.app")
26+
Tns.build_ios(attributes={"--path": self.app_name})
3227

3328
def test_200_build_ios_ng_project_release_fordevice(self):
34-
output = Tns.build_ios(attributes={"--path": self.app_name,
35-
"--for-device": "",
36-
"--release": ""})
37-
assert config_release in output
38-
assert codesign in output
39-
assert "build/device/TestApp.app" in output
40-
assert File.exists(self.app_name + "/platforms/ios/build/device/TestApp.ipa")
29+
Tns.build_ios(attributes={"--path": self.app_name, "--for-device": "", "--release": ""})

0 commit comments

Comments
 (0)