From 43f728cef7fc9a594a16131fe83dd8fb729d6174 Mon Sep 17 00:00:00 2001 From: Natalia-Hristova Date: Mon, 23 Apr 2018 13:10:42 +0300 Subject: [PATCH 1/3] fix: test for Google Analytics message - cli#3536 --- tests/build/common/logtrace_tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/build/common/logtrace_tests.py b/tests/build/common/logtrace_tests.py index ce03666f..1fada017 100644 --- a/tests/build/common/logtrace_tests.py +++ b/tests/build/common/logtrace_tests.py @@ -36,6 +36,10 @@ def test_101_create_project_log_trace(self): def test_102_platform_add_log_trace(self): Tns.create_app(self.app_name, update_modules=False) + + # Disable tracking in Google Analytics https://github.com/NativeScript/nativescript-cli/issues/3536 + Tns.run_tns_command("usage-reporting disable") + 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 @@ -43,3 +47,6 @@ def test_102_platform_add_log_trace(self): assert "Installed Android Targets" in output assert "Using Android SDK" in output assert "Project successfully created" in output + + # Check there is no any messages for tracking in Google Analytics + assert "Will send the following information to Google Analytics" not in output From 51ee5185c23fddcb4a964869c232139bc29e8061 Mon Sep 17 00:00:00 2001 From: Natalia-Hristova Date: Mon, 21 May 2018 18:49:17 +0300 Subject: [PATCH 2/3] fix: Move tests. --- tests/build/common/logtrace_tests.py | 7 ------- tests/build/common/usage_reporting_tests.py | 8 ++++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/build/common/logtrace_tests.py b/tests/build/common/logtrace_tests.py index 1fada017..ce03666f 100644 --- a/tests/build/common/logtrace_tests.py +++ b/tests/build/common/logtrace_tests.py @@ -36,10 +36,6 @@ def test_101_create_project_log_trace(self): def test_102_platform_add_log_trace(self): Tns.create_app(self.app_name, update_modules=False) - - # Disable tracking in Google Analytics https://github.com/NativeScript/nativescript-cli/issues/3536 - Tns.run_tns_command("usage-reporting disable") - 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 @@ -47,6 +43,3 @@ def test_102_platform_add_log_trace(self): assert "Installed Android Targets" in output assert "Using Android SDK" in output assert "Project successfully created" in output - - # Check there is no any messages for tracking in Google Analytics - assert "Will send the following information to Google Analytics" not in output diff --git a/tests/build/common/usage_reporting_tests.py b/tests/build/common/usage_reporting_tests.py index d2152884..8024b8ef 100644 --- a/tests/build/common/usage_reporting_tests.py +++ b/tests/build/common/usage_reporting_tests.py @@ -21,6 +21,10 @@ def test_001_usage_reporting_enable(self): output = Tns.run_tns_command("usage-reporting enable") assert enabled.format(usage_reporting, "now ") in output + # 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 @@ -28,6 +32,10 @@ def test_002_usage_reporting_disable(self): output = Tns.run_tns_command("usage-reporting disable") assert disabled.format(usage_reporting, "now ") in output + # Check there is no any 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" not in output + output = Tns.run_tns_command("usage-reporting status") assert disabled.format(usage_reporting, "") in output From 0e0524934dbfc9d2b387f56558c67264985dc6b4 Mon Sep 17 00:00:00 2001 From: Natalia-Hristova Date: Tue, 22 May 2018 16:31:41 +0300 Subject: [PATCH 3/3] add test for local paths in Analytics --- tests/build/common/usage_reporting_tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/build/common/usage_reporting_tests.py b/tests/build/common/usage_reporting_tests.py index 8024b8ef..8ce88d7e 100644 --- a/tests/build/common/usage_reporting_tests.py +++ b/tests/build/common/usage_reporting_tests.py @@ -1,6 +1,7 @@ """ Test for usage-reporting command """ +import os from core.base_class.BaseClass import BaseClass from core.settings.strings import * @@ -28,6 +29,14 @@ def test_001_usage_reporting_enable(self): 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_002_usage_reporting_disable(self): output = Tns.run_tns_command("usage-reporting disable") assert disabled.format(usage_reporting, "now ") in output