Beispiel #1
0
    def test_003_debug_ios_simulator_start(self):
        """
        Attach the debug tools to a running app in the iOS Simulator
        """

        # Run the app and ensure it works
        log = Tns.run_ios(attributes={
            '--path': self.app_name,
            '--emulator': '',
            '--justlaunch': ''
        },
                          assert_success=False,
                          timeout=30)
        TnsAsserts.prepared(app_name=self.app_name,
                            platform=Platform.IOS,
                            output=log,
                            prepare=Prepare.SKIP)
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_home')

        # Attach debugger
        log = Tns.debug_ios(
            attributes={
                '--path': self.app_name,
                '--emulator': '',
                '--start': '',
                '--inspector': ''
            })
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(
            log, app_started=False)
Beispiel #2
0
    def test_200_prepare_additional_appresources(self):
        # prepare project
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.FULL)

        # Create new files in AppResources
        File.copy(
            self.app_name +
            "/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png",
            self.app_name + "/app/App_Resources/iOS/newDefault.png")

        # prepare project
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.INCREMENTAL)

        # Verify XCode Project include files from App Resources folder
        output = run(
            "cat " + self.app_name +
            "/platforms/ios/TestApp.xcodeproj/project.pbxproj | grep newDefault.png"
        )
        assert "newDefault.png" in output
Beispiel #3
0
    def test_300_prepare_ios_preserve_case(self):
        File.copy(
            self.app_name +
            "/node_modules/tns-core-modules/application/application-common.js",
            self.app_name +
            "/node_modules/tns-core-modules/application/New-application-common.js"
        )
        File.copy(
            self.app_name +
            "/node_modules/tns-core-modules/application/application.android.js",
            self.app_name +
            "/node_modules/tns-core-modules/application/New-application.android.js"
        )
        File.copy(
            self.app_name +
            "/node_modules/tns-core-modules/application/application.ios.js",
            self.app_name +
            "/node_modules/tns-core-modules/application/New-application.ios.js"
        )

        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.FULL)

        # Verify case is preserved
        path = TnsAsserts._get_ios_modules_path(self.app_name)
        assert File.exists(path + 'application/New-application-common.js')
        assert File.exists(path + 'application/New-application.js')
        assert not File.exists(path + 'application/New-application.ios.js')
Beispiel #4
0
 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)
Beispiel #5
0
 def test_201_prepare_ios_platform_not_added(self):
     Tns.platform_remove(platform=Platform.IOS,
                         attributes={"--path": self.app_name},
                         assert_success=False)
     output = Tns.prepare_ios(attributes={"--path": self.app_name})
     TnsAsserts.prepared(self.app_name,
                         platform=Platform.IOS,
                         output=output,
                         prepare=Prepare.FIRST_TIME)
Beispiel #6
0
 def test_201_build_android_with_additional_prepare(self):
     """Verify that manually running prepare does not break next build command."""
     ReplaceHelper.replace(self.app_name,
                           file_change=ReplaceHelper.CHANGE_JS)
     output = Tns.prepare_android(attributes={"--path": self.app_name},
                                  assert_success=False)
     TnsAsserts.prepared(self.app_name,
                         platform=Platform.ANDROID,
                         output=output,
                         prepare=Prepare.INCREMENTAL)
     Tns.build_android(attributes={"--path": self.app_name})
 def test_310_tns_run_ios_emulator_should_run_only_on_emulator(self):
     """
     `tns run ios --emulator` should start emulator even if physical device is connected
     """
     self.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
     output = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--justlaunch': ''},
                          assert_success=False)
     TnsAsserts.prepared(app_name=self.app_name, output=output, platform=Platform.IOS, prepare=Prepare.INCREMENTAL)
     app_id = Tns.get_app_id(self.app_name)
     assert app_id + " on device " + self.SIMULATOR_ID in output, "App not deployed on iOS Simulator!"
     for device_id in self.DEVICES:
         assert app_id + " on device " + device_id not in output, 'App is deployed on {0} device.'.format(device_id)
    def test_003_debug_ios_simulator_start(self):
        """
        Attach the debug tools to a running app in the iOS Simulator
        """

        # Run the app and ensure it works
        log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--justlaunch': ''},
                          assert_success=False, timeout=30)
        TnsAsserts.prepared(app_name=self.app_name, platform=Platform.IOS, output=log, prepare=Prepare.SKIP)
        Device.screen_match(device_name=SIMULATOR_NAME, device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_home')

        # Attach debugger
        log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': '', '--start': '', '--inspector': ''})
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log, app_started=False)
    def test_200_prepare_additional_appresources(self):
        # prepare project
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.FULL)

        # Create new files in AppResources
        File.copy(self.app_name + "/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png",
                  self.app_name + "/app/App_Resources/iOS/newDefault.png")

        # prepare project
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.INCREMENTAL)

        # Verify XCode Project include files from App Resources folder
        output = run("cat " + self.app_name + "/platforms/ios/TestApp.xcodeproj/project.pbxproj | grep newDefault.png")
        assert "newDefault.png" in output
    def test_300_prepare_ios_preserve_case(self):
        File.copy(self.app_name + "/node_modules/tns-core-modules/application/application-common.js",
                  self.app_name + "/node_modules/tns-core-modules/application/New-application-common.js")
        File.copy(self.app_name + "/node_modules/tns-core-modules/application/application.android.js",
                  self.app_name + "/node_modules/tns-core-modules/application/New-application.android.js")
        File.copy(self.app_name + "/node_modules/tns-core-modules/application/application.ios.js",
                  self.app_name + "/node_modules/tns-core-modules/application/New-application.ios.js")

        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.FULL)

        # Verify case is preserved
        path = TnsAsserts._get_ios_modules_path(self.app_name)
        assert File.exists(path + 'application/New-application-common.js')
        assert File.exists(path + 'application/New-application.js')
        assert not File.exists(path + 'application/New-application.ios.js')
