Skip to content

Commit f3513a0

Browse files
committed
Make tests passing with NativeScript/nativescript-cli#3070
- Make tests passing with NativeScript/nativescript-cli#3070 - Enable —provision tests for Xcode9
1 parent 38cf463 commit f3513a0

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

core/tns/tns.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -377,24 +377,26 @@ def build_android(attributes={}, assert_success=True, tns_path=None):
377377
return output
378378

379379
@staticmethod
380-
def build_ios(attributes={}, assert_success=True, tns_path=None):
380+
def build_ios(attributes={}, assert_success=True, tns_path=None, log_trace=False):
381381

382382
if "--provision" not in attributes.keys():
383383
attr = {"--teamId": DEVELOPMENT_TEAM}
384384
attributes.update(attr)
385385

386-
output = Tns.run_tns_command("build ios", attributes=attributes, tns_path=tns_path)
386+
output = Tns.run_tns_command("build ios", attributes=attributes, tns_path=tns_path, log_trace=log_trace)
387387

388388
app_name = Tns.__get_app_name_from_attributes(attributes=attributes)
389389
app_name = app_name.replace("\"", "") # Handle projects with space
390390
app_id = Tns.__get_final_package_name(app_name, platform=Platform.IOS)
391391

392392
if assert_success:
393-
assert "BUILD SUCCEEDED" in output
394393
assert "Project successfully built" in output
395394
assert "ERROR" not in output
396395
assert "malformed" not in output
397-
assert "CodeSign" in output
396+
397+
if log_trace:
398+
assert "BUILD SUCCEEDED" in output
399+
assert "CodeSign" in output
398400

399401
# Verify release/debug builds
400402
if "--release" in attributes.keys():
@@ -410,9 +412,10 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
410412
device_folder = app_name + "/platforms/ios/build/device/"
411413
emu_folder = app_name + "/platforms/ios/build/emulator/"
412414
if "--forDevice" in attributes.keys() or "--for-device" in attributes.keys():
413-
assert "build/device/" + app_id + ".app" in output
414-
assert "ARCHIVE SUCCEEDED" in output
415-
assert "EXPORT SUCCEEDED" in output
415+
if log_trace:
416+
assert "build/device/" + app_id + ".app" in output
417+
assert "ARCHIVE SUCCEEDED" in output
418+
assert "EXPORT SUCCEEDED" in output
416419
assert File.exists(device_folder + app_id + ".ipa"), "IPA file not found!"
417420
bundle_content = File.read(device_folder + app_id + ".app/" + app_id)
418421
xcode_project = Tns.__get_xcode_project_file(app_name)
@@ -422,7 +425,8 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
422425
assert DEVELOPMENT_TEAM in xcode_project or DISTRIBUTION_PROVISIONING in xcode_project, \
423426
"TeamID not passed to Xcode!"
424427
else:
425-
assert "build/emulator/" + app_id + ".app" in output
428+
if log_trace:
429+
assert "build/emulator/" + app_id + ".app" in output
426430
assert File.exists(app_name + "/platforms/ios/" + app_id + "/" + app_id + "-Prefix.pch")
427431
assert File.exists(emu_folder + app_id + ".app")
428432
bundle_content = File.read(emu_folder + app_id + ".app/" + app_id)

tests/build/ios/build_ios_provision_tests.py

-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
Test for --provision options
33
"""
44
import os
5-
import unittest
65

76
from core.base_class.BaseClass import BaseClass
87
from core.device.simulator import Simulator
@@ -47,14 +46,10 @@ def test_200_build_ios_list_provisions(self):
4746
assert DISTRIBUTION_PROVISIONING in output
4847
assert DEVELOPMENT_TEAM in output
4948

50-
@unittest.skipIf("9." in Xcode.get_version(),
51-
"Skip on Xcode 9 because of https://github.com/NativeScript/nativescript-cli/issues/3046")
5249
def test_201_build_ios_with_provision(self):
5350
build_attributes = {"--path": self.app_name, "--forDevice": "", "--release": "", "--provision": PROVISIONING}
5451
Tns.build_ios(attributes=build_attributes)
5552

56-
@unittest.skipIf("9." in Xcode.get_version(),
57-
"Skip on Xcode 9 because of https://github.com/NativeScript/nativescript-cli/issues/3046")
5853
def test_202_build_ios_with_distribution_provision(self):
5954
build_attributes = {"--path": self.app_name, "--forDevice": "", "--release": "",
6055
"--provision": DISTRIBUTION_PROVISIONING}

tests/build/ios/build_ios_tests.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ def tearDownClass(cls):
5959
def test_001_build_ios(self):
6060
Tns.create_app(self.app_name)
6161
Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
62-
Tns.build_ios(attributes={"--path": self.app_name})
62+
Tns.build_ios(attributes={"--path": self.app_name}, log_trace=True)
6363

6464
Folder.cleanup(os.path.join(self.app_name, 'platforms', 'ios'))
65-
Tns.build_ios(attributes={"--path": self.app_name, "--release": ""})
65+
Tns.build_ios(attributes={"--path": self.app_name, "--release": ""}, log_trace=True)
6666

6767
Folder.cleanup(os.path.join(self.app_name, 'platforms', 'ios'))
68-
Tns.build_ios(attributes={"--path": self.app_name, "--forDevice": ""})
68+
Tns.build_ios(attributes={"--path": self.app_name, "--forDevice": ""}, log_trace=True)
6969

7070
Folder.cleanup(os.path.join(self.app_name, 'platforms', 'ios'))
7171
Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_RUNTIME_PATH})
72-
Tns.build_ios(attributes={"--path": self.app_name, "--forDevice": "", "--release": ""})
72+
Tns.build_ios(attributes={"--path": self.app_name, "--forDevice": "", "--release": ""}, log_trace=True)
7373

7474
# Verify no aar and frameworks in platforms folder
7575
assert not File.pattern_exists(self.app_name + "/platforms/ios", "*.aar")
@@ -82,17 +82,17 @@ def test_001_build_ios(self):
8282
assert "armv7" in output
8383
assert "arm64" in output
8484

85-
def test_211_build_ios_inside_project(self):
85+
def test_200_build_ios_inside_project(self):
8686
Tns.create_app(self.app_name)
8787
Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
8888
Folder.navigate_to(self.app_name)
8989
output = Tns.build_ios(tns_path=os.path.join("..", TNS_PATH), attributes={"--path": self.app_name},
90-
assert_success=False)
90+
assert_success=False, log_trace=True)
9191
Folder.navigate_to(TEST_RUN_HOME, relative_from_current_folder=False)
9292
assert "build/emulator/TestApp.app" in output
9393
assert File.exists(self.app_name + "/platforms/ios/build/emulator/TestApp.app")
9494

95-
def test_213_build_ios_platform_not_added_or_platforms_deleted(self):
95+
def test_210_build_ios_platform_not_added_or_platforms_deleted(self):
9696
Tns.create_app(self.app_name_noplatform)
9797
Tns.build_ios(attributes={"--path": self.app_name_noplatform})
9898

0 commit comments

Comments
 (0)