Skip to content

chore: merge release in master #425

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 2 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/settings/Settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Packages(object):
SASS = resolve_package(name='nativescript-dev-sass', variable='nativescript_dev_sass')

# Templates branch
TEMPLATES_BRANCH = os.environ.get('templates_branch', 'release')
TEMPLATES_BRANCH = os.environ.get('templates_branch', 'master')


# noinspection SpellCheckingInspection
Expand Down
66 changes: 35 additions & 31 deletions data/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from data.const import Colors


# noinspection PyShadowingBuiltins
class ChangeSet(object):
def __init__(self, file_path, old_value, new_value, old_text=None, new_text=None, old_color=None, new_color=None):
self.file_path = file_path
Expand Down Expand Up @@ -35,7 +34,8 @@ class JSHelloWord(object):
old_value='taps left', new_value='clicks left',
old_text='taps left', new_text='clicks left')
CSS = ChangeSet(file_path=os.path.join('app', 'app.css'),
old_value='font-size: 18', new_value='font-size: 50',
old_value='font-size: 18',
new_value='font-size: 18;\nbackground-color: red;',
old_color=None, new_color=None)
XML = ChangeSet(file_path=os.path.join('app', 'main-page.xml'),
old_value='TAP', new_value='HIT',
Expand All @@ -54,7 +54,8 @@ class TSHelloWord(object):
old_value='taps left', new_value='clicks left',
old_text='taps left', new_text='clicks left')
CSS = ChangeSet(file_path=os.path.join('app', 'app.css'),
old_value='font-size: 18', new_value='font-size: 50',
old_value='font-size: 18',
new_value='font-size: 18;\nbackground-color: red;',
old_color=None, new_color=None)
XML = ChangeSet(file_path=os.path.join('app', 'main-page.xml'),
old_value='TAP', new_value='HIT',
Expand All @@ -65,11 +66,10 @@ class NGHelloWorld(object):
old_value='Ter Stegen', new_value='Unknown',
old_text='Ter Stegen', new_text='Unknown')
CSS = ChangeSet(file_path=os.path.join('src', 'app.css'),
old_value='light', new_value='dark',
old_color=Colors.WHITE, new_color=Colors.DARK)
HTML = ChangeSet(file_path=os.path.join('src', 'app', 'item', 'items.component.html'),
old_value='"item.name"', new_value='"item.id"',
old_text=None, new_text=None)
old_value='}', new_value='}\nListView { background-color: pink;}\n',
old_color=Colors.WHITE, new_color=Colors.PINK)
HTML = ChangeSet(file_path=os.path.join('src', 'app', 'item', 'items.component.html'), old_value='"item.name"',
new_value='"item.id"', old_text=None, new_text=None)
XML_ACTION_BAR = ChangeSet(file_path=os.path.join('src', 'app', 'item', 'items.component.html'),
old_value='My App', new_value='TestApp',
old_text='My App', new_text='TestApp')
Expand All @@ -89,33 +89,35 @@ class MasterDetailNG(object):

# This change should make title of cars pink
SCSS_ROOT_COMMON = ChangeSet(file_path=os.path.join('src', '_app-common.scss'),
old_value='$accent-dark;', new_value='pink;',
old_value='font-weight: 900;',
new_value='font-weight: 900;\nbackground-color: pink;\n',
old_color=Colors.ACCENT_DARK, new_color=Colors.PINK)

# This change should add some red between list view items on home page
SCSS_ROOT_ANDROID = ChangeSet(file_path=os.path.join('src', 'app.android.scss'),
old_value='Android here',
new_value='Android here\n.page { background-color: red;}\n',
old_color=Colors.WHITE, new_color=Colors.RED_DARK)
new_value='Android here\n.m-r-20{ background-color: red; }\n',
old_color=Colors.WHITE, new_color=Colors.RED)
SCSS_ROOT_IOS = ChangeSet(file_path=os.path.join('src', 'app.ios.scss'),
old_value='iOS here',
new_value='iOS here\n.page { padding: 30; background-color: red; }\n',
new_value='iOS here\n.m-r-20{ background-color: red; }\n',
old_color=Colors.WHITE, new_color=Colors.RED)

# This change should make background of items on home page purple
SCSS_NESTED_COMMON = ChangeSet(file_path=os.path.join('src', 'app', 'cars', '_car-list.component.scss'),
old_value='$background-light;', new_value='purple;',
old_color=Colors.WHITE, new_color=Colors.PURPLE)
old_value='$background-color: background',
new_value='$background-color: purple',
old_color=Colors.WHITE, new_color=Colors.PURPLE_CUSTOM)

# This change should make icons on home page yellow
SCSS_NESTED_ANDROID = ChangeSet(file_path=os.path.join('src', 'app', 'cars', 'car-list.component.android.scss'),
old_value='Android here',
new_value='Android here\n.list-group{.list-group-item{.fa{color:yellow;}}}\n',
new_value='Android here\n.cars-list__item{ color: yellow; }\n',
old_color=None, new_color=Colors.YELLOW)

SCSS_NESTED_IOS = ChangeSet(file_path=os.path.join('src', 'app', 'cars', 'car-list.component.ios.scss'),
old_value='iOS here',
new_value='iOS here\n.list-group{.list-group-item{.fa{color:yellow;}}}\n',
new_value='iOS here\n.cars-list__item{ color: yellow; }\n',
old_color=None, new_color=Colors.YELLOW)

class JSTabNavigation(object):
Expand All @@ -126,16 +128,19 @@ class JSTabNavigation(object):
old_value='Home', new_value='Test',
old_text='Home', new_text='Test')

# This change should make title of home red
SCSS_VARIABLES = ChangeSet(file_path=os.path.join('app', '_app-variables.scss'),
old_value='#D7D7D7', new_value='red',
old_color='#D7D7D7', new_color=Colors.RED)
# This change should make background of home red
SCSS_VARIABLES = ChangeSet(file_path=os.path.join('app', '_app-common.scss'),
old_value='Font icon class',
new_value='Font icon class\n.page__content{ background-color: red; }\n',
old_color=None, new_color=Colors.RED)
SCSS_ROOT_ANDROID = ChangeSet(file_path=os.path.join('app', 'app.android.scss'),
old_value='$blue-dark;', new_value='pink;',
old_color=Colors.ACCENT_DARK, new_color=Colors.PINK)
old_value='Android here',
new_value='Android here\n.navigation__item{ background-color: yellow; }\n',
old_color=None, new_color=Colors.YELLOW)
SCSS_ROOT_IOS = ChangeSet(file_path=os.path.join('app', 'app.ios.scss'),
old_value='$item-active-color;', new_value='pink;',
old_color=Colors.ACCENT_DARK, new_color=Colors.PINK)
old_value='iOS here',
new_value='iOS here\n.navigation__item{ background-color: yellow; }\n',
old_color=None, new_color=Colors.YELLOW)

class TSTabNavigation(object):
TS = ChangeSet(file_path=os.path.join('src', 'app', 'home', 'home-items-view-model.ts'),
Expand Down Expand Up @@ -194,15 +199,14 @@ class MasterDetailVUE(object):
old_text='/day', new_text='/24h')

class DateTimePicker(object):
COMMON_TS = ChangeSet(file_path=os.path.join(
Settings.TEST_SUT_HOME, 'nativescript-datetimepicker', 'src', 'ui', 'date-picker-field.common.ts'),
old_value='name: "date",', new_value='name: "date", defaultValue: new Date(),')
ANDROID_TS = ChangeSet(file_path=os.path.join(
Settings.TEST_SUT_HOME, 'nativescript-datetimepicker', 'src', 'datetimepicker.android.ts'),
DATETIME_PICKER_PATH = os.path.join(Settings.TEST_SUT_HOME, 'nativescript-datetimepicker', 'src')
COMMON_TS = ChangeSet(file_path=os.path.join(DATETIME_PICKER_PATH, 'ui', 'date-picker-field.common.ts'),
old_value='name: "date",',
new_value='name: "date", defaultValue: new Date(),')
ANDROID_TS = ChangeSet(file_path=os.path.join(DATETIME_PICKER_PATH, 'datetimepicker.android.ts'),
old_value='datePicker.init(date.getFullYear(), date.getMonth(), date.getDate(), null);',
new_value='datePicker.init(2010, date.getMonth(), date.getDate(), null);')
IOS_TS = ChangeSet(file_path=os.path.join(
Settings.TEST_SUT_HOME, 'nativescript-datetimepicker', 'src', 'datetimepicker.ios.ts'),
IOS_TS = ChangeSet(file_path=os.path.join(DATETIME_PICKER_PATH, 'datetimepicker.ios.ts'),
old_value='pickerView.date = date;',
new_value='date.setFullYear(2010); pickerView.date = date;')

Expand Down
1 change: 1 addition & 0 deletions data/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Colors(object):
RED = numpy.array([0, 0, 255]) # Red (standard CSS color).
RED_DARK = numpy.array([5, 4, 229]) # A bit custom red (happens when apply red on master-detail template).
PURPLE = numpy.array([128, 0, 128]) # Purple (standard CSS color).
PURPLE_CUSTOM = numpy.array([255, 48, 129]) # A bit custom purple (when apply purple on master-detail).
YELLOW = numpy.array([0, 255, 255]) # Yellow (standard CSS color).
YELLOW_ICON = numpy.array([0, 242, 255]) # Yellow of star.png
GREEN_ICON = numpy.array([0, 128, 0]) # Green of background colour of resources generate images
2 changes: 1 addition & 1 deletion data/sync/hello_world_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __sync_hello_world_js_ts(app_type, app_name, platform, device, bundle=True,
# Edit CSS file and verify changes are applied
blue_count = device.get_pixels_by_color(color=Colors.LIGHT_BLUE)
Sync.replace(app_name=app_name, change_set=css_change)
device.wait_for_color(color=Colors.LIGHT_BLUE, pixel_count=blue_count * 2, delta=25)
device.wait_for_color(color=Colors.RED, pixel_count=blue_count)
device.wait_for_text(text=xml_change.old_text)
device.wait_for_text(text=js_change.old_text)
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, bundle=bundle,
Expand Down
5 changes: 2 additions & 3 deletions data/sync/hello_world_ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a
not_existing_string_list=not_existing_string_list)

Sync.replace(app_name=app_name, change_set=Changes.NGHelloWorld.CSS)
device.wait_for_main_color(color=Colors.DARK)
if platform == Platform.IOS:
for number in ["10", "1"]:
device.wait_for_text(text=number)
Expand All @@ -91,6 +90,7 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a
device=device)
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
not_existing_string_list=not_existing_string_list)
device.wait_for_main_color(color=Colors.PINK)

# Revert changes
Sync.revert(app_name=app_name, change_set=Changes.NGHelloWorld.HTML)
Expand All @@ -103,21 +103,20 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a

Sync.revert(app_name=app_name, change_set=Changes.NGHelloWorld.TS)
device.wait_for_text(text=Changes.NGHelloWorld.TS.old_text)
device.wait_for_main_color(color=Colors.DARK)
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, bundle=bundle,
file_name='item.service.ts', hmr=hmr, instrumented=instrumented, app_type=AppType.NG,
device=device)
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
not_existing_string_list=not_existing_string_list)

Sync.revert(app_name=app_name, change_set=Changes.NGHelloWorld.CSS)
device.wait_for_main_color(color=Colors.WHITE)
device.wait_for_text(text=Changes.NGHelloWorld.TS.old_text)
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, bundle=bundle,
file_name='app.css', hmr=hmr, instrumented=instrumented, app_type=AppType.NG,
device=device)
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
not_existing_string_list=not_existing_string_list)
device.wait_for_main_color(color=Colors.WHITE)

# Assert final and initial states are same
initial_state = os.path.join(Settings.TEST_OUT_IMAGES, device.name, 'initial_state.png')
Expand Down
5 changes: 4 additions & 1 deletion products/nativescript/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@ def install_dev_dependency(app_name, dependency, version='latest'):
Npm.install(package='{0}@{1}'.format(dependency, version), option='--save-dev --save-exact', folder=app_path)

@staticmethod
def update(app_name, modules=True, angular=True, typescript=False, web_pack=True, vue=True):
def update(app_name, modules=True, angular=True, typescript=False, web_pack=True, vue=True, theme=True):
app_path = os.path.join(Settings.TEST_RUN_HOME, app_name)
modules_path = os.path.join(app_path, 'node_modules')
if modules and App.is_dependency(app_name=app_name, dependency='tns-core-modules'):
Npm.uninstall(package='tns-core-modules', option='--save', folder=app_path)
Npm.install(package=Settings.Packages.MODULES, option='--save --save-exact', folder=app_path)
if theme and App.is_dependency(app_name=app_name, dependency='@nativescript/theme'):
Npm.uninstall(package='@nativescript/theme', option='--save', folder=app_path)
Npm.install(package='@nativescript/theme@next', option='--save --save-exact', folder=app_path)
if angular and App.is_dependency(app_name=app_name, dependency='nativescript-angular'):
Npm.uninstall(package='nativescript-angular', option='--save', folder=app_path)
Npm.install(package=Settings.Packages.ANGULAR, option='--save --save-exact', folder=app_path)
Expand Down
2 changes: 1 addition & 1 deletion products/nativescript/tns_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME, w

# Verify {N} core theme is installed
if theme:
assert Folder.exists(os.path.join(node_path, 'nativescript-theme-core')), '{N} theme do not exists.'
assert Folder.exists(os.path.join(node_path, '@nativescript', 'theme')), '{N} theme do not exists.'

# Verify webpack is installed
before_watch_hooks = os.path.join(app_path, 'hooks', 'before-watch')
Expand Down