Beispiel #11
0
 def test_310_tns_run_ios_emulator_should_run_only_on_emulator(self):
     """
     `tns run ios --emulator` should start emulator even if physical device is connected
     """
     self.SIMULATOR_ID = Simulator.ensure_available(
         simulator_name=SIMULATOR_NAME)
     output = Tns.run_ios(attributes={
         '--path': self.app_name,
         '--emulator': '',
         '--justlaunch': ''
     },
                          assert_success=False)
     TnsAsserts.prepared(app_name=self.app_name,
                         output=output,
                         platform=Platform.IOS,
                         prepare=Prepare.INCREMENTAL)
     app_id = Tns.get_app_id(self.app_name)
     assert app_id + " on device " + self.SIMULATOR_ID in output, "App not deployed on iOS Simulator!"
     for device_id in self.DEVICES:
         assert app_id + " on device " + device_id not in output, 'App is deployed on {0} device.'.format(
             device_id)
Beispiel #12
0
    def test_101_prepare_android(self):
        # Initial prepare should be full.
        output = Tns.prepare_android(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FULL)

        # If no file is touched next time prepare should be skipped at all.
        output = Tns.prepare_android(attributes={"--path": self.app_name}, assert_success=False)
        TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.SKIP)

        # If some JS/CSS/XML is changed incremental prepare should be done.
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS)
        output = Tns.prepare_android(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.INCREMENTAL)
 def test_201_prepare_ios_platform_not_added(self):
     Tns.platform_remove(platform=Platform.IOS, attributes={"--path": self.app_name}, assert_success=False)
     output = Tns.prepare_ios(attributes={"--path": self.app_name})
     TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.FIRST_TIME)
    def test_100_prepare_ios(self):
        Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_PACKAGE})

        # Initial prepare should be full.
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.FULL)

        # If no file is touched next time prepare should be skipped at all.
        output = Tns.prepare_ios(attributes={"--path": self.app_name}, assert_success=False)
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.SKIP)

        # If some JS/CSS/XML is changed incremental prepare should be done.
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS)
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.INCREMENTAL)

        # Verify Xcode Schemes
        output = run("xcodebuild -project " + self.app_name + "/platforms/ios/TestApp.xcodeproj/ -list")
        assert "This project contains no schemes." not in output
        result = re.search("Targets:\n\s*TestApp", output)
        assert result is not None
        result = re.search("Schemes:\n\s*TestApp", output)
        assert result is not None

        # Initial prepare for other platform (Android) should be full.
        output = Tns.prepare_android(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FULL)

        # Prepare original platform (iOS) should be skipped.
        output = Tns.prepare_ios(attributes={"--path": self.app_name}, assert_success=False)
        TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.SKIP)

        # Initial prepare for other platform (Android) should be skipped.
        output = Tns.prepare_android(attributes={"--path": self.app_name}, assert_success=False)
        TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.SKIP)
Beispiel #15
0
    def test_100_prepare_ios(self):
        Tns.platform_add_android(attributes={
            "--path": self.app_name,
            "--frameworkPath": ANDROID_PACKAGE
        })

        # Initial prepare should be full.
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.FULL)

        # If no file is touched next time prepare should be skipped at all.
        output = Tns.prepare_ios(attributes={"--path": self.app_name},
                                 assert_success=False)
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.SKIP)

        # If some JS/CSS/XML is changed incremental prepare should be done.
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS)
        output = Tns.prepare_ios(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.INCREMENTAL)

        # Verify Xcode Schemes
        output = run("xcodebuild -project " + self.app_name +
                     "/platforms/ios/TestApp.xcodeproj/ -list")
        assert "This project contains no schemes." not in output
        result = re.search("Targets:\n\s*TestApp", output)
        assert result is not None
        result = re.search("Schemes:\n\s*TestApp", output)
        assert result is not None

        # Initial prepare for other platform (Android) should be full.
        output = Tns.prepare_android(attributes={"--path": self.app_name})
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.ANDROID,
                            output=output,
                            prepare=Prepare.FULL)

        # Prepare original platform (iOS) should be skipped.
        output = Tns.prepare_ios(attributes={"--path": self.app_name},
                                 assert_success=False)
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.IOS,
                            output=output,
                            prepare=Prepare.SKIP)

        # Initial prepare for other platform (Android) should be skipped.
        output = Tns.prepare_android(attributes={"--path": self.app_name},
                                     assert_success=False)
        TnsAsserts.prepared(self.app_name,
                            platform=Platform.ANDROID,
                            output=output,
                            prepare=Prepare.SKIP)
Beispiel #16
0
 def test_102_prepare_android_inside_project(self):
     Folder.navigate_to(self.app_name)
     output = Tns.prepare_android(tns_path=os.path.join("..", TNS_PATH), assert_success=False)
     Folder.navigate_to(TEST_RUN_HOME, relative_from_current_folder=False)
     TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FULL)
Beispiel #17
0
 def test_200_prepare_android_platform_not_added(self):
     Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": self.app_name}, assert_success=False)
     output = Tns.prepare_android(attributes={"--path": self.app_name})
     TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FIRST_TIME)
 def test_201_build_android_with_additional_prepare(self):
     """Verify that manually running prepare does not break next build command."""
     ReplaceHelper.replace(self.app_name, file_change=ReplaceHelper.CHANGE_JS)
     output = Tns.prepare_android(attributes={"--path": self.app_name}, assert_success=False)
     TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.INCREMENTAL)
     Tns.build_android(attributes={"--path": self.app_name})