Skip to content

Commit 3f2ebb7

Browse files
Merge pull request #435 from NativeScript/release_merge
chore: release merge
2 parents 518d2d3 + 2ab2fd6 commit 3f2ebb7

27 files changed

+100
-90
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package-lock.json
99
nosetests.*
1010
node_modules
11+
Test App
1112
TestApp*
1213
out/*
1314
/data/temp

assets/myCustomTemplate/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
"version": "1.0.0",
44
"dependencies": {
55
"lodash": "3.10.1",
6-
"nativescript-theme-core": "~1.0.2"
6+
"@nativescript/theme": "~2.2.0"
77
},
88
"devDependencies": {
99
"minimist": "1.2.0",
10-
"nativescript-dev-android-snapshot": "^0.*.*",
1110
"nativescript-dev-webpack": "^0.20.0"
1211
},
1312
"description": "dummy",

core/utils/wait.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
class Wait(object):
55
@staticmethod
6-
def until(condition, timeout=60, period=1, *args, **kwargs):
6+
def until(condition, timeout=100, period=1, *args, **kwargs):
77
"""
88
Wait until condition is satisfied.
99
:rtype: bool

core_tests/unit/utils/wait_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_10_wait(self):
2121
@timed(5)
2222
def test_20_get_average_time(self):
2323
ls_time = PerfUtils.get_average_time(lambda: run(cmd='ifconfig'), retry_count=5)
24-
assert 0.003 <= ls_time <= 0.03, "Command not executed in acceptable time. Actual value: " + str(ls_time)
24+
assert 0.005 <= ls_time <= 0.05, "Command not executed in acceptable time. Actual value: " + str(ls_time)
2525

2626
@staticmethod
2727
def seconds_are_odd():

data/changes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class JSHelloWord(object):
3636
CSS = ChangeSet(file_path=os.path.join('app', 'app.css'),
3737
old_value='font-size: 18',
3838
new_value='font-size: 18;\nbackground-color: red;',
39-
old_color=None, new_color=None)
39+
old_color=None, new_color=Colors.RED)
4040
XML = ChangeSet(file_path=os.path.join('app', 'main-page.xml'),
4141
old_value='TAP', new_value='HIT',
4242
old_text='TAP', new_text='HIT')
@@ -56,7 +56,7 @@ class TSHelloWord(object):
5656
CSS = ChangeSet(file_path=os.path.join('app', 'app.css'),
5757
old_value='font-size: 18',
5858
new_value='font-size: 18;\nbackground-color: red;',
59-
old_color=None, new_color=None)
59+
old_color=None, new_color=Colors.RED)
6060
XML = ChangeSet(file_path=os.path.join('app', 'main-page.xml'),
6161
old_value='TAP', new_value='HIT',
6262
old_text='TAP', new_text='HIT')
@@ -191,8 +191,8 @@ class MasterDetailVUE(object):
191191
old_value='Car List', new_value='Master Detail',
192192
old_text='Car List', new_text='Master Detail')
193193
VUE_STYLE = ChangeSet(file_path=os.path.join('app', 'components', 'CarList.vue'),
194-
old_value='background-color: $background-light;',
195-
new_value='background-color: rgb(229, 4, 5);',
194+
old_value='background-color: background-alt-10)',
195+
new_value='background-color: accent)',
196196
old_color=Colors.WHITE, new_color=Colors.RED_DARK)
197197
VUE_DETAIL_PAGE_TEMPLATE = ChangeSet(file_path=os.path.join('app', 'components', 'CarDetails.vue'),
198198
old_value='<Span text="/day" />', new_value='<Span text="/24h" />',

data/sync/blank_vue.py

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,28 @@
1616
from products.nativescript.tns_logs import TnsLogs
1717

1818

19-
def __run_vue(app_name, platform, bundle, hmr):
19+
def __run_vue(app_name, platform, hmr):
2020
# Execute `tns run` and wait until logs are OK
21-
return Tns.run(app_name=app_name, platform=platform, emulator=True, wait=False, bundle=bundle, hmr=hmr)
21+
return Tns.run(app_name=app_name, platform=platform, emulator=True, wait=False, hmr=hmr)
2222

2323

24-
def __preview_vue(app_name, platform, device, bundle, hmr):
24+
def __preview_vue(app_name, platform, device, hmr):
2525
# Execute `tns run` and wait until logs are OK
26-
return Preview.run_app(app_name=app_name, bundle=bundle, hmr=hmr, platform=platform, device=device,
27-
click_open_alert=True)
26+
return Preview.run_app(app_name=app_name, hmr=hmr, platform=platform, device=device, click_open_alert=True)
2827

2928

30-
def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
29+
def __workflow(preview, app_name, platform, device, hmr=True):
3130
# Execute tns command
3231
if preview:
33-
result = __preview_vue(app_name=app_name, platform=platform, device=device, bundle=bundle, hmr=hmr)
32+
result = __preview_vue(app_name=app_name, platform=platform, device=device, hmr=hmr)
3433
else:
35-
result = __run_vue(app_name=app_name, platform=platform, bundle=bundle, hmr=hmr)
34+
result = __run_vue(app_name=app_name, platform=platform, hmr=hmr)
3635

3736
if preview:
3837
Log.info('Skip logs checks.')
3938
else:
40-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.FULL, bundle=bundle,
41-
hmr=hmr, app_type=AppType.VUE)
39+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.UNKNOWN, hmr=hmr,
40+
app_type=AppType.VUE)
4241
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=240)
4342

4443
# Verify it looks properly
@@ -58,8 +57,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
5857
if preview:
5958
Log.info('Skip logs checks.')
6059
else:
61-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
62-
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
60+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
61+
app_type=AppType.VUE, file_name='Home.vue')
6362
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
6463
not_existing_string_list=not_existing_string_list)
6564
device.wait_for_text(text=Changes.BlankVue.VUE_SCRIPT.new_text)
@@ -69,8 +68,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
6968
if preview:
7069
Log.info('Skip logs checks.')
7170
else:
72-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
73-
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
71+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
72+
app_type=AppType.VUE, file_name='Home.vue')
7473
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
7574
not_existing_string_list=not_existing_string_list)
7675
device.wait_for_text(text=Changes.BlankVue.VUE_TEMPLATE.new_text)
@@ -80,8 +79,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
8079
if preview:
8180
Log.info('Skip logs checks.')
8281
else:
83-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
84-
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
82+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
83+
app_type=AppType.VUE, file_name='Home.vue')
8584
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
8685
not_existing_string_list=not_existing_string_list)
8786
style_applied = Wait.until(lambda: device.get_pixels_by_color(Colors.RED) > 100)
@@ -92,8 +91,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
9291
if preview:
9392
Log.info('Skip logs checks.')
9493
else:
95-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
96-
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
94+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
95+
app_type=AppType.VUE, file_name='Home.vue')
9796
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
9897
not_existing_string_list=not_existing_string_list)
9998
device.wait_for_text(text=Changes.BlankVue.VUE_SCRIPT.old_text)
@@ -103,8 +102,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
103102
if preview:
104103
Log.info('Skip logs checks.')
105104
else:
106-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
107-
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
105+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
106+
app_type=AppType.VUE, file_name='Home.vue')
108107
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
109108
not_existing_string_list=not_existing_string_list)
110109
device.wait_for_text(text=Changes.BlankVue.VUE_TEMPLATE.old_text)
@@ -114,9 +113,8 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
114113
if preview:
115114
Log.info('Skip logs checks.')
116115
else:
117-
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL,
118-
bundle=bundle,
119-
hmr=hmr, app_type=AppType.VUE, file_name='Home.vue')
116+
strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.INCREMENTAL, hmr=hmr,
117+
app_type=AppType.VUE, file_name='Home.vue')
120118
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
121119
not_existing_string_list=not_existing_string_list)
122120

@@ -130,9 +128,9 @@ def __workflow(preview, app_name, platform, device, bundle=True, hmr=True):
130128
device.screen_match(expected_image=initial_state, tolerance=1.0, timeout=30)
131129

132130

133-
def sync_blank_vue(app_name, platform, device, bundle=True, hmr=True):
134-
__workflow(preview=False, app_name=app_name, platform=platform, device=device, bundle=bundle, hmr=hmr)
131+
def sync_blank_vue(app_name, platform, device, hmr=True):
132+
__workflow(preview=False, app_name=app_name, platform=platform, device=device, hmr=hmr)
135133

136134

137-
def preview_blank_vue(app_name, platform, device, bundle=True, hmr=True):
138-
__workflow(preview=True, app_name=app_name, platform=platform, device=device, bundle=bundle, hmr=hmr)
135+
def preview_blank_vue(app_name, platform, device, hmr=True):
136+
__workflow(preview=True, app_name=app_name, platform=platform, device=device, hmr=hmr)

data/sync/hello_world_js.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from products.nativescript.preview_helpers import Preview
1414
from products.nativescript.run_type import RunType
1515
from products.nativescript.tns import Tns
16-
from products.nativescript.tns_logs import TnsLogs
1716
from products.nativescript.tns_assert import TnsAssert
17+
from products.nativescript.tns_logs import TnsLogs
1818
from products.nativescript.tns_paths import TnsPaths
1919

2020

@@ -185,6 +185,7 @@ def preview_sync_hello_world_js_ts(app_type, app_name, platform, device, bundle=
185185
else:
186186
raise ValueError('Invalid app_type value.')
187187

188+
not_existing_string_list = None
188189
if hmr and instrumented:
189190
not_existing_string_list = ['QA: Application started']
190191

@@ -197,7 +198,7 @@ def preview_sync_hello_world_js_ts(app_type, app_name, platform, device, bundle=
197198
not_existing_string_list=not_existing_string_list)
198199
else:
199200
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=90)
200-
device.wait_for_color(color=Colors.LIGHT_BLUE, pixel_count=blue_count * 2, delta=25)
201+
device.wait_for_color(color=css_change.new_color, pixel_count=blue_count, delta=25)
201202

202203
# Edit JS file and verify changes are applied
203204
Sync.replace(app_name=app_name, change_set=js_change)

data/sync/hello_world_ng.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a
9090
device=device)
9191
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
9292
not_existing_string_list=not_existing_string_list)
93-
device.wait_for_main_color(color=Colors.PINK)
93+
device.wait_for_main_color(color=Changes.NGHelloWorld.CSS.new_color)
9494

9595
# Revert changes
9696
Sync.revert(app_name=app_name, change_set=Changes.NGHelloWorld.HTML)
@@ -175,7 +175,7 @@ def preview_sync_hello_world_ng(app_name, platform, device, bundle=True, hmr=Tru
175175
hmr=hmr, instrumented=instrumented)
176176
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
177177
not_existing_string_list=not_existing_string_list)
178-
device.wait_for_main_color(color=Colors.DARK)
178+
device.wait_for_main_color(color=Changes.NGHelloWorld.CSS.new_color)
179179
if platform == Platform.IOS:
180180
for number in ["10", "1"]:
181181
device.wait_for_text(text=number)

data/sync/master_detail_vue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def sync_master_detail_vue(app_name, platform, device, bundle=True, hmr=True):
5757
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='CarList.vue')
5858
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
5959
not_existing_string_list=not_existing_string_list)
60-
style_applied = Wait.until(lambda: device.get_pixels_by_color(Colors.RED_DARK) > 200)
60+
style_applied = Wait.until(lambda: device.get_pixels_by_color(Colors.LIGHT_BLUE) > 200)
6161
assert style_applied, 'Failed to sync changes in style.'
6262

6363
# Revert styling in .vue file
@@ -66,7 +66,7 @@ def sync_master_detail_vue(app_name, platform, device, bundle=True, hmr=True):
6666
bundle=bundle, hmr=hmr, app_type=AppType.VUE, file_name='CarList.vue')
6767
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings,
6868
not_existing_string_list=not_existing_string_list)
69-
style_applied = Wait.until(lambda: device.get_pixels_by_color(Colors.WHITE) > 200)
69+
style_applied = Wait.until(lambda: device.get_pixels_by_color(Colors.LIGHT_BLUE) < 200)
7070
assert style_applied, 'Failed to sync changes in style.'
7171

7272
device.wait_for_text(text="Ford KA")

data/sync/master_details_ng.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ def sync_master_detail_ng(app_name, platform, device, bundle=True, hmr=True, ugl
8282

8383
# Revert TS file and verify changes are applied
8484
Sync.revert(app_name=app_name, change_set=Changes.MasterDetailNG.TS)
85-
device.wait_for_text(text=Changes.MasterDetailNG.TS.old_text)
85+
device.wait_for_text(text=Changes.MasterDetailNG.TS.old_text, timeout=120)
8686
device.wait_for_text(text=Changes.MasterDetailNG.HTML.new_text)
8787

8888
# Revert HTML file and verify changes are applied
8989
Sync.revert(app_name=app_name, change_set=Changes.MasterDetailNG.HTML)
90-
device.wait_for_text(text=Changes.MasterDetailNG.HTML.old_text)
90+
device.wait_for_text(text=Changes.MasterDetailNG.HTML.old_text, timeout=120)
9191
device.wait_for_text(text=Changes.MasterDetailNG.TS.old_text)
9292

9393
# Revert common SCSS on root level

products/nativescript/tns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def create(app_name=Settings.AppName.DEFAULT, template=None, path=None, app_id=N
165165
TestContext.TEST_APP_NAME = app_name
166166

167167
# Verify app is created properly
168-
if verify is not False:
168+
if verify:
169169
# Usually we do not pass path on tns create, which actually equals to cwd.
170170
# In such cases pass correct path to TnsAssert.created()
171171
if path is None:

tests/apps/apps_tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ class SampleAppsTests(TnsTest):
2525
('nativescript-sdk-examples-ng', 'NativeScript', 'NativeScript Code Samples'),
2626
('nativescript-sdk-examples-js', 'NativeScript', 'Cookbook'),
2727
('sample-Groceries', 'NativeScript', 'Login'),
28-
# ('nativescript-marketplace-demo', 'NativeScript', 'GET STARTED'),
29-
# Ignored because of https://github.com/NativeScript/nativescript-marketplace-demo/issues/301
28+
('nativescript-marketplace-demo', 'NativeScript', 'GET STARTED'),
3029
]
3130

3231
@classmethod

tests/cli/create/create.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/cli/create/create_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from data.templates import Template
1010
from products.nativescript.app import App
1111
from products.nativescript.tns import Tns
12+
from products.nativescript.tns_assert import TnsAssert
1213

1314

1415
# noinspection PyMethodMayBeStatic
@@ -29,9 +30,7 @@ def tearDownClass(cls):
2930

3031
def test_001_create_app_like_real_user(self):
3132
"""Create app with no any params"""
32-
# webpack - remove template after merge
33-
Tns.create(app_name=Settings.AppName.DEFAULT, app_data=Apps.HELLO_WORLD_JS,
34-
template=Template.HELLO_WORLD_JS.local_package, update=False)
33+
Tns.create(app_name=Settings.AppName.DEFAULT, app_data=Apps.HELLO_WORLD_JS, update=False)
3534

3635
def test_002_create_app_template_js(self):
3736
"""Create app with --template js project"""
@@ -117,7 +116,8 @@ def test_012_create_project_with_named_app(self):
117116
])
118117
def test_200_create_project_with_template(self, template_source):
119118
"""Create app should be possible with --template and npm packages, git repos and aliases"""
120-
Tns.create(app_name=Settings.AppName.DEFAULT, template=template_source, update=False)
119+
result = Tns.create(app_name=Settings.AppName.DEFAULT, template=template_source, update=False, verify=False)
120+
TnsAssert.created(app_name=Settings.AppName.DEFAULT, output=result.output, theme=False)
121121

122122
def test_201_create_project_with_local_directory_template(self):
123123
"""--template should install all packages from package.json"""

tests/cli/debug/test_debug_ng.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import unittest
21
import time
2+
import unittest
33

44
from core.base_test.tns_run_test import TnsRunTest
55
from core.enums.os_type import OSType
@@ -82,7 +82,9 @@ def __debug_elements(self, platform, device):
8282
self.dev_tools.doubleclick_line(text='ListView')
8383
if platform == Platform.ANDROID:
8484
self.dev_tools.doubleclick_line(text='StackLayout')
85-
self.dev_tools.wait_element_by_text(text='Label', timeout=10)
85+
self.dev_tools.wait_element_by_text(text='Label', timeout=10)
86+
if platform == Platform.IOS:
87+
self.dev_tools.wait_element_by_text(text='StackLayout', timeout=10)
8688

8789
def __debug_sources(self, platform, device):
8890
# Start debug and wait until app is deployed

tests/cli/resources/test_resource_generation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_300_tns_resources_generate_icons_apetools(self):
5353
def test_301_tns_resources_generate_icons_old_template_structure(self):
5454
# Create nativescript@4 app
5555
result = Tns.create(app_name=APP_NAME, template='tns-template-hello-world@4.0', verify=False)
56-
TnsAssert.created(app_name=APP_NAME, output=result.output, webpack=False)
56+
TnsAssert.created(app_name=APP_NAME, output=result.output, webpack=False, theme=False)
5757

5858
# Generate icons with nativescript
5959
self.test_001_tns_resources_generate_icons()

tests/cli/resources/test_resource_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ResourcesUpdateTests(TnsTest):
1717
def test_300_tns_resources_update(self):
1818
# Create nativescript@3 app
1919
result = Tns.create(app_name=APP_NAME, template='tns-template-hello-world@3.0', verify=False, update=False)
20-
TnsAssert.created(app_name=APP_NAME, output=result.output, webpack=False)
20+
TnsAssert.created(app_name=APP_NAME, output=result.output, webpack=False, theme=False)
2121

2222
# Update resources
2323
out = Tns.exec_command(command='resources update', path=APP_NAME).output

0 commit comments

Comments
 (0)