From 71e66f389161028b72f0f8c1af3b46d204597bff Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Mon, 4 Mar 2019 23:28:20 +0200 Subject: [PATCH 1/5] fix: qunit tests Workaround https://github.com/NativeScript/nativescript-cli/issues/4390 by manually installing correct `karma-qunit` --- tests/cli/test/test_test.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/cli/test/test_test.py b/tests/cli/test/test_test.py index 23452000..08d150ec 100644 --- a/tests/cli/test/test_test.py +++ b/tests/cli/test/test_test.py @@ -9,21 +9,21 @@ from core.enums.framework_type import FrameworkType from core.enums.os_type import OSType from core.enums.platform_type import Platform -from core.log.log import Log from core.settings import Settings from core.utils.device.device_manager import DeviceManager from core.utils.npm import Npm from data.templates import Template from products.nativescript.tns import Tns from products.nativescript.tns_assert import TnsAssert +from products.nativescript.tns_paths import TnsPaths APP_NAME = Settings.AppName.DEFAULT TEST_DATA = [ - ('jasmine-js-android', FrameworkType.JASMINE, Template.HELLO_WORLD_JS, Platform.ANDROID), - ('jasmine-ng-android', FrameworkType.JASMINE, Template.HELLO_WORLD_NG, Platform.ANDROID), - ('mocha-js-android', FrameworkType.MOCHA, Template.HELLO_WORLD_JS, Platform.ANDROID), - ('mocha-ng-android', FrameworkType.MOCHA, Template.HELLO_WORLD_NG, Platform.ANDROID), + # ('jasmine-js-android', FrameworkType.JASMINE, Template.HELLO_WORLD_JS, Platform.ANDROID), + # ('jasmine-ng-android', FrameworkType.JASMINE, Template.HELLO_WORLD_NG, Platform.ANDROID), + # ('mocha-js-android', FrameworkType.MOCHA, Template.HELLO_WORLD_JS, Platform.ANDROID), + # ('mocha-ng-android', FrameworkType.MOCHA, Template.HELLO_WORLD_NG, Platform.ANDROID), ('qunit-js-android', FrameworkType.QUNIT, Template.HELLO_WORLD_JS, Platform.ANDROID), ] @@ -88,13 +88,13 @@ def test_100(self, title, framework, template, platform): else: Tns.test_init(app_name=APP_NAME, framework=framework) + # Handle Qunit + if framework == FrameworkType.QUNIT: + Npm.uninstall(package='karma-qunit', option='--save-dev', folder=TnsPaths.get_app_path(app_name=APP_NAME)) + Npm.install(package='karma-qunit@2', option='--save-dev', folder=TnsPaths.get_app_path(app_name=APP_NAME)) + # Run Tests - if Settings.HOST_OS != OSType.WINDOWS: - Tns.test(app_name=APP_NAME, platform=Platform.ANDROID, emulator=True, justlaunch=True) - # TODO: Modify hello-world test with some real test (importing modules) and run the test again. - else: - Log.info('Due to unknown issues --justlauch do not exit on Windows when tests are executed on Jenkins!') - # TODO: Fix it! + Tns.test(app_name=APP_NAME, platform=Platform.ANDROID, emulator=True, justlaunch=True) def test_400_invalid_framework_name(self): result = Tns.create(app_name=APP_NAME, template=Template.MIN_JS.local_package, update=False, verify=False) From 5c3955b434ca5039e4cf4f8ee24a5fc62c4f2e1c Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Mon, 4 Mar 2019 23:29:53 +0200 Subject: [PATCH 2/5] fix: enable commented tests --- tests/cli/test/test_test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cli/test/test_test.py b/tests/cli/test/test_test.py index 08d150ec..f089704d 100644 --- a/tests/cli/test/test_test.py +++ b/tests/cli/test/test_test.py @@ -20,10 +20,10 @@ APP_NAME = Settings.AppName.DEFAULT TEST_DATA = [ - # ('jasmine-js-android', FrameworkType.JASMINE, Template.HELLO_WORLD_JS, Platform.ANDROID), - # ('jasmine-ng-android', FrameworkType.JASMINE, Template.HELLO_WORLD_NG, Platform.ANDROID), - # ('mocha-js-android', FrameworkType.MOCHA, Template.HELLO_WORLD_JS, Platform.ANDROID), - # ('mocha-ng-android', FrameworkType.MOCHA, Template.HELLO_WORLD_NG, Platform.ANDROID), + ('jasmine-js-android', FrameworkType.JASMINE, Template.HELLO_WORLD_JS, Platform.ANDROID), + ('jasmine-ng-android', FrameworkType.JASMINE, Template.HELLO_WORLD_NG, Platform.ANDROID), + ('mocha-js-android', FrameworkType.MOCHA, Template.HELLO_WORLD_JS, Platform.ANDROID), + ('mocha-ng-android', FrameworkType.MOCHA, Template.HELLO_WORLD_NG, Platform.ANDROID), ('qunit-js-android', FrameworkType.QUNIT, Template.HELLO_WORLD_JS, Platform.ANDROID), ] From 4e3557ca2cac77a7bc3e7e0cbf04d572bb88bf49 Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Mon, 4 Mar 2019 23:31:33 +0200 Subject: [PATCH 3/5] refactor: migrate to TnsRunTest --- tests/cli/test/test_test.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/cli/test/test_test.py b/tests/cli/test/test_test.py index f089704d..801b6469 100644 --- a/tests/cli/test/test_test.py +++ b/tests/cli/test/test_test.py @@ -5,12 +5,11 @@ from parameterized import parameterized -from core.base_test.tns_test import TnsTest +from core.base_test.tns_run_test import TnsRunTest from core.enums.framework_type import FrameworkType from core.enums.os_type import OSType from core.enums.platform_type import Platform from core.settings import Settings -from core.utils.device.device_manager import DeviceManager from core.utils.npm import Npm from data.templates import Template from products.nativescript.tns import Tns @@ -49,21 +48,7 @@ def get_data(): # noinspection PyMethodMayBeStatic,PyUnusedLocal -class TestsForTnsTest(TnsTest): - - @classmethod - def setUpClass(cls): - TnsTest.setUpClass() - cls.emu = DeviceManager.Emulator.ensure_available(Settings.Emulators.DEFAULT) - if Settings.HOST_OS is OSType.OSX: - cls.sim = DeviceManager.Simulator.ensure_available(Settings.Simulators.DEFAULT) - - def setUp(self): - TnsTest.setUp(self) - - @classmethod - def tearDownClass(cls): - TnsTest.tearDownClass() +class TestsForTnsTest(TnsRunTest): @parameterized.expand(get_data()) def test_100(self, title, framework, template, platform): From 8505d7ad6fd4323b7b4fd14bb523228fd6b8e90c Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Tue, 5 Mar 2019 13:37:42 +0200 Subject: [PATCH 4/5] chore: remove hacks to handle qunit --- tests/cli/test/test_test.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/cli/test/test_test.py b/tests/cli/test/test_test.py index 801b6469..71dad7fb 100644 --- a/tests/cli/test/test_test.py +++ b/tests/cli/test/test_test.py @@ -73,11 +73,6 @@ def test_100(self, title, framework, template, platform): else: Tns.test_init(app_name=APP_NAME, framework=framework) - # Handle Qunit - if framework == FrameworkType.QUNIT: - Npm.uninstall(package='karma-qunit', option='--save-dev', folder=TnsPaths.get_app_path(app_name=APP_NAME)) - Npm.install(package='karma-qunit@2', option='--save-dev', folder=TnsPaths.get_app_path(app_name=APP_NAME)) - # Run Tests Tns.test(app_name=APP_NAME, platform=Platform.ANDROID, emulator=True, justlaunch=True) From 213efbca91a1616906ba5cb573751065a5e09e3d Mon Sep 17 00:00:00 2001 From: Dimitar Topuzov Date: Tue, 5 Mar 2019 13:46:10 +0200 Subject: [PATCH 5/5] fix: unused imports --- tests/cli/test/test_test.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cli/test/test_test.py b/tests/cli/test/test_test.py index 71dad7fb..83dde669 100644 --- a/tests/cli/test/test_test.py +++ b/tests/cli/test/test_test.py @@ -14,7 +14,6 @@ from data.templates import Template from products.nativescript.tns import Tns from products.nativescript.tns_assert import TnsAssert -from products.nativescript.tns_paths import TnsPaths APP_NAME = Settings.AppName.DEFAULT