Skip to content

Commit c2dc9ed

Browse files
author
Natalia-Hristova
committed
fix: update tests - output message assertions
1 parent e2aeca0 commit c2dc9ed

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

core/tns/tns.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def platform_clean(platform=Platform.NONE, attributes={}, assert_success=True, l
343343
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID))
344344
if platform is Platform.IOS:
345345
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_IOS))
346-
assert "Project successfully created" in output
346+
assert "Platform {0} successfully added".format(platform_string) in output
347347
return output
348348

349349
@staticmethod
@@ -664,7 +664,7 @@ def init(attributes={}, assert_success=True, tns_path=None):
664664
def install(attributes={}, assert_success=True, tns_path=None):
665665
output = Tns.run_tns_command("install", attributes=attributes, tns_path=tns_path)
666666
if assert_success:
667-
assert "Project successfully created" in output
667+
assert "Platform android successfully added" in output or "Platform ios successfully added" in output
668668
return output
669669

670670
@staticmethod

core/tns/tns_verifications.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def platform_added(app_name, platform=Platform.NONE, output=None):
153153
if platform is Platform.ANDROID:
154154
assert 'Platform android successfully added' in output
155155
if platform is Platform.IOS:
156-
assert 'Platform ios successfully added.' in output
156+
assert 'Platform ios successfully added' in output
157157
assert 'Project successfully created.' not in output
158158

159159
# This is to handle test for app with space.
@@ -284,12 +284,11 @@ def _full_prepare():
284284
assert 'Project successfully created' not in output
285285
if prepare is Prepare.FIRST_TIME:
286286
_full_prepare()
287-
assert 'Installing' in output
288-
assert 'Project successfully created' in output
289287
if platform is Platform.ANDROID or platform is Platform.BOTH:
290-
assert 'tns-android' in output
288+
assert 'Platform android successfully added' in output
291289
if platform is Platform.IOS or platform is Platform.BOTH:
292-
assert 'tns-ios' in output
290+
assert 'Platform ios successfully added' in output
291+
assert 'Project successfully created' not in output
293292

294293
if platform is Platform.ANDROID or platform is Platform.BOTH:
295294
app_path = os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH)

tests/build/android/platform_android_tests.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def verify_update(self, output):
9393
assert "Platform android successfully removed" in output
9494
assert "Successfully removed plugin tns-core-modules" in output
9595
assert "Successfully removed plugin tns-core-modules-widgets" in output
96-
assert "Project successfully created" in output
96+
assert "Platform android successfully added" in output
9797
assert "Successfully installed plugin tns-core-modules" in output
9898

9999
@unittest.skipIf(Java.version() != "1.8", "Run only if Java version is 8.")
@@ -170,12 +170,11 @@ def test_420_platform_add_existing_platform(self):
170170
assert "Platform android already added" in output
171171

172172
def test_421_platform_add_android_wrong_option(self):
173-
174173
# frameworkPath point to missing file
175174
output = Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": "invalidFile.tgz"},
176175
assert_success=False)
177-
assert "npm ERR!" in output or "exit code" in output
178-
assert "invalidFile.tgz" in output
176+
assert "Invalid frameworkPath: invalidFile.tgz" in output
177+
assert "Please ensure the specified frameworkPath exists." in output
179178

180179
# Wrong frameworkPath option
181180
output = Tns.platform_add_android(attributes={"--path": self.app_name, "--" + invalid: "tns-android.tgz"},
@@ -188,7 +187,6 @@ def test_421_platform_add_android_wrong_option(self):
188187
assert "Usage" in output
189188

190189
def test_430_platform_remove_missing_invalid_or_empty_platform(self):
191-
192190
output = Tns.platform_remove(platform=Platform.ANDROID, attributes={"--path": self.app_name},
193191
assert_success=False)
194192
assert "The platform android is not added to this project"

tests/build/common/logtrace_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def test_102_platform_add_log_trace(self):
4242
assert "Package: " + self.app_id in output
4343
assert "Installed Android Targets" in output
4444
assert "Using Android SDK" in output
45-
assert "Platform android successfully added." in output
45+
assert "Platform android successfully added" in output

tests/build/ios/platform_ios_tests.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from core.osutils.folder import Folder
99
from core.settings.settings import IOS_PACKAGE, \
1010
CURRENT_OS, OSType, ANDROID_PACKAGE
11-
from core.settings.strings import *
1211
from core.tns.tns import Tns
1312
from core.tns.tns_platform_type import Platform
1413
from core.tns.tns_verifications import TnsAsserts
@@ -83,7 +82,7 @@ def test_320_platform_add_ios_custom_bundle_id(self):
8382
def test_330_platform_update_ios_platform_not_added(self):
8483
Tns.create_app(self.app_name)
8584
output = Tns.platform_update(platform="ios", attributes={"--path": self.app_name}, assert_success=False)
86-
assert successfully_created in output
85+
assert "Platform ios successfully added" in output
8786
assert not Folder.is_empty(self.app_name + "/platforms/ios/internal/metadata-generator")
8887

8988
def test_390_LSApplicationQueriesSchemes_merged(self):

tests/device/deploy_android_tests.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
Tests for deploy command
33
"""
44
import os
5-
import unittest
65

76
from core.base_class.BaseClass import BaseClass
87
from core.device.device import Device
98
from core.device.emulator import Emulator
10-
from core.java.java import Java
11-
from core.osutils.file import File
129
from core.osutils.folder import Folder
1310
from core.settings.settings import ANDROID_PACKAGE, TNS_PATH, ANDROID_KEYSTORE_PASS, ANDROID_KEYSTORE_PATH, \
1411
ANDROID_KEYSTORE_ALIAS, ANDROID_KEYSTORE_ALIAS_PASS, EMULATOR_ID
@@ -98,7 +95,7 @@ def test_300_deploy_android_platform_not_added(self):
9895

9996
# It is brand new project and we need a prepare for first run
10097
assert copy_template_files in output
101-
assert "Installing tns-android" in output
98+
assert "Platform android successfully added" in output
10299
assert successfully_prepared in output
103100

104101
device_ids = Device.get_ids(platform=Platform.ANDROID)

tests/device/deploy_ios_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ def test_300_deploy_ios_platform_not_added(self):
4444
Tns.create_app(app_name=self.app_name)
4545
output = Tns.deploy_ios(attributes={"--path": self.app_name, "--justlaunch": ""}, timeout=180)
4646
assert copy_template_files in output
47-
assert "Installing tns-ios" in output
47+
assert "Platform ios successfully added" in output
4848
# This is the first time we build the project -> we need a prepare
4949
assert successfully_prepared in output

0 commit comments

Comments
 (0)