Skip to content

Commit 71c1ce2

Browse files
committed
Fixes
1 parent 6bc8a52 commit 71c1ce2

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

core/base_class/BaseClass.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __copy_project_folder(cls, artifacts_folder):
3232
shutil.copytree(src, dest)
3333
shutil.rmtree(os.path.join(dest, "platforms"), ignore_errors=True)
3434
shutil.rmtree(os.path.join(dest, "node_modules"), ignore_errors=True)
35-
except Error:
35+
except:
3636
print "Failed to backup {0}".format(cls.app_name)
3737
else:
3838
print "No project " + src
@@ -62,11 +62,10 @@ def IsFailed(cls, res):
6262

6363
@classmethod
6464
def setUpClass(cls, logfile=""):
65-
66-
Process.kill(proc_name='node', proc_cmdline='tns')
67-
Process.kill('Xcode')
68-
Process.kill('Safari')
6965
Process.kill('NativeScript Inspector')
66+
Process.kill('Safari')
67+
Process.kill('Xcode')
68+
Process.kill(proc_name='node', proc_cmdline='tns')
7069

7170
if logfile == "":
7271
logfile = os.path.join(OUTPUT_FOLDER, cls.__name__ + ".txt")
@@ -109,6 +108,6 @@ def tearDown(self):
109108

110109
@classmethod
111110
def tearDownClass(cls):
112-
Process.kill(proc_name='node', proc_cmdline='tns')
113-
Process.kill('Safari')
114111
Process.kill('NativeScript Inspector')
112+
Process.kill('Safari')
113+
Process.kill(proc_name='node', proc_cmdline='tns')

core/device/device.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def screen_match(device_type, device_name, device_id, expected_image, tolerance=
110110
if File.exists(actual_image_path):
111111
File.remove(actual_image_path)
112112
Device.get_screen(device_type=device_type, device_id=device_id, file_path=actual_image_path)
113+
time.sleep(1)
113114

114115
# Compare with expected image
115116
if File.exists(actual_image_path):

core/osutils/screen.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ def save_screen(path):
2020
im.save(path)
2121
except IOError:
2222
print 'Failed to take screen of host OS'
23+
if CURRENT_OS is OSType.OSX:
24+
print 'Retry...'
25+
run('screencapture ' + path, )

core/xcode/xcode.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@
99
class Xcode(object):
1010
@staticmethod
1111
def cleanup_cache():
12-
"""Cleanup Xcode cache and derived data"""
12+
"""
13+
Cleanup Xcode cache and derived data
14+
"""
1315
run("rm -rf ~/Library/Developer/Xcode/DerivedData/*", COMMAND_TIMEOUT)
1416

1517
@staticmethod
1618
def get_version():
17-
"""Get Xcode version"""
19+
"""
20+
Get Xcode version
21+
:return: Version as string.
22+
"""
1823
output = run("xcodebuild -version | grep Xcode")
1924
return output.replace("Xcode ", "")

runNose.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def __extract_archive(file_name, folder):
4242
def disable_crash_report():
4343
if CURRENT_OS == OSType.OSX:
4444
run("defaults write com.apple.CrashReporter DialogType none")
45+
run("defaults write -g ApplePersistence -bool no")
4546

4647
def clean_npm():
4748
"""Clean npm cache"""

tests/simulator/debug_ios_tests.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Tests for `tns debug ios` executed on iOS Simulator.
33
"""
44
import os
5+
import time
56

67
from core.base_class.BaseClass import BaseClass
78
from core.device.device import Device
@@ -42,13 +43,13 @@ def setUp(self):
4243
BaseClass.setUp(self)
4344
Process.kill('Safari')
4445
Process.kill('NativeScript Inspector')
45-
Process.kill('node') # Stop 'node' to kill the livesync after each test method.
46+
Process.kill('node')
4647

4748
def tearDown(self):
4849
BaseClass.tearDown(self)
49-
Process.kill('node') # Stop 'node' to kill the livesync after each test method.
5050
Process.kill('Safari')
5151
Process.kill('NativeScript Inspector')
52+
Process.kill('node')
5253

5354
@classmethod
5455
def tearDownClass(cls):
@@ -91,23 +92,20 @@ def tearDownClass(cls):
9192
def __verify_debugger_start(self, log):
9293
strings = [self.SIMULATOR_ID, "Frontend client connected", "Backend socket created",
9394
"NativeScript debugger attached"]
94-
if Device.get_count(platform=Platform.IOS) > 0:
95-
strings.append("Multiple devices found! Starting debugger on emulator")
9695
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10, clean_log=False)
96+
time.sleep(10)
9797
output = File.read(log)
9898
assert "Frontend socket closed" not in output
9999
assert "Backend socket closed" not in output
100100
assert "NativeScript debugger detached" not in output
101101
assert Process.is_running('NativeScript Inspector')
102102

103103
def __verify_debugger_attach(self, log):
104-
log = Tns.debug_ios(attributes={'--path': self.app_name, '--start': ''})
105104
strings = ["Frontend client connected", "Backend socket created"]
106-
if Device.get_count(platform=Platform.IOS) > 0:
107-
strings.append("Multiple devices found! Starting debugger on emulator")
108105
Tns.wait_for_log(log_file=log, string_list=strings, timeout=120, check_interval=10, clean_log=False)
106+
time.sleep(10)
109107
output = File.read(log)
110-
assert "NativeScript debugger attached" not in output # This is not in output when you attach to running app
108+
assert "NativeScript debugger attached" not in output # This is not in output when you attach to running app
111109
assert "Frontend socket closed" not in output
112110
assert "Backend socket closed" not in output
113111
assert "NativeScript debugger detached" not in output
@@ -117,7 +115,7 @@ def test_001_debug_ios_simulator(self):
117115
"""
118116
Default `tns debug ios` starts debugger (do not stop at the first code statement)
119117
"""
120-
log = Tns.debug_ios(attributes={'--path': self.app_name})
118+
log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': ''})
121119
self.__verify_debugger_start(log)
122120

123121
# Verify app starts and do not stop on first line of code
@@ -129,7 +127,7 @@ def test_002_debug_ios_simulator_debug_brk(self):
129127
Starts debugger and stop at the first code statement.
130128
"""
131129

132-
log = Tns.debug_ios(attributes={'--path': self.app_name, '--debug-brk': ''})
130+
log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': '', '--debug-brk': ''})
133131
self.__verify_debugger_start(log)
134132

135133
# Verify app starts and do not stop on first line of code
@@ -143,11 +141,11 @@ def test_003_debug_ios_simulator_start(self):
143141

144142
# Run the app and ensure it works
145143
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': '', '--justlaunch': ''},
146-
assert_success=False, timeout=30)
144+
assert_success=False, timeout=30)
147145
TnsAsserts.prepared(app_name=self.app_name, platform=Platform.IOS, output=log, prepare=Prepare.SKIP)
148146
Device.screen_match(device_type=DeviceType.SIMULATOR, device_name=SIMULATOR_NAME,
149147
device_id=self.SIMULATOR_ID, expected_image='livesync-hello-world_home')
150148

151149
# Attach debugger
152-
log = Tns.debug_ios(attributes={'--path': self.app_name, '--start': ''})
150+
log = Tns.debug_ios(attributes={'--path': self.app_name, '--emulator': '', '--start': ''})
153151
self.__verify_debugger_attach(log=log)

0 commit comments

Comments
 (0)