22A wrapper of tns commands.
33"""
44import os
5+
56import time
67
78from core .npm .npm import Npm
1011from core .osutils .folder import Folder
1112from core .osutils .os_type import OSType
1213from 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
1616from core .tns .tns_platform_type import Platform
1717from core .tns .tns_verifications import TnsAsserts
1818from 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" )
0 commit comments