Skip to content

Commit 702f63c

Browse files
committed
Do not check for ERR when installing nativescipt
1 parent d536222 commit 702f63c

10 files changed

+49
-52
lines changed

core/installer/cli.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,8 @@ class Cli(object):
1313
def install():
1414
output = run("npm i " + SUT_FOLDER + os.path.sep + "nativescript.tgz")
1515
message = "NativeScript CLI installation failed - \"{e}\" found in output."
16-
assert "npm ERR" not in output, message.format(e="npm ERR")
17-
assert "FiberFuture" not in output, message.format(e="FiberFuture")
1816
assert "dev-post-install" not in output, message.format(e="dev-post-install")
19-
assert File.exists("node_modules/.bin/tns"), \
20-
"NativeScript CLI installation failed - tns does not exist."
17+
assert File.exists("node_modules/.bin/tns"), "NativeScript CLI installation failed - tns does not exist."
2118
print output
2219

2320
@staticmethod

core/settings/strings.py

-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
ios = "ios"
66
android = "android"
77
invalid = "invalidEntry"
8-
config_debug = "CONFIGURATION Debug"
9-
config_release = "CONFIGURATION Release"
108
app_identifier = "org.nativescript.testapp"
119

1210
# Files
@@ -60,11 +58,7 @@
6058
devDependencies = "devDependencies"
6159
started_on_device = "Successfully started on device with identifier"
6260

63-
# Pods
64-
carousel = "carousel"
65-
6661
# Plugins
67-
6862
nativescript_unit_test_runner = "nativescript-unit-test-runner"
6963
tns_core_modules = "tns-core-modules"
7064

@@ -75,11 +69,3 @@
7569
invalid_value = "The value '{0}' is not valid."
7670
no_platform = "No platform specified"
7771
"and neither was a --path specified."
78-
cannot_resolve_device = "Could not find device by specified identifier"
79-
list_devices = "To list currently connected devices and verify that the specified identifier exists, run 'tns device'"
80-
no_platform_installed = "No installed platforms found. Use $ tns platform add"
81-
82-
83-
84-
85-

core/tns/tns.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from core.osutils.process import Process
1313
from core.settings.settings import TNS_PATH, SUT_FOLDER, DEVELOPMENT_TEAM, TEST_RUN_HOME, \
1414
COMMAND_TIMEOUT, CURRENT_OS, TAG
15-
from core.settings.strings import config_release, codesign, config_debug
15+
from core.settings.strings import codesign
1616
from core.tns.tns_platform_type import Platform
1717
from core.tns.tns_verifications import TnsAsserts
1818
from core.xcode.xcode import Xcode
@@ -382,9 +382,9 @@ def build_ios(attributes={}, assert_success=True, tns_path=None):
382382

383383
# Verify release/debug builds
384384
if "--release" in attributes.keys():
385-
assert config_release in output
385+
assert "CONFIGURATION Release" in output
386386
else:
387-
assert config_debug in output
387+
assert "CONFIGURATION Debug" in output
388388

389389
entitlements_path = app_name + '/platforms/ios/' + app_id + '/' + app_id + '.entitlements'
390390
assert File.exists(entitlements_path), "Entitlements file is missing!"

core/tns/tns_verifications.py

+33-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44
import json
55
import os
6-
import re
76

87
from core.npm.npm import Npm
98
from core.osutils.file import File
@@ -71,7 +70,7 @@ def created(app_name, output=None, full_check=True):
7170
"""
7271
Assert application is created properly.
7372
:param app_name: App name
74-
:param output: Outout of `tns create command`
73+
:param output: Output of `tns create command`
7574
:param full_check: If true everything will be checked. If false only console output will be checked.
7675
"""
7776

@@ -117,22 +116,17 @@ def created_ts(app_name, output=None):
117116
dts = os.path.join(app_name, TnsAsserts.TNS_MODULES, 'tns-core-modules.d.ts')
118117

