def test_100_debug_ios_simulator_with_livesync(self):
        """
        `tns debug ios` should be able to run with livesync
        """
        log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': '', '--inspector': ''})
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log)

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID, expected_image='livesync-hello-world_home')

        # Change JS and wait until app is synced
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
        strings = ['Successfully transferred', 'main-view-model.js', 'CONSOLE LOG',
                   'Backend socket closed', 'Frontend socket closed',
                   'Frontend client connected', 'Backend socket created', 'NativeScript debugger attached']
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Change XML and wait until app is synced. App doesn't restart from 5.1.0 version
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_XML, sleep=3)
        strings = ['Successfully transferred', 'main-page.xml', 'CONSOLE LOG']
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Change CSS and wait until app is synced. App doesn't restart from 5.1.0 version
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_CSS, sleep=3)
        strings = ['Successfully transferred', 'app.css', 'CONSOLE LOG']
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Verify application looks correct
        Device.screen_match(device_name=SIMULATOR_NAME, device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_js_css_xml', tolerance=0.26)

        assert Process.is_running('NativeScript Inspector')
Exemplo n.º 2
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)
    def test_001_debug_ios_simulator(self):
        """
        Default `tns debug ios` starts debugger (do not stop at the first code statement)
        """
        log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': '', '--inspector': ''})
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log)

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID, expected_image='livesync-hello-world_home')
    def test_002_debug_ios_simulator_debug_brk(self):
        """
        Starts debugger and stop at the first code statement.
        """

        log = Tns.debug_ios(
            attributes={'--path': self.app_name, '--emulator': '', '--debug-brk': '', '--inspector': ''})
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log, app_started=False)
        # In this case `app_started` is False because app is not loaded when using '--debug-brk'.
        # '--debug-brk' stops before app loaded.

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME, tolerance=3.0, device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_debug_brk')
    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)
Exemplo n.º 6
0
    def test_001_debug_ios_simulator(self):
        """
        Default `tns debug ios` starts debugger (do not stop at the first code statement)
        """
        log = Tns.debug_ios(attributes={
            '--path': self.app_name,
            '--emulator': '',
            '--inspector': ''
        })
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log)

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_home')
Exemplo n.º 7
0
    def test_100_debug_ios_simulator_with_livesync(self):
        """
        `tns debug ios` should be able to run with livesync
        """
        log = Tns.debug_ios(attributes={
            '--path': self.app_name,
            '--emulator': '',
            '--inspector': ''
        })
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(log)

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_home')

        # Change JS and wait until app is synced
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_JS, sleep=10)
        strings = [
            'Successfully transferred', 'main-view-model.js', 'CONSOLE LOG',
            'Backend socket closed', 'Frontend socket closed',
            'Frontend client connected', 'Backend socket created',
            'NativeScript debugger attached'
        ]
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Change XML and wait until app is synced. App doesn't restart from 5.1.0 version
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_XML, sleep=3)
        strings = ['Successfully transferred', 'main-page.xml', 'CONSOLE LOG']
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Change CSS and wait until app is synced. App doesn't restart from 5.1.0 version
        ReplaceHelper.replace(self.app_name, ReplaceHelper.CHANGE_CSS, sleep=3)
        strings = ['Successfully transferred', 'app.css', 'CONSOLE LOG']
        Tns.wait_for_log(log_file=log, string_list=strings)

        # Verify application looks correct
        Device.screen_match(device_name=SIMULATOR_NAME,
                            device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_js_css_xml',
                            tolerance=0.26)

        assert Process.is_running('NativeScript Inspector')
Exemplo n.º 8
0
    def test_002_debug_ios_simulator_debug_brk(self):
        """
        Starts debugger and stop at the first code statement.
        """

        log = Tns.debug_ios(
            attributes={
                '--path': self.app_name,
                '--emulator': '',
                '--debug-brk': '',
                '--inspector': ''
            })
        DebugiOSInspectorSimulatorTests.__verify_debugger_attach(
            log, app_started=False)
        # In this case `app_started` is False because app is not loaded when using '--debug-brk'.
        # '--debug-brk' stops before app loaded.

        # Verify app starts and do not stop on first line of code
        Device.screen_match(device_name=SIMULATOR_NAME,
                            tolerance=3.0,
                            device_id=self.SIMULATOR_ID,
                            expected_image='livesync-hello-world_debug_brk')