Repository navigation
Mivanova/nsconfig projects #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import os | ||
|
|
||
| from core.base_class.BaseClass import BaseClass | ||
| from core.device.device import Device | ||
| from core.chrome.chrome import Chrome | ||
| from core.osutils.file import File | ||
| from core.settings.settings import ANDROID_PACKAGE, IOS_PACKAGE | ||
| from core.tns.tns import Tns | ||
| from core.tns.tns_platform_type import Platform | ||
| from core.osutils.command import run | ||
|
|
||
| class DebugBothPlatformsTests(BaseClass): | ||
| ANDROID_DEVICES = Device.get_ids(platform=Platform.ANDROID, include_emulators=True) | ||
| IOS_DEVICES = Device.get_ids(platform=Platform.IOS) | ||
| DEVICE_ID = Device.get_id(platform=Platform.ANDROID) | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| BaseClass.setUpClass(cls.__name__) | ||
| Device.ensure_available(platform=Platform.ANDROID) | ||
| Device.ensure_available(platform=Platform.IOS) | ||
| Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID) | ||
| Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.IOS) | ||
|
|
||
| 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}) | ||
| Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_PACKAGE}) | ||
|
|
||
| def setUp(self): | ||
| BaseClass.setUp(self) | ||
| Tns.kill() | ||
|
|
||
| def tearDown(self): | ||
| Tns.kill() | ||
| BaseClass.tearDown(self) | ||
|
|
||
| @classmethod | ||
| def tearDownClass(cls): | ||
| BaseClass.tearDownClass() | ||
|
|
||
| def __verify_debugger_start(self, log): | ||
| strings = ['NativeScript Debugger started', 'To start debugging, open the following URL in Chrome', | ||
| 'chrome-devtools', 'localhost:4000'] | ||
| Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False) | ||
| output = File.read(file_path=log, print_content=True) | ||
| assert "closed" not in output | ||
| assert "detached" not in output | ||
| assert "did not start in time" not in output | ||
|
|
||
| def __verify_debugger_attach(self, log): | ||
| strings = ['To start debugging', 'Chrome', 'chrome-devtools', 'localhost:4000'] | ||
| Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False) | ||
| output = File.read(file_path=log, print_content=True) | ||
| assert "closed" not in output | ||
| assert "detached" not in output | ||
| assert "did not start in time" not in output | ||
| assert "NativeScript Debugger started" not in output | ||
|
|
||
| def test_001_tns_run_android(self): | ||
| log = Tns.debug_android(attributes={'--path': self.app_name}) | ||
| strings = ['Successfully installed on device with identifier'] | ||
| for android_device_id in self.ANDROID_DEVICES: | ||
| strings.append(android_device_id) | ||
| Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10, clean_log=False) | ||
|
|
||
| # Verify app is deployed and running on all available android devices | ||
| for device_id in self.ANDROID_DEVICES: | ||
| Device.wait_until_app_is_running(app_id=Tns.get_app_id(self.app_name), device_id=device_id, timeout=30) | ||
|
|
||
| log = Tns.debug_android(attributes={'--path': self.app_name}) | ||
| self.__verify_debugger_start(log) | ||
|
|
||
| # Get Chrome URL and open it | ||
| url = run(command="grep chrome-devtools " + log) | ||
| Chrome.start(url) | ||
|
|
||
| def test_002_tns_run_ios(self): | ||
| log = Tns.debug_ios(attributes={'--path': self.app_name}) | ||
| strings = ['Successfully installed on device with identifier'] | ||
| for ios_device_id in self.IOS_DEVICES: | ||
| strings.append(ios_device_id) | ||
| Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10, clean_log=False) | ||
|
|
||
| # Verify app is deployed and running on all available android devices | ||
| for device_id in self.IOS_DEVICES: | ||
| Device.wait_until_app_is_running(app_id=Tns.get_app_id(self.app_name), device_id=device_id, timeout=30) | ||
|
|
||
| log = Tns.debug_ios(attributes={'--path': self.app_name}) | ||
| self.__verify_debugger_start(log) | ||
|
|
||
| # Get Chrome URL and open it | ||
| url = run(command="grep chrome-devtools " + log) | ||
| Chrome.start(url) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,10 @@ | ||
| import os | ||
| import unittest | ||
|
|
||
| from core.npm.npm import Npm | ||
| from core.osutils.file import File | ||
| from core.osutils.folder import Folder | ||
| from core.settings.settings import TEST_RUN_HOME | ||
| from core.settings.settings import TEST_RUN_HOME, TYPESCRIPT_PACKAGE, WEBPACK_PACKAGE, SASS_PACKAGE | ||
| from core.tns.tns import Tns | ||
|
|
||
|
|
||
|
|
@@ -359,6 +360,19 @@ def createAppsNG(cls): | |
| # Initial create of all projects | ||
| app_name_change_app_location_ng = "ChangeAppLocationNG" | ||
| Tns.create_app_ng(app_name=app_name_change_app_location_ng) | ||
| Tns.update_angular(app_name_change_app_location_ng) | ||
| Npm.uninstall(package="nativescript-dev-typescript", option='--save-dev', | ||
| folder=app_name_change_app_location_ng) | ||
| Npm.install(package=TYPESCRIPT_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ng) | ||
| Npm.uninstall(package="nativescript-dev-webpack", option='--save-dev', folder=app_name_change_app_location_ng) | ||
|
|
||
| # Old webpack adds old webpack config. Cleanup to make sure we get the new config. | ||
| File.remove(os.path.join(TEST_RUN_HOME, app_name_change_app_location_ng, 'webpack.config.js')) | ||
| Tns.install_npm(package=WEBPACK_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ng) | ||
| Npm.uninstall(package="nativescript-dev-sass", option='--save-dev', folder=app_name_change_app_location_ng) | ||
| Npm.install(package=SASS_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ng) | ||
| File.remove(TEST_RUN_HOME + "/" + app_name_change_app_location_ng + "/" | ||
| + "node_modules/.bin/babylon") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP8 warning for visual indent, can be fixed by auto formatting shortcuts. |
||
|
|
||
| # Create the other projects using the initial setup but in different folder | ||
| app_name_change_app_location_and_name_ng = "ChangeAppLocationAndNameNG" | ||
|
|
@@ -513,6 +527,19 @@ def createAppsLiveSyncNG(cls): | |
| # Initial create of all projects | ||
| app_name_change_app_location_ls_ng = "ChangeAppLocationLSNG" | ||
| Tns.create_app_ng(app_name=app_name_change_app_location_ls_ng) | ||
| Tns.update_angular(app_name_change_app_location_ls_ng) | ||
| Npm.uninstall(package="nativescript-dev-typescript", option='--save-dev', | ||
| folder=app_name_change_app_location_ls_ng) | ||
| Npm.install(package=TYPESCRIPT_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ls_ng) | ||
| Npm.uninstall(package="nativescript-dev-webpack", option='--save-dev', folder=app_name_change_app_location_ls_ng) | ||
|
|
||
| # Old webpack adds old webpack config. Cleanup to make sure we get the new config. | ||
| File.remove(os.path.join(TEST_RUN_HOME, app_name_change_app_location_ls_ng, 'webpack.config.js')) | ||
| Tns.install_npm(package=WEBPACK_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ls_ng) | ||
| Npm.uninstall(package="nativescript-dev-sass", option='--save-dev', folder=app_name_change_app_location_ls_ng) | ||
| Npm.install(package=SASS_PACKAGE, option='--save-dev', folder=app_name_change_app_location_ls_ng) | ||
| File.remove(TEST_RUN_HOME + "/" + app_name_change_app_location_ls_ng + "/" | ||
| + "node_modules/.bin/babylon") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP8 warning for visual indent, can be fixed by auto formatting shortcuts. |
||
|
|
||
| # Copy the app folder (app is modified in order to get some console logs on loaded) | ||
| source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'app') | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP8 require 2 blank lines between imports and
class DebugBothPlatformsTests(BaseClass):