2
2
A wrapper of tns commands.
3
3
"""
4
4
import os
5
+
5
6
import time
6
7
7
8
from core .npm .npm import Npm
10
11
from core .osutils .folder import Folder
11
12
from core .osutils .os_type import OSType
12
13
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
16
16
from core .tns .tns_platform_type import Platform
17
17
from core .tns .tns_verifications import TnsAsserts
18
18
from core .xcode .xcode import Xcode
@@ -231,10 +231,7 @@ def platform_add(platform=Platform.NONE, version=None, attributes={}, assert_suc
231
231
output = Tns .run_tns_command ("platform add " + platform_string , attributes = attributes , log_trace = log_trace ,
232
232
tns_path = tns_path )
233
233
234
- #######################################################################################
235
- # Verify platforms added (if assert_success=True)
236
- #######################################################################################
237
-
234
+ # Verify platforms added
238
235
app_name = Tns .__get_app_name_from_attributes (attributes )
239
236
if assert_success :
240
237
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
331
328
output = Tns .run_tns_command ("prepare ios " , attributes = attributes , log_trace = log_trace , tns_path = tns_path )
332
329
if assert_success :
333
330
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
+
334
339
return output
335
340
336
341
@staticmethod
@@ -370,15 +375,17 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
370
375
attr = {"--teamId" : DEVELOPMENT_TEAM }
371
376
attributes .update (attr )
372
377
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
+
373
383
if assert_success :
374
384
assert "BUILD SUCCEEDED" in output
375
385
assert "Project successfully built" in output
376
386
assert "ERROR" not in output
377
387
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
382
389
383
390
# Verify release/debug builds
384
391
if "--release" in attributes .keys ():
@@ -399,6 +406,9 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
399
406
assert "EXPORT SUCCEEDED" in output
400
407
assert File .exists (device_folder + app_id + ".ipa" ), "IPA file not found!"
401
408
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!"
402
412
else :
403
413
assert "build/emulator/" + app_id + ".app" in output
404
414
assert File .exists (app_name + "/platforms/ios/" + app_id + "/" + app_id + "-Prefix.pch" )
0 commit comments