Skip to content

Commit ce4bc3f

Browse files
authored
fix: livesync failures (#438)
* update master detail changes * update changes in hello world ng template * fix process name
1 parent 681574e commit ce4bc3f

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

core/utils/docker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def start():
2323
run(cmd=cmd, wait=False)
2424
Log.info('Starting docker!')
2525
elif OSUtils.is_catalina():
26-
if not Process.is_running_by_name('docker'):
26+
if not Process.is_running_by_name('Docker'):
2727
cmd = 'open --background -a Docker'
2828
run(cmd=cmd, wait=False)
2929
Log.info('Starting docker!')

data/changes.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class NGHelloWorld(object):
6666
old_value='Ter Stegen', new_value='Unknown',
6767
old_text='Ter Stegen', new_text='Unknown')
6868
CSS = ChangeSet(file_path=os.path.join('src', 'app.css'),
69-
old_value='}', new_value='}\nListView { background-color: pink;}\n',
69+
old_value='}', new_value='}\nLabel{background-color:pink;}\n',
7070
old_color=Colors.WHITE, new_color=Colors.PINK)
7171
HTML = ChangeSet(file_path=os.path.join('src', 'app', 'item', 'items.component.html'), old_value='"item.name"',
7272
new_value='"item.id"', old_text=None, new_text=None)
@@ -105,20 +105,20 @@ class MasterDetailNG(object):
105105

106106
# This change should make background of items on home page purple
107107
SCSS_NESTED_COMMON = ChangeSet(file_path=os.path.join('src', 'app', 'cars', '_car-list.component.scss'),
108-
old_value='$background-color: background',
109-
new_value='$background-color: purple',
110-
old_color=Colors.WHITE, new_color=Colors.PURPLE_CUSTOM)
108+
old_value='background-alt-10);',
109+
new_value='background-alt-10);\nbackground-color: yellow;',
110+
old_color=Colors.WHITE, new_color=Colors.YELLOW)
111111

112112
# This change should make icons on home page yellow
113113
SCSS_NESTED_ANDROID = ChangeSet(file_path=os.path.join('src', 'app', 'cars', 'car-list.component.android.scss'),
114114
old_value='Android here',
115-
new_value='Android here\n.cars-list__item{ color: yellow; }\n',
116-
old_color=None, new_color=Colors.YELLOW)
115+
new_value='Android here\n.cars-list__item-name{background-color: orange;}\n',
116+
old_color=None, new_color=Colors.ORANGE)
117117

118118
SCSS_NESTED_IOS = ChangeSet(file_path=os.path.join('src', 'app', 'cars', 'car-list.component.ios.scss'),
119119
old_value='iOS here',
120-
new_value='iOS here\n.cars-list__item{ color: yellow; }\n',
121-
old_color=None, new_color=Colors.YELLOW)
120+
new_value='iOS here\n.cars-list__item-name{background-color: orange;}\n',
121+
old_color=None, new_color=Colors.ORANGE)
122122

123123
class JSTabNavigation(object):
124124
JS = ChangeSet(file_path=os.path.join('app', 'home', 'home-items-view-model.js'),

data/const.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ class Colors(object):
1919
PURPLE_CUSTOM = numpy.array([255, 48, 129]) # A bit custom purple (when apply purple on master-detail).
2020
YELLOW = numpy.array([0, 255, 255]) # Yellow (standard CSS color).
2121
YELLOW_ICON = numpy.array([0, 242, 255]) # Yellow of star.png
22+
ORANGE = numpy.array([0, 165, 255]) # Orange (standard CSS color).
2223
GREEN_ICON = numpy.array([0, 128, 0]) # Green of background colour of resources generate images

data/sync/hello_world_ng.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
from core.enums.device_type import DeviceType
99
from core.enums.platform_type import Platform
1010
from core.enums.os_type import OSType
11+
from core.log.log import Log
1112
from core.settings import Settings
13+
from core.utils.wait import Wait
1214
from data.changes import Changes, Sync
1315
from data.const import Colors
1416
from products.nativescript.preview_helpers import Preview
@@ -90,7 +92,9 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a
9092
device=device)
9193
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
9294
not_existing_string_list=not_existing_string_list)
93-
device.wait_for_main_color(color=Changes.NGHelloWorld.CSS.new_color)
95+
assert Wait.until(lambda: device.get_pixels_by_color(color=Changes.NGHelloWorld.CSS.new_color) > 100), \
96+
'CSS on root level not applied!'
97+
Log.info('CSS on root level applied successfully!')
9498

9599
# Revert changes
96100
Sync.revert(app_name=app_name, change_set=Changes.NGHelloWorld.HTML)
@@ -116,7 +120,9 @@ def sync_hello_world_ng(app_name, platform, device, bundle=True, uglify=False, a
116120
device=device)
117121
TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=180,
118122
not_existing_string_list=not_existing_string_list)
119-
device.wait_for_main_color(color=Colors.WHITE)
123+
assert Wait.until(lambda: device.get_pixels_by_color(color=Changes.NGHelloWorld.CSS.new_color) < 100), \
124+
'CSS on root level not applied!'
125+
Log.info('CSS on root level applied successfully!')
120126

121127
# Assert final and initial states are same
122128
initial_state = os.path.join(Settings.TEST_OUT_IMAGES, device.name, 'initial_state.png')

0 commit comments

Comments
 (0)