def setUpClass(cls): BaseClass.setUpClass(cls.__name__) Process.kill('Safari') Process.kill('NativeScript Inspector') Emulator.stop() Simulator.stop() cls.SIMULATOR_ID = Simulator.ensure_available( simulator_name=SIMULATOR_NAME) Folder.cleanup(cls.INSPECTOR_GLOBAL_PATH) Tns.create_app(cls.app_name, attributes={ '--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz') }, update_modules=True) Tns.platform_add_ios(attributes={ '--path': cls.app_name, '--frameworkPath': IOS_PACKAGE }) if USE_YARN == "True": Npm.install(package=IOS_INSPECTOR_PACKAGE, option='--dev', folder=cls.app_name) else: Npm.install(package=IOS_INSPECTOR_PACKAGE, option='--save-dev', folder=cls.app_name) Tns.build_ios(attributes={"--path": cls.app_name})
def test_300_build_project_with_dash_and_ios_inspector_added(self): """ Verify we can build projects with dashes. Verify we can build android when inspector is added (test for CLI issue 2467) """ Tns.create_app(self.app_name_dash) Tns.platform_add_android(attributes={ "--path": self.app_name_dash, "--frameworkPath": ANDROID_PACKAGE }) if USE_YARN == "True": Npm.install(package="tns-ios-inspector", option='--dev', folder=self.app_name_dash) else: Npm.install(package="tns-ios-inspector", option='--save-dev', folder=self.app_name_dash) Tns.build_android(attributes={"--path": self.app_name_dash}) # Verify project id output = File.read(self.app_name_dash + "/package.json") assert app_identifier in output.lower() # Verify AndroidManifest.xml output = File.read(self.app_name_dash + "/" + TnsAsserts.PLATFORM_ANDROID_SRC_MAIN_PATH + "AndroidManifest.xml") assert app_identifier in output.lower()
def test_230_tns_update(self): """ Default `tns platform add` command""" Tns.platform_add_android(attributes={"--path": self.app_name}, version="latest") output = Tns.update(attributes={"--path": self.app_name}) if USE_YARN == "False": self.verify_update(output) modules_version = Npm.get_version("tns-core-modules") TnsAsserts.package_json_contains(self.app_name, [modules_version]) output = Tns.update(attributes={ "5.0.0": "", "--path": self.app_name }) self.verify_update(output) TnsAsserts.package_json_contains(self.app_name, ["5.0.0"]) Tns.update(attributes={"next": "", "--path": self.app_name}) self.verify_update(output) modules_version = Npm.get_version("tns-android@next") android_version = Npm.get_version("tns-core-modules@next") TnsAsserts.package_json_contains( self.app_name, [modules_version, android_version]) else: self.verify_update(output)
def test_302_build_project_with_space_debug_with_plugin(self): Tns.platform_remove( platform=Platform.ANDROID, attributes={"--path": "\"" + self.app_name_space + "\""}, assert_success=False) Npm.install(package="nativescript-mapbox", option="--save", folder="\"" + self.app_name_space + "\"") output = Tns.build_android( attributes={"--path": "\"" + self.app_name_space + "\""}) assert "Project successfully built" in output
def install_npm(package='', option='', folder=None, log_level=CommandLogLevel.FULL): cmd = UPDATE_WEBPACK_PATH + " --configs --deps" Npm.install(package=package, option=option, folder=folder, log_level=log_level) if folder is not None: Folder.navigate_to(folder=folder, relative_from_current_folder=True) print cmd output = run(command=cmd) if folder is not None: Folder.navigate_to(TEST_RUN_HOME, relative_from_current_folder=False) return output
def create_app_ng(app_name, attributes={}, log_trace=False, assert_success=True, update_modules=True, template_version=None): if template_version is not None: template = "tns-template-hello-world-ng@" + template_version attr = {"--template": template} else: if BRANCH is "master": attr = {"--template": SUT_FOLDER + os.path.sep + "tns-template-hello-world-ng.tgz"} else: attr = {"--template": "tns-template-hello-world-ng"} attributes.update(attr) output = Tns.create_app(app_name=app_name, attributes=attributes, log_trace=log_trace, assert_success=assert_success, update_modules=update_modules) if update_modules: Tns.update_angular(path=app_name) Tns.update_typescript(path=app_name) if assert_success: if USE_YARN != "True": if Npm.version() < 5: assert "nativescript-angular" in output assert File.exists(os.path.join(app_name, 'node_modules', 'nativescript-theme-core')) package_json = File.read(os.path.join(app_name, 'package.json')) assert "tns-core-modules" in package_json assert "nativescript-angular" in package_json assert "nativescript-dev-typescript" in package_json return output
def created(app_name, output=None, full_check=True): """ Assert application is created properly. :param app_name: App name :param output: Output of `tns create command` :param full_check: If true everything will be checked. If false only console output will be checked. """ # Assert console output is ok if output is not None: app = app_name.rsplit('/')[-1] if USE_YARN != "True": if Npm.version() < 5: assert 'nativescript-theme-core' in output assert 'Project {0} was successfully created'.format(app) in output, 'Failed to create {0}'.format(app) if full_check: # Assert files are ok assert File.exists(app_name) assert File.exists(app_name + '/node_modules/tns-core-modules/package.json') assert File.exists(app_name + '/node_modules/tns-core-modules/LICENSE') assert File.exists(app_name + '/node_modules/tns-core-modules/xml/xml.js') assert File.exists(app_name + '/node_modules/nativescript-theme-core') # Assert content of package.json app_id = app_name.replace(' ', '').replace('_', '').replace('-', '').rsplit('/')[-1] strings = ['org.nativescript.{0}'.format(app_id), 'tns-core-modules', 'nativescript-theme-core'] TnsAsserts.package_json_contains(app_name, string_list=strings)
def created_ts(app_name, output=None): """ Assert TypeScript application is created properly. :param app_name: App name :param output: Output of `tns create command` """ # First make sure base app is created TnsAsserts.created(app_name=app_name, output=output) # Assert output contains TypeScript plugin if USE_YARN != "True": if Npm.version() < 5: assert 'nativescript-dev-typescript' in output # Assert files added with TypeScript plugin ts_config = os.path.join(app_name, 'tsconfig.json') ref_dts = os.path.join(app_name, 'references.d.ts') dts = os.path.join(app_name, TnsAsserts.TNS_MODULES, 'tns-core-modules.d.ts') # Assert content of files added with TypeScript plugin. assert File.exists(ts_config) assert not File.exists(ref_dts) assert File.exists(dts) ts_config_json = TnsAsserts.get_tsconfig_json(app_name=app_name) paths = ts_config_json.get('compilerOptions').get('paths') assert paths is not None, 'Paths missing in tsconfig.json' assert not Folder.is_empty(os.path.join(app_name, TnsAsserts.NODE_MODULES, 'nativescript-dev-typescript')) assert File.exists(os.path.join(app_name, TnsAsserts.HOOKS, 'before-prepare', 'nativescript-dev-typescript.js')) assert File.exists(os.path.join(app_name, TnsAsserts.HOOKS, 'before-watch', 'nativescript-dev-typescript.js')) assert File.exists(os.path.join(app_name, TnsAsserts.NODE_MODULES, 'typescript', 'bin', 'tsc'))
def setUpClass(cls): BaseClass.setUpClass(cls.__name__) Process.kill('Safari') Process.kill('NativeScript Inspector') Emulator.stop() Simulator.stop() cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME) Folder.cleanup(cls.INSPECTOR_GLOBAL_PATH) Tns.create_app(cls.app_name, attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')}, update_modules=True) Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE}) if USE_YARN == "True": Npm.install(package=IOS_INSPECTOR_PACKAGE, option='--dev', folder=cls.app_name) else: Npm.install(package=IOS_INSPECTOR_PACKAGE, option='--save-dev', folder=cls.app_name) Tns.build_ios(attributes={"--path": cls.app_name})
def test_330_prepare_android_next(self): Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": self.app_name}, assert_success=False) Tns.platform_add_android(attributes={"--path": self.app_name}, version="next") Folder.cleanup(os.path.join(self.app_name, "node_modules")) Folder.cleanup(os.path.join(self.app_name, "platforms")) android_version = Npm.get_version("tns-android@next") File.replace(file_path=os.path.join(self.app_name, "package.json"), str1=android_version, str2="next") output = Tns.prepare_android(attributes={"--path": self.app_name}) TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FIRST_TIME)
def install(): package = File.find(base_path=SUT_FOLDER, file_name="nativescript") output = Npm.install(package=package, folder=TEST_RUN_HOME) message = "NativeScript CLI installation failed - \"{e}\" found in output." assert "dev-post-install" not in output, message.format( e="dev-post-install") cli_path = os.path.join(TEST_RUN_HOME, "node_modules", ".bin", "tns") assert File.exists( cli_path ), "NativeScript CLI installation failed - tns does not exist."
def test_300_build_project_with_dash_and_ios_inspector_added(self): """ Verify we can build projects with dashes. Verify we can build android when inspector is added (test for CLI issue 2467) """ Tns.create_app(self.app_name_dash) Tns.platform_add_android(attributes={"--path": self.app_name_dash, "--frameworkPath": ANDROID_PACKAGE}) if USE_YARN == "True": Npm.install(package="tns-ios-inspector", option='--dev', folder=self.app_name_dash) else: Npm.install(package="tns-ios-inspector", option='--save-dev', folder=self.app_name_dash) Tns.build_android(attributes={"--path": self.app_name_dash}) # Verify project id output = File.read(self.app_name_dash + "/package.json") assert app_identifier in output.lower() # Verify AndroidManifest.xml output = File.read(self.app_name_dash + "/" + TnsAsserts.PLATFORM_ANDROID_SRC_MAIN_PATH + "AndroidManifest.xml") assert app_identifier in output.lower()
def test_230_tns_update(self): """ Default `tns platform add` command""" Tns.platform_add_android(attributes={"--path": self.app_name}, version="latest") output = Tns.update(attributes={"--path": self.app_name}) if USE_YARN == "False": self.verify_update(output) modules_version = Npm.get_version("tns-core-modules") TnsAsserts.package_json_contains(self.app_name, [modules_version]) output = Tns.update(attributes={"5.0.0": "", "--path": self.app_name}) self.verify_update(output) TnsAsserts.package_json_contains(self.app_name, ["5.0.0"]) Tns.update(attributes={"next": "", "--path": self.app_name}) self.verify_update(output) modules_version = Npm.get_version("tns-android@next") android_version = Npm.get_version("tns-core-modules@next") TnsAsserts.package_json_contains(self.app_name, [modules_version, android_version]) else: self.verify_update(output)
def get_repos(): """ Clone template-hello-world repositories """ Git.clone_repo( repo_url='[email protected]:NativeScript/template-hello-world.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world')) Git.clone_repo( repo_url='[email protected]:NativeScript/template-hello-world-ts.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts')) # `nativescript-angular` do not longer use release branch Git.clone_repo( repo_url='[email protected]:NativeScript/template-hello-world-ng.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ts.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ng.tgz'))
def test_320_build_ios_with_custom_entitlements(self): Tns.build_ios(attributes={"--path": self.app_name}) # Add entitlements in app/App_Resources/iOS/app.entitlements source = os.path.join(TEST_RUN_HOME, 'data', 'entitlements', 'app.entitlements') target = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'app.entitlements') File.copy(src=source, dest=target) # Build again and verify entitlements are merged Tns.build_ios(attributes={"--path": self.app_name}) entitlements_path = self.app_name + '/platforms/ios/' + self.app_name + '/' + self.app_name + '.entitlements' assert File.exists(entitlements_path), "Entitlements file is missing!" entitlements_content = File.read(entitlements_path) assert '<key>aps-environment</key>' in entitlements_content, "Entitlements file content is wrong!" assert '<string>development</string>' in entitlements_content, "Entitlements file content is wrong!" # Install plugin with entitlements, build again and verify entitlements are merged plugin_path = os.path.join(TEST_RUN_HOME, 'data', 'plugins', 'nativescript-test-entitlements-1.0.0.tgz') Npm.install(package=plugin_path, option='--save', folder=self.app_name) Tns.build_ios(attributes={"--path": self.app_name}) entitlements_content = File.read(entitlements_path) assert '<key>aps-environment</key>' in entitlements_content, "Entitlements file content is wrong!" assert '<string>development</string>' in entitlements_content, "Entitlements file content is wrong!" assert '<key>inter-app-audio</key>' in entitlements_content, "Entitlements file content is wrong!" assert '<true/>' in entitlements_content, "Entitlements file content is wrong!" # Build in release, for device (provision without entitlements) output = Tns.build_ios(attributes={ "--path": self.app_name, "--forDevice": "", "--release": "" }, assert_success=False) assert "Provisioning profile " in output assert "doesn't include the aps-environment and inter-app-audio entitlements" in output
def created_ts(app_name, output=None): """ Assert TypeScript application is created properly. :param app_name: App name :param output: Output of `tns create command` """ # First make sure base app is created TnsAsserts.created(app_name=app_name, output=output) # Assert output contains TypeScript plugin if USE_YARN != "True": if Npm.version() < 5: assert 'nativescript-dev-typescript' in output # Assert files added with TypeScript plugin ts_config = os.path.join(app_name, 'tsconfig.json') ref_dts = os.path.join(app_name, 'references.d.ts') dts = os.path.join(app_name, TnsAsserts.TNS_MODULES, 'tns-core-modules.d.ts') # Assert content of files added with TypeScript plugin. assert File.exists(ts_config) assert not File.exists(ref_dts) assert File.exists(dts) ts_config_json = TnsAsserts.get_tsconfig_json(app_name=app_name) paths = ts_config_json.get('compilerOptions').get('paths') assert paths is not None, 'Paths missing in tsconfig.json' assert not Folder.is_empty( os.path.join(app_name, TnsAsserts.NODE_MODULES, 'nativescript-dev-typescript')) assert File.exists( os.path.join(app_name, TnsAsserts.HOOKS, 'before-prepare', 'nativescript-dev-typescript.js')) assert File.exists( os.path.join(app_name, TnsAsserts.HOOKS, 'before-watch', 'nativescript-dev-typescript.js')) assert File.exists( os.path.join(app_name, TnsAsserts.NODE_MODULES, 'typescript', 'bin', 'tsc'))
def create_app_ng(app_name, attributes={}, log_trace=False, assert_success=True, update_modules=True, template_version=None): if template_version is not None: template = "tns-template-hello-world-ng@" + template_version attr = {"--template": template} else: if BRANCH is "master": attr = { "--template": SUT_FOLDER + os.path.sep + "tns-template-hello-world-ng.tgz" } else: attr = {"--template": "tns-template-hello-world-ng"} attributes.update(attr) output = Tns.create_app(app_name=app_name, attributes=attributes, log_trace=log_trace, assert_success=assert_success, update_modules=update_modules) if update_modules: Tns.update_angular(path=app_name) Tns.update_typescript(path=app_name) if assert_success: if USE_YARN != "True": if Npm.version() < 5: assert "nativescript-angular" in output assert File.exists( os.path.join(app_name, 'node_modules', 'nativescript-theme-core')) package_json = File.read(os.path.join(app_name, 'package.json')) assert "tns-core-modules" in package_json assert "nativescript-angular" in package_json assert "nativescript-dev-typescript" in package_json return output
def update_modules(path): """ Update modules for {N} project :param path: Path to {N} project :return: Output of command that update tns-core-modules plugin. """ # Escape path with spaces if " " in path: path = "\"" + path + "\"" if USE_YARN == "True": Npm.uninstall(package="tns-core-modules", folder=path) output = Npm.install(package=MODULES_PACKAGE, folder=path) else: Npm.uninstall(package="tns-core-modules", option="--save", folder=path) output = Npm.install(package=MODULES_PACKAGE, option="--save", folder=path) if Npm.version() > 3: assert "ERR" not in output, "Something went wrong when modules are installed." return output
def created(app_name, output=None, full_check=True): """ Assert application is created properly. :param app_name: App name :param output: Output of `tns create command` :param full_check: If true everything will be checked. If false only console output will be checked. """ # Assert console output is ok if output is not None: app = app_name.rsplit('/')[-1] if USE_YARN != "True": if Npm.version() < 5: assert 'nativescript-theme-core' in output assert 'Project {0} was successfully created'.format( app) in output, 'Failed to create {0}'.format(app) if full_check: # Assert files are ok assert File.exists(app_name) assert File.exists(app_name + '/node_modules/tns-core-modules/package.json') assert File.exists(app_name + '/node_modules/tns-core-modules/LICENSE') assert File.exists(app_name + '/node_modules/tns-core-modules/xml/xml.js') assert File.exists(app_name + '/node_modules/nativescript-theme-core') # Assert content of package.json app_id = app_name.replace(' ', '').replace('_', '').replace( '-', '').rsplit('/')[-1] strings = [ 'org.nativescript.{0}'.format(app_id), 'tns-core-modules', 'nativescript-theme-core' ] TnsAsserts.package_json_contains(app_name, string_list=strings)
def get_repos(): """ Clone template-hello-world repositories """ Git.clone_repo(repo_url='[email protected]:NativeScript/template-hello-world.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world')) Git.clone_repo(repo_url='[email protected]:NativeScript/template-hello-world-ts.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts')) # `nativescript-angular` do not longer use release branch Git.clone_repo(repo_url='[email protected]:NativeScript/template-hello-world-ng.git', local_folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ts.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ng.tgz'))
def uninstall(): output = Npm.uninstall(package="nativescript", folder=TEST_RUN_HOME) print output
def update_typescript(path): """ Update modules for {N} project :param path: Path to {N} project :return: Output of command that update nativescript-typescript plugin. """ # Escape path with spaces if " " in path: path = "\"" + path + "\"" if USE_YARN == "True": Npm.uninstall(package="nativescript-typescript", folder=path) output = Npm.install(package=TYPESCRIPT_PACKAGE, folder=path) else: Npm.uninstall(package="nativescript-typescript", option="--save", folder=path) output = Npm.install(package=TYPESCRIPT_PACKAGE, option="--save", folder=path) if Npm.version() > 3: assert "ERR" not in output, "Something went wrong when typescript are installed." # Update TS dependencies update_script = os.path.join(TEST_RUN_HOME, path, "node_modules", ".bin", "ns-upgrade-tsconfig") run(update_script) if USE_YARN == "True": Npm.yarn_install(folder=path) else: Npm.install(folder=path) return output
def update_webpack(path): """ Update modules for {N} project :param path: Path to {N} project :return: Output of command that update nativescript-dev-webpack plugin. """ # Escape path with spaces if " " in path: path = "\"" + path + "\"" if USE_YARN == "True": Npm.uninstall(package="nativescript-dev-webpack", option="--dev", folder=path) output = Npm.install(package=WEBPACK_PACKAGE, option="--dev", folder=path) else: Npm.uninstall(package="nativescript-dev-webpack", option="--save-dev", folder=path) output = Npm.install(package=WEBPACK_PACKAGE, option="--save-dev", folder=path) if Npm.version() > 3: assert "ERR" not in output, "Something went wrong when webpack are installed." # Update webpack dependencies update_script = os.path.join(TEST_RUN_HOME, path, "node_modules", ".bin", "update-ns-webpack --deps --configs") run(update_script) if USE_YARN == "True": Folder.cleanup(folder=os.path.join(TEST_RUN_HOME, path, "node_modules")) Npm.yarn_install(folder=path) else: Npm.install(folder=path) return output
def update_angular(path): """ Update modules for {N} project :param path: Path to {N} project :return: Output of command that update nativescript-angular plugin. """ # Escape path with spaces if " " in path: path = "\"" + path + "\"" if USE_YARN == "True": Npm.uninstall(package="nativescript-angular", folder=path) output = Npm.install(package=ANGULAR_PACKAGE, folder=path) else: Npm.uninstall(package="nativescript-angular", option="--save", folder=path) output = Npm.install(package=ANGULAR_PACKAGE, option="--save", folder=path) if Npm.version() > 3: assert "ERR" not in output, "Something went wrong when angular are installed." # Update NG dependencies update_script = os.path.join(TEST_RUN_HOME, path, "node_modules", ".bin", "update-app-ng-deps") update_out = run(update_script) assert "Angular dependencies updated" in update_out if USE_YARN == "True": Npm.yarn_install(folder=path) else: Npm.install(folder=path) return output
def test_302_build_project_with_space_debug_with_plugin(self): Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": "\"" + self.app_name_space + "\""}, assert_success=False) Npm.install(package="nativescript-mapbox", option="--save", folder="\"" + self.app_name_space + "\"") output = Tns.build_android(attributes={"--path": "\"" + self.app_name_space + "\""}) assert "Project successfully built" in output
def test_401_prepare_project_with_many_dependencies(self): """ Test for https://github.com/NativeScript/nativescript-cli/issues/2561 """ Folder.cleanup(self.app_name) Tns.create_app_ng(app_name=self.app_name, template_version="4", update_modules=False) if USE_YARN == "True": Npm.install(package="lodash", folder=self.app_name) Npm.install(package="moment", folder=self.app_name) Npm.install(package="nativescript-cardview", folder=self.app_name) Npm.install(package="nativescript-sqlite", folder=self.app_name) Npm.install(package="nativescript-statusbar", folder=self.app_name) Npm.install(package="nativescript-websockets", folder=self.app_name) Npm.install(package="number-generator", folder=self.app_name) Npm.install(package="eslint", folder=self.app_name) Npm.install(package="eslint-plugin-compat", folder=self.app_name) else: Npm.install(package="lodash", option="--save", folder=self.app_name) Npm.install(package="moment", option="--save", folder=self.app_name) Npm.install(package="nativescript-cardview", option="--save", folder=self.app_name) Npm.install(package="nativescript-sqlite", option="--save", folder=self.app_name) Npm.install(package="nativescript-statusbar", option="--save", folder=self.app_name) Npm.install(package="nativescript-websockets", option="--save", folder=self.app_name) Npm.install(package="number-generator", option="--save", folder=self.app_name) Npm.install(package="eslint", option="--save", folder=self.app_name) Npm.install(package="eslint-plugin-compat", option="--save", folder=self.app_name) Tns.platform_add_android(version="4", attributes={"--path": self.app_name}) Tns.prepare_android(attributes={"--path": self.app_name}, log_trace=True)
Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ts.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ng.tgz')) if __name__ == '__main__': # Cleanup files and folders created by the test execution Folder.cleanup(OUTPUT_FOLDER) Folder.create(OUTPUT_FOLDER) Folder.cleanup(SUT_FOLDER) Folder.cleanup("node_modules") Npm.cache_clean() Gradle.kill() Gradle.cache_clean() get_repos() Emulator.stop() # Stop running emulators # Copy test packages and cleanup if CURRENT_OS == OSType.OSX: Simulator.stop() disable_crash_report() get_test_packages(platform=Platform.BOTH) Simulator.reset() if Xcode.get_version() < 10: SIMULATOR_SDK = '11.0' if Xcode.get_version() < 9:
def update_webpack(path): """ Update modules for {N} project :param path: Path to {N} project :return: Output of command that update nativescript-dev-webpack plugin. """ # Escape path with spaces if " " in path: path = "\"" + path + "\"" if USE_YARN == "True": Npm.uninstall(package="nativescript-dev-webpack", option="--dev", folder=path) output = Npm.install(package=WEBPACK_PACKAGE, option="--dev", folder=path) else: Npm.uninstall(package="nativescript-dev-webpack", option="--save-dev", folder=path) output = Npm.install(package=WEBPACK_PACKAGE, option="--save-dev", folder=path) if Npm.version() > 3: assert "ERR" not in output, "Something went wrong when webpack are installed." # Update webpack dependencies update_script = os.path.join(TEST_RUN_HOME, path, "node_modules", ".bin", "update-ns-webpack --deps --configs") run(update_script) if USE_YARN == "True": Folder.cleanup( folder=os.path.join(TEST_RUN_HOME, path, "node_modules")) Npm.yarn_install(folder=path) else: Npm.install(folder=path) return output
Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ts'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ts.tgz')) Npm.pack(folder=os.path.join(SUT_FOLDER, 'template-hello-world-ng'), output_file=os.path.join(SUT_FOLDER, 'tns-template-hello-world-ng.tgz')) if __name__ == '__main__': # Cleanup files and folders created by the test execution Folder.cleanup(OUTPUT_FOLDER) Folder.create(OUTPUT_FOLDER) Folder.cleanup(SUT_FOLDER) Folder.cleanup("node_modules") Npm.cache_clean() Gradle.kill() Gradle.cache_clean() get_repos() Emulator.stop() # Stop running emulators # Copy test packages and cleanup if CURRENT_OS == OSType.OSX: Simulator.stop() disable_crash_report() get_test_packages(platform=Platform.BOTH) Simulator.reset() if Xcode.get_version() < 10: SIMULATOR_SDK = '11.0' if Xcode.get_version() < 9: