def test_301_build_project_with_space_release(self):
        Tns.create_app(self.app_name_space)
        Tns.platform_add_android(
            attributes={"--path": "\"" + self.app_name_space + "\"", "--frameworkPath": ANDROID_PACKAGE})

        # Ensure ANDROID_KEYSTORE_PATH contain spaces (verification for CLI issue 2650)
        Folder.create("with space")
        base_path, file_name = os.path.split(ANDROID_KEYSTORE_PATH)
        cert_with_space_path = os.path.join("with space", file_name)
        File.copy(src=ANDROID_KEYSTORE_PATH, dest=cert_with_space_path)

        # Verify project builds
        Tns.build_android(attributes={"--path": "\"" + self.app_name_space + "\"",
                                      "--keyStorePath": "\"" + cert_with_space_path + "\"",
                                      "--keyStorePassword": ANDROID_KEYSTORE_PASS,
                                      "--keyStoreAlias": ANDROID_KEYSTORE_ALIAS,
                                      "--keyStoreAliasPassword": ANDROID_KEYSTORE_ALIAS_PASS,
                                      "--release": ""
                                      })

        output = File.read(self.app_name_space + os.sep + "package.json")
        assert app_identifier in output.lower()

        output = File.read(
            self.app_name_space + "/" + TnsAsserts.PLATFORM_ANDROID_SRC_MAIN_PATH + "AndroidManifest.xml")
        assert app_identifier in output.lower()
    def test_391_platform_list(self):
        """Platform list command should list installed platforms and if app is prepared for those platforms"""
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name, update_modules=False)

        # `tns platform list` on brand new project
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output, prepared=Platform.NONE, added=Platform.NONE)

        # `tns platform list` when iOS is added
        Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_PACKAGE})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output, prepared=Platform.NONE, added=Platform.IOS)

        # `tns platform list` when iOS is prepared
        Tns.prepare_ios(attributes={"--path": self.app_name})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output, prepared=Platform.IOS, added=Platform.IOS)

        # `tns platform list` when android is added (iOS already prepared)
        Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output, prepared=Platform.IOS, added=Platform.BOTH)

        # `tns platform list` when android is prepared (iOS already prepared)
        Tns.prepare_android(attributes={"--path": self.app_name})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output, prepared=Platform.BOTH, added=Platform.BOTH)

        # Verify build both platforms is not allowed
        # Test for https://github.com/NativeScript/nativescript-cli/pull/3425
        output = Tns.run_tns_command(command="build", attributes={"--path": self.app_name})
        assert "The input is not valid sub-command for 'build' command" in output
        assert "<Platform> is the target mobile platform for which you want to build your project" in output
Esempio n. 3
0
    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_311_build_android_with_custom_compile_sdk_old(self):
     #https://github.com/NativeScript/nativescript-cli/issues/4052
     # This is required when build with different SDK
     Folder.cleanup(self.app_name)
     Tns.create_app(self.app_name)
     Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})
     Tns.build_android(attributes={"--compileSdk": "27", "--path": self.app_name})
Esempio n. 5
0
 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})
Esempio n. 6
0
 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})
Esempio n. 7
0
    def test_301_build_project_with_space_release(self):
        Tns.create_app(self.app_name_space)
        Tns.platform_add_android(
            attributes={
                "--path": "\"" + self.app_name_space + "\"",
                "--frameworkPath": ANDROID_PACKAGE
            })

        # Ensure ANDROID_KEYSTORE_PATH contain spaces (verification for CLI issue 2650)
        Folder.create("with space")
        base_path, file_name = os.path.split(ANDROID_KEYSTORE_PATH)
        cert_with_space_path = os.path.join("with space", file_name)
        File.copy(src=ANDROID_KEYSTORE_PATH, dest=cert_with_space_path)

        # Verify project builds
        Tns.build_android(
            attributes={
                "--path": "\"" + self.app_name_space + "\"",
                "--keyStorePath": "\"" + cert_with_space_path + "\"",
                "--keyStorePassword": ANDROID_KEYSTORE_PASS,
                "--keyStoreAlias": ANDROID_KEYSTORE_ALIAS,
                "--keyStoreAliasPassword": ANDROID_KEYSTORE_ALIAS_PASS,
                "--release": ""
            })

        output = File.read(self.app_name_space + os.sep + "package.json")
        assert app_identifier in output.lower()

        output = File.read(self.app_name_space + "/" +
                           TnsAsserts.PLATFORM_ANDROID_SRC_MAIN_PATH +
                           "AndroidManifest.xml")
        assert app_identifier in output.lower()
Esempio n. 8
0
 def test_330_platform_update_ios_platform_not_added(self):
     Tns.create_app(self.app_name)
     output = Tns.platform_update(platform="ios",
                                  attributes={"--path": self.app_name},
                                  assert_success=False)
     assert "Platform ios successfully added" in output
     assert not Folder.is_empty(
         self.app_name + "/platforms/ios/internal/metadata-generator")
    def test_202_build_android_with_log_trace_and_platform_not_added_or_empty(self):
        """'tns build android' with log trace options should output more logs."""
        Tns.create_app(self.app_no_platform)
        output = Tns.build_android(attributes={"--path": self.app_no_platform}, log_trace=True)

        # Assert log trace show gradle logs
        assert "[DEBUG]" in output
        assert "FAILURE" not in output
Esempio n. 10
0
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Simulator.stop()
        cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)

        Tns.create_app(cls.app_name, update_modules=True)
        Tns.install_npm(package=WEBPACK_PACKAGE, option='--save-dev', folder=cls.app_name)
        Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE})
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Emulator.stop()
        Emulator.ensure_available()

        Tns.create_app(cls.app_name, update_modules=True)
        Tns.install_npm(package=WEBPACK_PACKAGE, option='--save-dev', folder=cls.app_name)
        Tns.platform_add_android(attributes={"--path": cls.app_name, "--frameworkPath": ANDROID_PACKAGE})
    def test_313_build_android_with_invalid_compile_sdk(self):
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})

        output = Tns.build_android(attributes={"--compileSdk": "99", "--path": self.app_name},
                                   assert_success=False)
        assert "You have specified '99' for compile sdk, but it is not installed on your system." in output
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Emulator.stop()
     Device.ensure_available(platform=Platform.ANDROID)
     Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
     Tns.create_app(cls.app_name,
                    attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
                    update_modules=True)
     Tns.platform_add_android(attributes={'--path': cls.app_name, '--frameworkPath': ANDROID_PACKAGE})
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     if CURRENT_OS != OSType.OSX:
         raise NameError("Can not run iOS tests on non OSX OS.")
     else:
         Simulator.stop()
     Tns.create_app(cls.app_name)
     Tns.platform_add_ios(attributes={"--path": cls.app_name, "--frameworkPath": IOS_PACKAGE})
     Folder.copy(TEST_RUN_HOME + "/" + cls.app_name, TEST_RUN_HOME + "/data/TestApp")
 def test_102_platform_add_log_trace(self):
     Tns.create_app(self.app_name, update_modules=False)
     output = Tns.platform_add_android(attributes={"--path": self.app_name}, log_trace=True)
     assert "Looking for project in" in output
     assert "Project directory is" in output
     assert "Package: " + self.app_id in output
     assert "Installed Android Targets" in output
     assert "Using Android SDK" in output
     assert "Platform android successfully added" in output
Esempio n. 16
0
    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 + "\""})
Esempio n. 17
0
 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()
Esempio n. 18
0
 def test_102_platform_add_log_trace(self):
     Tns.create_app(self.app_name, update_modules=False)
     output = Tns.platform_add_android(attributes={"--path": self.app_name},
                                       log_trace=True)
     assert "Looking for project in" in output
     assert "Project directory is" in output
     assert "Package: " + self.app_id in output
     assert "Installed Android Targets" in output
     assert "Using Android SDK" in output
     assert "Platform android successfully added" in output
Esempio n. 19
0
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Tns.create_app(cls.app_name)
     Tns.platform_add_android(attributes={
         "--path": cls.app_name,
         "--frameworkPath": ANDROID_PACKAGE
     })
     Folder.cleanup(TEST_RUN_HOME + "/data/TestApp")
     Folder.copy(TEST_RUN_HOME + "/" + cls.app_name,
                 TEST_RUN_HOME + "/data/TestApp")
Esempio n. 20
0
    def test_202_build_android_with_log_trace_and_platform_not_added_or_empty(
            self):
        """'tns build android' with log trace options should output more logs."""
        Tns.create_app(self.app_no_platform)
        output = Tns.build_android(attributes={"--path": self.app_no_platform},
                                   log_trace=True)

        # Assert log trace show gradle logs
        assert "[DEBUG]" in output
        assert "FAILURE" not in output
Esempio n. 21
0
    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 setUp(self):
     BaseClass.setUp(self)
     Folder.cleanup(self.source_app)
     if CURRENT_OS != OSType.WINDOWS:
         Folder.copy(self.temp_app, self.source_app)
     else:
         Tns.create_app(self.app_name,
                        attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
                        update_modules=True)
         Tns.platform_add_android(attributes={'--path': self.app_name, '--frameworkPath': ANDROID_PACKAGE})
         Emulator.ensure_available()
    def test_399_build_project_with_gz_file(self):
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})

        # Create zip
        run("tar -czf " + self.app_name + "/app/app.tar.gz " + self.app_name + "/app/app.js")
        assert File.exists(self.app_name + "/app/app.tar.gz")
        # Build the project
        Tns.build_android(attributes={"--path": self.app_name})
    def test_321_build_with_copy_to_option(self):
        # TODO: Remove those lines after https://github.com/NativeScript/nativescript-cli/issues/2547 is fixed.
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})

        File.remove(self.debug_apk)
        Tns.build_android(attributes={"--path": self.app_name, "--copy-to": "./"})
        assert File.exists(self.debug_apk)
        File.remove(self.debug_apk)
Esempio n. 25
0
 def test_310_build_android_with_custom_compile_sdk_new(self):
     # This is required when build with different SDK
     Folder.cleanup(self.app_name)
     Tns.create_app(self.app_name)
     Tns.platform_add_android(attributes={
         "--path": self.app_name,
         "--frameworkPath": ANDROID_PACKAGE
     })
     Tns.build_android(attributes={
         "--compileSdk": "28",
         "--path": self.app_name
     })
Esempio n. 26
0
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Tns.create_app(cls.app_name)
        Tns.platform_add_ios(attributes={
            "--path": cls.app_name,
            "--frameworkPath": IOS_PACKAGE
        })

        Folder.cleanup("TestApp.app")
        File.remove("TestApp.ipa")

        Xcode.cleanup_cache()
Esempio n. 27
0
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Emulator.stop()
     Simulator.stop()
     cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
     Folder.cleanup(cls.app_name)
     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})
     Folder.cleanup(TEST_RUN_HOME + "/data/TestApp")
     Folder.copy(TEST_RUN_HOME + "/" + cls.app_name, TEST_RUN_HOME + "/data/TestApp")
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Tns.kill()
     Emulator.stop()
     Emulator.ensure_available()
     Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
     if CURRENT_OS != OSType.WINDOWS:
         Tns.create_app(cls.app_name,
                        attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
                        update_modules=True)
         Tns.platform_add_android(attributes={'--path': cls.app_name, '--frameworkPath': ANDROID_PACKAGE})
         Folder.cleanup(cls.temp_app)
         Folder.copy(cls.source_app, cls.temp_app)
Esempio n. 29
0
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Emulator.stop()
        Emulator.ensure_available()

        Tns.create_app(cls.app_name, update_modules=True)
        Tns.install_npm(package=WEBPACK_PACKAGE,
                        option='--save-dev',
                        folder=cls.app_name)
        Tns.platform_add_android(attributes={
            "--path": cls.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })
Esempio n. 30
0
 def test_311_build_android_with_custom_compile_sdk_old(self):
     #https://github.com/NativeScript/nativescript-cli/issues/4052
     # This is required when build with different SDK
     Folder.cleanup(self.app_name)
     Tns.create_app(self.app_name)
     Tns.platform_add_android(attributes={
         "--path": self.app_name,
         "--frameworkPath": ANDROID_PACKAGE
     })
     Tns.build_android(attributes={
         "--compileSdk": "27",
         "--path": self.app_name
     })
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Emulator.stop()
        Simulator.stop()
        Device.ensure_available(platform=Platform.IOS)
        Device.uninstall_app(app_prefix='org.nativescript.', platform=Platform.IOS)

        Folder.cleanup(cls.app_name)
        Tns.create_app(cls.app_name,
                       attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
                       update_modules=True)
        Folder.copy(src=os.path.join(cls.app_name, 'app'), dst=cls.TEMP_FOLDER)
        Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE})
Esempio n. 32
0
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     if CURRENT_OS != OSType.OSX:
         raise NameError("Can not run iOS tests on non OSX OS.")
     else:
         Simulator.stop()
     Tns.create_app(cls.app_name)
     Tns.platform_add_ios(attributes={
         "--path": cls.app_name,
         "--frameworkPath": IOS_PACKAGE
     })
     Folder.copy(TEST_RUN_HOME + "/" + cls.app_name,
                 TEST_RUN_HOME + "/data/TestApp")
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Emulator.stop()
        Emulator.ensure_available()

        Tns.create_app(BaseClass.app_name)
        Tns.platform_add_android(attributes={"--path": BaseClass.app_name, "--frameworkPath": ANDROID_PACKAGE})
        Tns.update_webpack(BaseClass.app_name)
        Folder.copy(os.path.join(TEST_RUN_HOME, BaseClass.app_name), os.path.join(TEST_RUN_HOME, "data", "TestApp"))

        #Download bundletool
        url = 'https://github.com/google/bundletool/releases/download/0.8.0/bundletool-all-0.8.0.jar'
        urllib.urlretrieve(url, os.path.join(SUT_FOLDER, 'bundletool.jar'))
Esempio n. 34
0
    def test_391_platform_list(self):
        """Platform list command should list installed platforms and if app is prepared for those platforms"""
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name, update_modules=False)

        # `tns platform list` on brand new project
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output,
                                        prepared=Platform.NONE,
                                        added=Platform.NONE)

        # `tns platform list` when iOS is added
        Tns.platform_add_ios(attributes={
            "--path": self.app_name,
            "--frameworkPath": IOS_PACKAGE
        })
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output,
                                        prepared=Platform.NONE,
                                        added=Platform.IOS)

        # `tns platform list` when iOS is prepared
        Tns.prepare_ios(attributes={"--path": self.app_name})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output,
                                        prepared=Platform.IOS,
                                        added=Platform.IOS)

        # `tns platform list` when android is added (iOS already prepared)
        Tns.platform_add_android(attributes={
            "--path": self.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output,
                                        prepared=Platform.IOS,
                                        added=Platform.BOTH)

        # `tns platform list` when android is prepared (iOS already prepared)
        Tns.prepare_android(attributes={"--path": self.app_name})
        output = Tns.platform_list(attributes={"--path": self.app_name})
        TnsAsserts.platform_list_status(output=output,
                                        prepared=Platform.BOTH,
                                        added=Platform.BOTH)

        # Verify build both platforms is not allowed
        # Test for https://github.com/NativeScript/nativescript-cli/pull/3425
        output = Tns.run_tns_command(command="build",
                                     attributes={"--path": self.app_name})
        assert "The input is not valid sub-command for 'build' command" in output
        assert "<Platform> is the target mobile platform for which you want to build your project" in output
Esempio n. 35
0
    def test_399_build_project_with_gz_file(self):
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={
            "--path": self.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })

        # Create zip
        run("tar -czf " + self.app_name + "/app/app.tar.gz " + self.app_name +
            "/app/app.js")
        assert File.exists(self.app_name + "/app/app.tar.gz")
        # Build the project
        Tns.build_android(attributes={"--path": self.app_name})
Esempio n. 36
0
    def test_313_build_android_with_invalid_compile_sdk(self):
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={
            "--path": self.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })

        output = Tns.build_android(attributes={
            "--compileSdk": "99",
            "--path": self.app_name
        },
                                   assert_success=False)
        assert "You have specified '99' for compile sdk, but it is not installed on your system." in output
Esempio n. 37
0
    def test_100_plugin_add_sandbox_pod_can_write_in_app_folder(self):
        Tns.create_app(self.app_name)
        Tns.platform_add_ios(attributes={"--path": self.app_name,
                                         "--frameworkPath": IOS_PACKAGE})

        plugin = os.path.join(TEST_RUN_HOME, "data", "CocoaPods", "nativescript-ios-working-with-sandbox-plugin.tgz")
        output = Tns.plugin_add(plugin, attributes={"--path": self.app_name}, assert_success=False)
        assert "Successfully installed plugin nativescript-ios-working-with-sandbox-plugin." in output
        assert "nativescript-ios-working-with-sandbox-plugin" in File.read(self.app_name + "/package.json")

        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        assert "Successfully prepared plugin " + \
               "nativescript-ios-working-with-sandbox-plugin for ios." in output

        assert "content" in File.read(self.app_name + "/platforms/ios/TestApp/app/I_MADE_THIS_FILE.txt")
Esempio n. 38
0
    def test_001_usage_reporting_enable(self):
        output = Tns.run_tns_command("usage-reporting enable")
        assert enabled.format(usage_reporting, "now ") in output
        assert "GA_TRACKING_ID" in File.read(self.config)
        assert "UA-111455-44" in File.read(self.config)

        # Check there is message for tracking in Google Analytics
        output = Tns.run_tns_command("doctor", timeout=180, log_trace=True)
        assert "Will send the following information to Google Analytics" in output

        output = Tns.run_tns_command("usage-reporting status")
        assert enabled.format(usage_reporting, "") in output

        # https://github.com/NativeScript/nativescript-cli/issues/3595
        output = Tns.create_app(self.app_name,
                                attributes={
                                    '--template':
                                    os.path.join('data', 'apps',
                                                 'livesync-hello-world.tgz')
                                },
                                log_trace=True,
                                force_clean=False,
                                update_modules=True)
        assert "label: 'data/apps/livesync-hello-world.tgz'" not in output
        assert "label: 'localTemplate_tns-template-hello-world'" in output
Esempio n. 39
0
    def test_400_plugin_add_sandbox_pod_can_write_outside_app_folder_by_default(self):
        Tns.create_app(self.app_name)
        Tns.platform_add_ios(attributes={"--path": self.app_name,
                                         "--frameworkPath": IOS_PACKAGE})

        plugin = os.path.join(TEST_RUN_HOME, "data", "CocoaPods", "nativescript-ios-fail-with-sandbox-plugin.tgz")
        output = Tns.plugin_add(plugin, attributes={"--path": self.app_name}, assert_success=False)
        assert "Successfully installed plugin nativescript-ios-fail-with-sandbox-plugin." in output
        assert "nativescript-ios-fail-with-sandbox-plugin" in File.read(self.app_name + "/package.json")

        output = Tns.prepare_ios(attributes={"--path": self.app_name}, assert_success=False)
        assert "Successfully prepared " + \
               "plugin nativescript-ios-fail-with-sandbox-plugin for ios." in output

        assert "sh: ../I_MADE_THIS_FILE.txt: Operation not permitted" not in output
        assert File.exists(self.app_name + "/platforms/I_MADE_THIS_FILE.txt")
Esempio n. 40
0
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)
        Emulator.stop()
        Emulator.ensure_available()

        Tns.create_app(BaseClass.app_name)
        Tns.platform_add_android(attributes={
            "--path": BaseClass.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })
        Tns.update_webpack(BaseClass.app_name)
        Folder.copy(os.path.join(TEST_RUN_HOME, BaseClass.app_name),
                    os.path.join(TEST_RUN_HOME, "data", "TestApp"))

        #Download bundletool
        url = 'https://github.com/google/bundletool/releases/download/0.8.0/bundletool-all-0.8.0.jar'
        urllib.urlretrieve(url, os.path.join(SUT_FOLDER, 'bundletool.jar'))
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)

        Folder.cleanup(cls.app_no_platform)

        File.remove(cls.debug_apk)
        File.remove(cls.release_apk)
        Folder.cleanup('temp')

        Tns.create_app(cls.app_name)
        Tns.platform_add_android(attributes={"--path": cls.app_name, "--frameworkPath": ANDROID_PACKAGE})

        # Add release and debug configs
        debug = os.path.join(cls.app_name, 'app', 'config.debug.json')
        release = os.path.join(cls.app_name, 'app', 'config.release.json')
        File.write(file_path=debug, text='{"config":"debug"}')
        File.write(file_path=release, text='{"config":"release"}')
 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})
Esempio n. 43
0
    def test_401_plugin_add_sandbox_pod_can_not_write_outside_app_folder_if_use_pod_sandbox_is_true(self):
        File.replace("node_modules/nativescript/config/config.json", '"USE_POD_SANDBOX": false',
                     '"USE_POD_SANDBOX": true')
        Tns.create_app(self.app_name)
        Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_PACKAGE})

        plugin = os.path.join(TEST_RUN_HOME, "data", "CocoaPods", "nativescript-ios-fail-with-sandbox-plugin.tgz")
        output = Tns.plugin_add(plugin, attributes={"--path": self.app_name}, assert_success=False)
        assert "Successfully installed plugin nativescript-ios-fail-with-sandbox-plugin." in output
        assert "nativescript-ios-fail-with-sandbox-plugin" in File.read(self.app_name + "/package.json")

        output = Tns.prepare_ios(attributes={"--path": self.app_name}, assert_success=False)
        assert "Successfully prepared " + \
               "plugin nativescript-ios-fail-with-sandbox-plugin for ios." in output

        assert "sh: ../I_MADE_THIS_FILE.txt: Operation not permitted" in output
        assert not File.exists(self.app_name + "/platforms/I_MADE_THIS_FILE.txt")
Esempio n. 44
0
    def test_321_build_with_copy_to_option(self):
        # TODO: Remove those lines after https://github.com/NativeScript/nativescript-cli/issues/2547 is fixed.
        # This is required when build with different SDK
        Folder.cleanup(self.app_name)
        Tns.create_app(self.app_name)
        Tns.platform_add_android(attributes={
            "--path": self.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })

        File.remove(self.debug_apk)
        Tns.build_android(attributes={
            "--path": self.app_name,
            "--copy-to": "./"
        })
        assert File.exists(self.debug_apk)
        File.remove(self.debug_apk)
Esempio n. 45
0
 def setUp(self):
     BaseClass.setUp(self)
     Folder.cleanup(self.source_app)
     if CURRENT_OS != OSType.WINDOWS:
         Folder.copy(self.temp_app, self.source_app)
     else:
         Tns.create_app(self.app_name,
                        attributes={
                            '--template':
                            os.path.join('data', 'apps',
                                         'livesync-hello-world.tgz')
                        },
                        update_modules=True)
         Tns.platform_add_android(attributes={
             '--path': self.app_name,
             '--frameworkPath': ANDROID_PACKAGE
         })
         Emulator.ensure_available()
    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()
