Skip to content

Commit dcc2728

Browse files
Vasil ChimevVasil Chimev
authored andcommitted
Fix tests.
1 parent e83a8ce commit dcc2728

File tree

6 files changed

+16
-20
lines changed

6 files changed

+16
-20
lines changed

helpers/adb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def StopApplication(appId, deviceId):
1818

1919
def IsRunning(appId, deviceId):
2020

21-
output = runAUT("adb -s " + deviceId + " shell ps | " + appId)
21+
output = runAUT("adb -s " + deviceId + " shell ps | grep " + appId)
2222
if ("org.nativescript.TNSApp" in output):
2323
return True
2424
else:

helpers/device.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def GetPhysicalDeviceId(platform):
7777
for line in lines:
7878
lline = line.lower()
7979
if (platform in lline) and (not ("emulator" in lline)):
80-
deviceId = lline.split((platform),1)[1].replace(" ", "")
80+
deviceId = lline.split((platform),1)[1].replace(" ", "") # deviceId = @030b206908e6c3c5@
81+
deviceId = deviceId[3:-3] # devideId = 030b206908e6c3c5
8182
print deviceId
8283
return deviceId
8384

tests/device_linux.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,19 @@ def setUp(self):
2525

2626
def tearDown(self):
2727
pass
28-
29-
def test_001_Device_ListApplications_And_Run_Android(self):
28+
29+
def test_001_Device_ListApplications_And_Run_Android(self):
3030
deviceId = GetPhysicalDeviceId(platform="android");
31-
if (deviceId is not None):
31+
if (deviceId is not None):
3232

3333
# Deploy TNS_App on device
3434
CreateProjectAndAddPlatform(projName="TNS_App", platform="android", frameworkPath=androidRuntimePath)
3535
output = runAUT(tnsPath + " deploy android --path TNS_App")
3636
assert ("Project successfully prepared" in output)
3737
assert ("Project successfully built" in output)
3838
assert ("Successfully deployed on device with identifier" in output)
39-
assert (deviceId in output)
39+
runAUT("echo " + deviceId)
40+
assert (deviceId in output)
4041
sleep(10)
4142

4243
# Verify list-applications command list org.nativescript.TNSApp
@@ -60,7 +61,7 @@ def test_001_Device_ListApplications_And_Run_Android(self):
6061
else:
6162
print "Prerequisites not met. This test requires at least one real android device."
6263
assert (False)
63-
64+
6465
def test_002_Device_Log_Android(self):
6566
if (GetDeviceCount(platform="android") > 1):
6667
output = runAUT(tnsPath + " device log")

tests/platform_linux.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,11 @@ def test_200_Platform_List_InsideEmptyProject(self):
112112
def test_201_Platform_Add_Android_InsideProject(self):
113113
CreateProject(projName="TNS_App")
114114
currentDir = os.getcwd()
115-
os.chdir(os.path.join(currentDir, "TNS_App"))
115+
os.chdir(os.path.join(currentDir, "TNS_App"))
116116
output = runAUT(os.path.join("..", tnsPath) + " platform add android")
117117
os.chdir(currentDir);
118118

119119
assert("Copying template files..." in output)
120-
121-
# Not valid for 1.3.0+
122-
# assert("Updated project.properties" in output)
123-
# assert("Updated local.properties" in output)
124-
125120
assert("Project successfully created" in output)
126121

127122
if ('TESTRUN' in os.environ) and (not "SMOKE" in os.environ['TESTRUN']) and ("2" in os.environ['ANDROID_HOME']):

tests/plugins_linux.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ def test_401_PluginAdd_InvalidPlugin(self):
119119
output = runAUT(tnsPath + " plugin add wd --path TNS_App")
120120
assert ("wd is not a valid NativeScript plugin" in output)
121121
assert ("Verify that the plugin package.json file contains a nativescript key and try again" in output)
122-
122+
123123
def test_403_PluginAdd_PluginNotSupportedOnSpecificPlatform(self):
124-
CreateProjectAndAddPlatform(projName="TNS_App", platform="android", frameworkPath=androidRuntimePath)
124+
CreateProjectAndAddPlatform(projName="TNS_App", platform="android", frameworkPath=androidRuntimePath)
125125
output = runAUT(tnsPath + " plugin add [email protected] --path TNS_App");
126126
assert ("tns-plugin is not supported for android" in output)
127127
assert ("Successfully installed plugin tns-plugin" in output)

tests/plugins_osx.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,11 @@ def test_401_PluginAdd_InvalidPlugin(self):
168168
output = runAUT(tnsPath + " plugin add wd --path TNS_App")
169169
assert ("wd is not a valid NativeScript plugin" in output)
170170
assert ("Verify that the plugin package.json file contains a nativescript key and try again" in output)
171-
171+
172172
def test_403_PluginAdd_PluginNotSupportedOnSpecificPlatform(self):
173-
CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimePath)
173+
CreateProjectAndAddPlatform(projName="TNS_App", platform="ios", frameworkPath=iosRuntimePath)
174174
PlatformAdd(platform="android", frameworkPath=androidRuntimePath, path="TNS_App")
175-
175+
176176
output = runAUT(tnsPath + " plugin add [email protected] --path TNS_App")
177-
assert ("Successfully prepared plugin tns-plugin for ios" in output)
178177
assert ("tns-plugin is not supported for android" in output)
179-
assert ("Successfully installed plugin tns-plugin" in output)
178+
assert ("Successfully installed plugin tns-plugin" in output)

0 commit comments

Comments
 (0)