def create_app(app_name, attributes={}, log_trace=False, assert_success=True, update_modules=True, force_clean=True, measureTime=False): if force_clean: if File.exists(app_name): Folder.cleanup(app_name) path = app_name attributes_to_string = "" for k, v in attributes.iteritems(): if "--path" in k: path = v attributes_to_string = "".join("{0} {1}".format(k, v)) attr = {} if not any(s in attributes_to_string for s in ("--ng", "--template", "--tsc", "--vue")): if BRANCH == "master": attr = {"--template": SUT_FOLDER + os.path.sep + "tns-template-hello-world.tgz"} else: attr = {"--template": "tns-template-hello-world"} attr.update(attributes) if app_name is None: output = Tns.run_tns_command("create ", attributes=attr, log_trace=log_trace, measureTime=measureTime) else: output = Tns.run_tns_command("create \"" + app_name + "\"", attributes=attr, log_trace=log_trace, measureTime=measureTime) if assert_success: TnsAsserts.created(app_name=app_name, output=output) if update_modules: Tns.update_modules(path) # Tns.ensure_app_resources(path) return output
def test_320_platform_add_ios_custom_bundle_id(self): # Create project with different appId Folder.cleanup(self.app_name) output = Tns.create_app(self.app_name, attributes={"--appid": "org.nativescript.MyApp"}, assert_success=False) TnsAsserts.created(self.app_name, output=output, full_check=False) output = File.read(self.app_name + os.sep + "package.json") assert "\"id\": \"org.nativescript.MyApp\"" in output # Add iOS platform Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_PACKAGE}) # Verify plist file in native project (after prepare) Tns.prepare_ios(attributes={"--path": self.app_name}) output = File.read(self.app_name + "/platforms/ios/TestApp/TestApp-Info.plist") assert "org.nativescript.MyApp" in output
def create_app(app_name, attributes={}, log_trace=False, assert_success=True, update_modules=True, force_clean=True, measureTime=False): if force_clean: if File.exists(app_name): Folder.cleanup(app_name) path = app_name attributes_to_string = "" for k, v in attributes.iteritems(): if "--path" in k: path = v attributes_to_string = "".join("{0} {1}".format(k, v)) attr = {} if not any(s in attributes_to_string for s in ("--ng", "--template", "--tsc", "--vue")): if BRANCH == "master": attr = { "--template": SUT_FOLDER + os.path.sep + "tns-template-hello-world.tgz" } else: attr = {"--template": "tns-template-hello-world"} attr.update(attributes) if app_name is None: output = Tns.run_tns_command("create ", attributes=attr, log_trace=log_trace, measureTime=measureTime) else: output = Tns.run_tns_command("create \"" + app_name + "\"", attributes=attr, log_trace=log_trace, measureTime=measureTime) if assert_success: TnsAsserts.created(app_name=app_name, output=output) if update_modules: Tns.update_modules(path) # Tns.ensure_app_resources(path) return output
def test_320_platform_add_ios_custom_bundle_id(self): # Create project with different appId Folder.cleanup(self.app_name) output = Tns.create_app( self.app_name, attributes={"--appid": "org.nativescript.MyApp"}, assert_success=False) TnsAsserts.created(self.app_name, output=output, full_check=False) output = File.read(self.app_name + os.sep + "package.json") assert "\"id\": \"org.nativescript.MyApp\"" in output # Add iOS platform Tns.platform_add_ios(attributes={ "--path": self.app_name, "--frameworkPath": IOS_PACKAGE }) # Verify plist file in native project (after prepare) Tns.prepare_ios(attributes={"--path": self.app_name}) output = File.read(self.app_name + "/platforms/ios/TestApp/TestApp-Info.plist") assert "org.nativescript.MyApp" in output