Esempio n. 47
0
    def setUpClass(cls):
        BaseClass.setUpClass(cls.__name__)

        Folder.cleanup(cls.app_no_platform)

        File.remove(cls.debug_apk)
        File.remove(cls.release_apk)
        Folder.cleanup('temp')

        Tns.create_app(cls.app_name)
        Tns.platform_add_android(attributes={
            "--path": cls.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })

        # Add release and debug configs
        debug = os.path.join(cls.app_name, 'app', 'config.debug.json')
        release = os.path.join(cls.app_name, 'app', 'config.release.json')
        File.write(file_path=debug, text='{"config":"debug"}')
        File.write(file_path=release, text='{"config":"release"}')
Esempio n. 48
0
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Tns.kill()
     Emulator.stop()
     Emulator.ensure_available()
     Device.uninstall_app(app_prefix="org.nativescript.",
                          platform=Platform.ANDROID)
     if CURRENT_OS != OSType.WINDOWS:
         Tns.create_app(cls.app_name,
                        attributes={
                            '--template':
                            os.path.join('data', 'apps',
                                         'livesync-hello-world.tgz')
                        },
                        update_modules=True)
         Tns.platform_add_android(attributes={
             '--path': cls.app_name,
             '--frameworkPath': ANDROID_PACKAGE
         })
         Folder.cleanup(cls.temp_app)
         Folder.copy(cls.source_app, cls.temp_app)
 def test_101_create_project_log_trace(self):
     output = Tns.create_app(self.app_name, log_trace=True, update_modules=False)
     assert "Creating a new NativeScript project with name " + self.app_name in output
     assert "and id org.nativescript.{0} at location".format(self.app_name.replace("_", "")) in output
     
     if USE_YARN == "True":
             assert 'spawn: yarn' in output
     else:
         if CURRENT_OS == OSType.WINDOWS:
             assert 'spawn: npm.cmd "install"' in output 
         else:
             assert 'spawn: npm "install"' in output
     assert "Project " + self.app_name + " was successfully created" in 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 test_001_usage_reporting_enable(self):
        output = Tns.run_tns_command("usage-reporting enable")
        assert enabled.format(usage_reporting, "now ") in output
        assert "GA_TRACKING_ID" in File.read(self.config)
        assert "UA-111455-44" in File.read(self.config)

        # Check there is message for tracking in Google Analytics
        output = Tns.run_tns_command("doctor", timeout=180, log_trace=True)
        assert "Will send the following information to Google Analytics" in output

        output = Tns.run_tns_command("usage-reporting status")
        assert enabled.format(usage_reporting, "") in output

        # https://github.com/NativeScript/nativescript-cli/issues/3595
        output = Tns.create_app(self.app_name,
                                attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
                                log_trace=True,
                                force_clean=False, update_modules=True)
        assert "label: 'data/apps/livesync-hello-world.tgz'" not in output
        assert "label: 'localTemplate_tns-template-hello-world'" in output
 def test_330_platform_update_ios_platform_not_added(self):
     Tns.create_app(self.app_name)
     output = Tns.platform_update(platform="ios", attributes={"--path": self.app_name}, assert_success=False)
     assert "Platform ios successfully added" in output
     assert not Folder.is_empty(self.app_name + "/platforms/ios/internal/metadata-generator")
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     if CURRENT_OS != OSType.OSX:
         raise NameError("Can not run iOS tests on non OSX OS.")
     Tns.create_app(cls.app_name)
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Tns.create_app(cls.app_name, update_modules=False)
 def setUpClass(cls):
     BaseClass.setUpClass(cls.__name__)
     Tns.create_app(cls.app_name)
     Folder.copy(TEST_RUN_HOME + "/" + cls.app_name, TEST_RUN_HOME + "/data/TestApp")