119118
# Assert content of files added with TypeScript plugin.
120-
modules_version = TnsAsserts.get_modules_version(app_name=app_name)
121-
modules_version = re.sub("\D", "", modules_version)
122-
123119
File.exists(ts_config)
124120
File.exists(ref_dts)
125121
File.exists(dts)
126122
red_tds_content = File.read(ref_dts)
127-
if modules_version[0] < 3:
128-
assert './node_modules/tns-core-modules/tns-core-modules.d.ts' in red_tds_content
129-
else:
130-
assert './node_modules/tns-core-modules/tns-core-modules.d.ts' not in red_tds_content
131-
ts_config_json = TnsAsserts.get_tsconfig_json(app_name=app_name)
132-
paths = ts_config_json.get('compilerOptions').get('paths')
133-
assert paths is not None, 'Paths missing in tsconfig.json'
134-
assert '/node_modules/tns-core-modules/' in str(paths), \
135-
'"/node_modules/tns-core-modules/" not found in paths section iof tsconfig.json'
123+
124+
assert './node_modules/tns-core-modules/tns-core-modules.d.ts' not in red_tds_content
125+
ts_config_json = TnsAsserts.get_tsconfig_json(app_name=app_name)
126+
paths = ts_config_json.get('compilerOptions').get('paths')
127+
assert paths is not None, 'Paths missing in tsconfig.json'
128+
assert '/node_modules/tns-core-modules/' in str(paths), \
129+
'"/node_modules/tns-core-modules/" not found in paths section iof tsconfig.json'
136130

137131
assert not Folder.is_empty(app_name + TnsAsserts.NODE_MODULES + '/nativescript-dev-typescript')
138132
assert File.exists(app_name + TnsAsserts.HOOKS + 'before-prepare/nativescript-dev-typescript.js')
@@ -330,3 +324,28 @@ def _full_prepare():
330324
'Prepare does not skip \'ios\' specific js files.'
331325
assert not File.exists(os.path.join(modules_path, 'application', 'application.ios.js')), \
332326
'Prepare does not strip \'ios\' from name of js files.'
327+
328+
@staticmethod
329+
def can_not_find_device(output):
330+
"""
331+
Assert output for invalid device.
332+
:param output: Output of tns command
333+
"""
334+
assert "Could not find device by specified identifier" in output
335+
assert "To list currently connected devices and verify that the specified identifier exists" in output
336+
337+
@staticmethod
338+
def invalid_device(output):
339+
"""
340+
Assert output for invalid device.
341+
:param output: Output of tns command
342+
"""
343+
344+
assert "Searching for devices..." in output
345+
assert "Cannot find connected devices" in output
346+
assert "No emulator image available for device identifier" in output or \
347+
"No simulator image available for device identifier " in output
348+
assert "To list available emulator images, run 'tns device <Platform> --available-devices'" in output or \
349+
"To list available simulator images, run 'tns device <Platform> --available-devices" in output
350+
assert "To list currently connected devices and verify that the specified identifier exists, run 'tns device'" \
351+
in output

tests/build/ios/build_ios_provision_tests.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def test_200_build_ios_list_provisions(self):
4444
assert "Due" in output
4545
assert "Devices" in output
4646
assert PROVISIONING in output
47+
assert DISTRIBUTION_PROVISIONING in output
4748
assert DEVELOPMENT_TEAM in output
4849

4950
@unittest.skipIf("9." in Xcode.get_version(),

tests/device/deploy_android_tests.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from core.settings.strings import *
1515
from core.tns.tns import Tns
1616
from core.tns.tns_platform_type import Platform
17+
from core.tns.tns_verifications import TnsAsserts
1718

1819

1920
class DeployAndroidTests(BaseClass):
@@ -119,6 +120,4 @@ def test_402_deploy_invalid_device(self):
119120
"--justlaunch": "",
120121
"--device": "invaliddevice_id"
121122
})
122-
assert "Could not find device by specified identifier" in output
123-
assert "To list currently connected devices and verify that the specified identifier exists, run" in output
124-
assert "tns device" in output
123+
TnsAsserts.invalid_device(output=output)

tests/device/device_android_tests.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
from core.osutils.file import File
1111
from core.osutils.folder import Folder
1212
from core.settings.settings import ANDROID_RUNTIME_PATH, EMULATOR_ID
13+
from core.settings.strings import invalid
1314
from core.tns.tns import Tns
14-
from core.settings.strings import *
1515
from core.tns.tns_platform_type import Platform
16+
from core.tns.tns_verifications import TnsAsserts
1617

1718

