def test_300_build_demo(self): # TODO: Run npm scripts from plugin seed (build plugin, link plugin and then build the app). Tns.plugin_create(name=self.plugin_name) demo_path = self.plugin_name + os.sep + 'demo' Tns.build_android(attributes={"--path": demo_path}) if CURRENT_OS == OSType.OSX: Tns.build_ios(attributes={"--path": demo_path})
def test_390_LSApplicationQueriesSchemes_merged(self): # https: // github.com / NativeScript / nativescript - cli / issues / 3108 Folder.cleanup( os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'Info.plist')) info_c = os.path.join('data', 'issues', 'info-plist', 'app', 'Info.plist') info_p = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS') Folder.copy(info_c, info_p) Tns.plugin_add("nativescript-geolocation", attributes={"--path": self.app_name}) Folder.cleanup( os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios', 'Info.plist')) info_plugin_c = os.path.join('data', 'issues', 'info-plist', 'plugin', 'Info.plist') info_plugin_p = os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios') Folder.copy(info_plugin_c, info_plugin_p) Tns.build_ios(attributes={"--path": self.app_name}) output = File.read( os.path.join(self.app_name, 'platforms', 'ios', 'TestApp', 'TestApp-Info.plist')) assert 'itms' in output assert "itms-apps" in output assert "LSApplicationQueriesSchemes" in output
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_302_build_ios_with_ios_in_path(self): Tns.create_app(self.app_name_ios) Tns.platform_add_ios(attributes={ "--path": self.app_name_ios, "--frameworkPath": IOS_PACKAGE }) Tns.build_ios(attributes={"--path": self.app_name_ios})
def test_301_build_ios_with_space(self): Tns.create_app(self.app_name_space) Tns.platform_add_ios( attributes={ "--path": "\"" + self.app_name_space + "\"", "--frameworkPath": IOS_PACKAGE }) Tns.build_ios(attributes={"--path": "\"" + self.app_name_space + "\""})
def test_301_platform_update_ios(self): Tns.platform_add_ios(version="2.2.0", attributes={"--path": self.app_name}) output = File.read(self.app_name + os.sep + "package.json") assert "\"version\": \"2.2.0\"" in output Tns.platform_update("[email protected]", attributes={"--path": self.app_name, " < data/keys/enter_key.txt": ""}) output = File.read(self.app_name + os.sep + "package.json") assert "\"version\": \"2.3.0\"" in output Tns.build_ios(attributes={"--path": self.app_name})
def test_300_build_ios_with_dash(self): Tns.create_app(self.app_name_dash) Tns.platform_add_ios(attributes={ "--path": self.app_name_dash, "--frameworkPath": IOS_PACKAGE }) Tns.build_ios(attributes={"--path": self.app_name_dash}) # Verify project id output = File.read(self.app_name_dash + os.sep + "package.json") assert app_identifier in output
def test_301_platform_update_ios(self): Tns.platform_add_ios(version="2.2.0", attributes={"--path": self.app_name}) output = File.read(self.app_name + os.sep + "package.json") assert "\"version\": \"2.2.0\"" in output Tns.platform_update("[email protected]", attributes={ "--path": self.app_name, " < data/keys/enter_key.txt": "" }) output = File.read(self.app_name + os.sep + "package.json") assert "\"version\": \"2.3.0\"" in output Tns.build_ios(attributes={"--path": self.app_name})
def test_390_LSApplicationQueriesSchemes_merged(self): # https: // github.com / NativeScript / nativescript - cli / issues / 3108 Folder.cleanup(os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'Info.plist')) info_c = os.path.join('data', 'issues', 'info-plist', 'app', 'Info.plist') info_p = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS') Folder.copy(info_c, info_p) Tns.plugin_add("nativescript-geolocation", attributes={"--path": self.app_name}) Folder.cleanup( os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios', 'Info.plist')) info_plugin_c = os.path.join('data', 'issues', 'info-plist', 'plugin', 'Info.plist') info_plugin_p = os.path.join(self.app_name, 'node_modules', 'nativescript-geolocation', 'platforms', 'ios') Folder.copy(info_plugin_c, info_plugin_p) Tns.build_ios(attributes={"--path": self.app_name}) output = File.read(os.path.join(self.app_name, 'platforms', 'ios', 'TestApp', 'TestApp-Info.plist')) assert 'itms' in output assert "itms-apps" in output assert "LSApplicationQueriesSchemes" in output
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_400_build_ios_with_wrong_param(self): Tns.create_app(self.app_name_no_platform) output = Tns.build_ios(attributes={ "--path": self.app_name_no_platform, "--" + invalid: "" }, assert_success=False) assert invalid_option.format(invalid) in output assert error not in output.lower()
def test_200_build_ios_inside_project(self): Folder.navigate_to(self.app_name) output = Tns.build_ios(tns_path=os.path.join("..", TNS_PATH), attributes={"--path": self.app_name}, assert_success=False, log_trace=True) Folder.navigate_to(TEST_RUN_HOME, relative_from_current_folder=False) assert "build/Debug-iphonesimulator/TestApp.app" in output assert File.exists( self.app_name + "/platforms/ios/build/Debug-iphonesimulator/TestApp.app")
def test_310_build_ios_with_copy_to(self): Folder.cleanup("TestApp.app") File.remove("TestApp.ipa") # Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH}) Tns.build_ios(attributes={ "--path": self.app_name, "--copy-to": "./" }, log_trace=True) assert File.exists("TestApp.app") Tns.build_ios(attributes={ "--path": self.app_name, "--forDevice": "", "--release": "", "--copy-to": "./" }, log_trace=True) assert File.exists("TestApp.ipa")
def test_100_plugin_add_xcconfig_before_platform_add_ios(self): plugin_path = TEST_RUN_HOME + "/data/CocoaPods/xcconfig-plugin.tgz" output = Tns.plugin_add(plugin_path, attributes={"--path": self.app_name}, assert_success=False) assert "Successfully installed plugin xcconfig-plugin." in output assert File.exists(self.app_name + "/node_modules/xcconfig-plugin/package.json") assert File.exists(self.app_name + "/node_modules/xcconfig-plugin/platforms/ios/build.xcconfig") assert File.exists(self.app_name + "/node_modules/xcconfig-plugin/platforms/ios/module.modulemap") assert File.exists(self.app_name + "/node_modules/xcconfig-plugin/platforms/ios/XcconfigPlugin.h") assert "xcconfig-plugin" in File.read(self.app_name + "/package.json") Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_PACKAGE}) output = Tns.prepare_ios(attributes={"--path": self.app_name}) assert "Successfully prepared plugin xcconfig-plugin for ios." in output output = File.read(self.app_name + "/platforms/ios/plugins-debug.xcconfig") assert "OTHER_LDFLAGS = $(inherited) -l\"sqlite3\"" in output output = File.read(self.app_name + "/platforms/ios/TestApp/build-debug.xcconfig") assert "#include \"../plugins-debug.xcconfig\"" in output Tns.build_ios(attributes={"--path": self.app_name})
def test_190_build_ios_distribution_provisions(self): Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": self.app_name}, assert_success=False) # List all provisions and verify them output = Tns.build_ios(attributes={ "--path": self.app_name, "--provision": "" }, assert_success=False) assert "Provision Name" in output assert "Provision UUID" in output assert "App Id" in output assert "Team" in output assert "Type" in output assert "Due" in output assert "Devices" in output assert PROVISIONING in output assert DISTRIBUTION_PROVISIONING in output assert DEVELOPMENT_TEAM in output # Build with correct distribution provision build_attributes = { "--path": self.app_name, "--forDevice": "", "--release": "", "--provision": DISTRIBUTION_PROVISIONING } Tns.build_ios(attributes=build_attributes) # Verify that passing wrong provision shows user friendly error output = Tns.build_ios(attributes={ "--path": self.app_name, "--provision": "fake" }, assert_success=False) assert "Failed to find mobile provision with UUID or Name: fake" in output
def test_001_build_ios(self): Tns.build_ios(attributes={"--path": self.app_name}, log_trace=True) Tns.build_ios(attributes={ "--path": self.app_name, "--release": "" }, log_trace=True) Tns.build_ios(attributes={ "--path": self.app_name, "--forDevice": "" }, log_trace=True) Tns.platform_add_android(attributes={ "--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE }) Tns.build_ios(attributes={ "--path": self.app_name, "--forDevice": "", "--release": "" }, log_trace=True) # Verify no aar and frameworks in platforms folder assert not File.pattern_exists(self.app_name + "/platforms/ios", "*.aar") assert not File.pattern_exists( self.app_name + "/platforms/ios/TestApp/app/tns_modules", "*.framework") # Verify ipa has both armv7 and arm64 archs ipa_path = os.path.join(self.app_name, "platforms", "ios", "build", "Release-iphoneos", "TestApp.ipa") run("mv " + ipa_path + " TestApp-ipa.tgz") run("unzip -o TestApp-ipa.tgz") output = run("lipo -info Payload/TestApp.app/TestApp") Folder.cleanup("Payload") assert "Architectures in the fat file: Payload/TestApp.app/TestApp are: armv7 arm64" in output
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 test_405_build_ios_on_linux_machine(self): output = Tns.build_ios(attributes={"--path": self.app_name}, assert_success=False) assert "applications for platform ios can not be built on this os" in output.lower()
def test_100_build_xcode10_without_build_xcconfig(self): #https://github.com/NativeScript/nativescript-cli/issues/3912 file = os.path.join(self.app_name, 'app', 'App_Resources', 'iOS', 'build.xcconfig') File.remove(file) Tns.build_ios(attributes={"--path": self.app_name}, log_trace=True)
def test_200_build_ios_ng_project_release_fordevice(self): Tns.build_ios(attributes={"--path": self.app_name, "--for-device": "", "--release": ""}) platform_folder = os.path.join(self.app_name, 'platforms', 'ios', self.app_name, 'app', 'app', 'item') assert File.pattern_exists(platform_folder, '*.js'), "JS files not found!" assert not File.pattern_exists(platform_folder, '*.ts'), "TS files found!"
def test_210_build_ios_platform_not_added_or_platforms_deleted(self): Tns.create_app(self.app_name_no_platform) Tns.build_ios(attributes={"--path": self.app_name_no_platform})
def test_100_build_ios_ng_project(self): Tns.build_ios(attributes={"--path": self.app_name})
def test_405_build_ios_on_linux_machine(self): output = Tns.build_ios(attributes={"--path": self.app_name}, assert_success=False) assert "applications for platform ios can not be built on this os" in output.lower( )