|
3 | 3 | """
|
4 | 4 | import json
|
5 | 5 | import os
|
6 |
| -import re |
7 | 6 |
|
8 | 7 | from core.npm.npm import Npm
|
9 | 8 | from core.osutils.file import File
|
@@ -71,7 +70,7 @@ def created(app_name, output=None, full_check=True):
|
71 | 70 | """
|
72 | 71 | Assert application is created properly.
|
73 | 72 | :param app_name: App name
|
74 |
| - :param output: Outout of `tns create command` |
| 73 | + :param output: Output of `tns create command` |
75 | 74 | :param full_check: If true everything will be checked. If false only console output will be checked.
|
76 | 75 | """
|
77 | 76 |
|
@@ -117,22 +116,17 @@ def created_ts(app_name, output=None):
|
117 | 116 | dts = os.path.join(app_name, TnsAsserts.TNS_MODULES, 'tns-core-modules.d.ts')
|
118 | 117 |
|
119 | 118 | # 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 |
| - |
123 | 119 | File.exists(ts_config)
|
124 | 120 | File.exists(ref_dts)
|
125 | 121 | File.exists(dts)
|
126 | 122 | 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' |
136 | 130 |
|
137 | 131 | assert not Folder.is_empty(app_name + TnsAsserts.NODE_MODULES + '/nativescript-dev-typescript')
|
138 | 132 | assert File.exists(app_name + TnsAsserts.HOOKS + 'before-prepare/nativescript-dev-typescript.js')
|
@@ -330,3 +324,28 @@ def _full_prepare():
|
330 | 324 | 'Prepare does not skip \'ios\' specific js files.'
|
331 | 325 | assert not File.exists(os.path.join(modules_path, 'application', 'application.ios.js')), \
|
332 | 326 | '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 |
0 commit comments