1819
class DeviceAndroidTests(BaseClass):
@@ -100,12 +101,12 @@ def test_400_device_invalid_platform(self):
100101

101102
def test_401_device_log_invalid_device_id(self):
102103
output = Tns.run_tns_command("device log", attributes={"--device": "invaliddevice_id"})
103-
assert cannot_resolve_device in output
104+
TnsAsserts.can_not_find_device(output=output)
104105

105106
def test_402_device_run_invalid_device_id(self):
106107
output = Tns.run_tns_command("device run android", attributes={"--device": "invaliddevice_id"})
107-
assert cannot_resolve_device in output
108+
TnsAsserts.can_not_find_device(output=output)
108109

109110
def test_403_device_list_applications_invalid_device_id(self):
110111
output = Tns.run_tns_command("device list-applications", attributes={"--device": "invaliddevice_id"})
111-
assert cannot_resolve_device in output
112+
TnsAsserts.can_not_find_device(output=output)

tests/device/run_android_device_tests.py

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from core.device.helpers.adb import Adb
2626
from core.osutils.file import File
2727
from core.osutils.folder import Folder
28-
from core.osutils.process import Process
2928
from core.settings.settings import ANDROID_RUNTIME_PATH, EMULATOR_ID
3029
from core.tns.replace_helper import ReplaceHelper
3130
from core.tns.tns import Tns

tests/emulator/run_android_tests.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from core.osutils.os_type import OSType
2929
from core.settings.settings import ANDROID_RUNTIME_PATH, ANDROID_KEYSTORE_PATH, ANDROID_KEYSTORE_PASS, \
3030
ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID, EMULATOR_NAME, CURRENT_OS, TEST_RUN_HOME
31-
from core.settings.strings import cannot_resolve_device, list_devices
3231
from core.tns.replace_helper import ReplaceHelper
3332
from core.tns.tns import Tns
3433
from core.tns.tns_platform_type import Platform
@@ -210,8 +209,8 @@ def test_200_tns_run_android_break_and_fix_app(self):
210209
expected_image='livesync-hello-world_home')
211210

212211
# Move js files
213-
app_js_original_path = src=os.path.join(self.app_name, 'app', 'app.js')
214-
app_js_new_path = src = os.path.join(TEST_RUN_HOME, 'app.js')
212+
app_js_original_path = os.path.join(self.app_name, 'app', 'app.js')
213+
app_js_new_path = os.path.join(TEST_RUN_HOME, 'app.js')
215214
File.copy(src=app_js_original_path, dest=app_js_new_path)
216215
File.remove(file_path=app_js_original_path)
217216
strings = ['Successfully synced application', EMULATOR_ID]
@@ -564,5 +563,4 @@ def test_401_tns_run_android_should_not_continue_on_build_failure(self):
564563
def test_404_run_on_invalid_device_id(self):
565564
output = Tns.run_android(attributes={'--path': self.app_name, '--device': 'fakeId', '--justlaunch': ''},
566565
assert_success=False)
567-
assert cannot_resolve_device in output
568-
assert list_devices in output
566+
TnsAsserts.invalid_device(output=output)

tests/simulator/run_ios_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
from core.device.simulator import Simulator
2525
from core.osutils.file import File
2626
from core.osutils.folder import Folder
27-
from core.osutils.process import Process
2827
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME, TEST_RUN_HOME
29-
from core.settings.strings import cannot_resolve_device, list_devices
3028
from core.tns.replace_helper import ReplaceHelper
3129
from core.tns.tns import Tns
3230
from core.tns.tns_platform_type import Platform
@@ -388,8 +386,7 @@ def test_400_tns_run_on_folder_with_spaces(self):
388386
def test_404_run_on_invalid_device_id(self):
389387
output = Tns.run_ios(attributes={'--path': self.app_name, '--device': 'fakeId', '--justlaunch': ''},
390388
assert_success=False)
391-
assert cannot_resolve_device in output
392-
assert list_devices in output
389+
TnsAsserts.invalid_device(output=output)
393390

394391
@unittest.skipIf(Device.get_count(platform=Platform.IOS) > 0, "Valid only if there are no devices.")
395392
def test_410_run_without_platform_and_without_devices(self):

0 commit comments

Comments
 (0)