Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dtopuzov committed Jul 31, 2017
1 parent b62e612 commit cd32fde
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
9 changes: 9 additions & 0 deletions core/device/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import time

from core.device.device import Device
from core.device.helpers.adb import Adb
from core.osutils.command import run
from core.osutils.command_log_level import CommandLogLevel
Expand Down Expand Up @@ -81,9 +82,17 @@ def wait(device_id, timeout=300):
booted = Emulator.is_running(device_id=device_id)
if (booted is True) or (time.time() > end_time):
break

# If booted, make sure screen will not lock
if booted:
Adb.run(command='shell settings put system screen_off_timeout -1', device_id=device_id)

# If booted, make sure screen will not lock
if booted:
text = Adb.get_page_source(device_id=device_id)
if "android.process.acore" in text:
print "Error dialog detected! Try to kill it..."
Device.click(device_id=device_id, text="OK", timeout=10)
return booted

@staticmethod
Expand Down
17 changes: 15 additions & 2 deletions tests/build/ios/prepare_ios_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from core.osutils.command import run
from core.osutils.file import File
from core.osutils.folder import Folder
from core.settings.settings import IOS_RUNTIME_PATH, CURRENT_OS, OSType, TEST_RUN_HOME
from core.settings.settings import IOS_RUNTIME_PATH, CURRENT_OS, OSType, TEST_RUN_HOME, ANDROID_RUNTIME_PATH
from core.tns.replace_helper import ReplaceHelper
from core.tns.tns import Tns
from core.tns.tns_platform_type import Platform
Expand All @@ -32,6 +32,7 @@ def setUp(self):
def test_100_prepare_ios(self):
Tns.create_app(self.app_name)
Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
Tns.platform_add_android(attributes={"--path": self.app_name, "--frameworkPath": ANDROID_RUNTIME_PATH})

# Initial prepare should be full.
output = Tns.prepare_ios(attributes={"--path": self.app_name})
Expand All @@ -54,6 +55,18 @@ def test_100_prepare_ios(self):
result = re.search("Schemes:\n\s*TestApp", output)
assert result is not None

# Initial prepare for other platform (Android) should be full.
output = Tns.prepare_android(attributes={"--path": self.app_name})
TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.FULL)

# Prepare original platform (iOS) should be skipped.
output = Tns.prepare_ios(attributes={"--path": self.app_name}, assert_success=False)
TnsAsserts.prepared(self.app_name, platform=Platform.IOS, output=output, prepare=Prepare.SKIP)

# Initial prepare for other platform (Android) should be skipped.
output = Tns.prepare_android(attributes={"--path": self.app_name}, assert_success=False)
TnsAsserts.prepared(self.app_name, platform=Platform.ANDROID, output=output, prepare=Prepare.SKIP)

def test_200_prepare_additional_appresources(self):
Tns.create_app(self.app_name)
Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_RUNTIME_PATH})
Expand Down Expand Up @@ -98,7 +111,7 @@ def test_220_build_ios_with_custom_plist(self):
# Prepare in release
Tns.prepare_ios(attributes={"--path": self.app_name, '--release': ''})
assert "<string>fbXXXXXXXXX</string>" in File.read(final_plist)
assert not "<string>orgnativescriptTestApp</string>" in File.read(final_plist)
assert "<string>orgnativescriptTestApp</string>" not in File.read(final_plist)

def test_300_prepare_ios_preserve_case(self):
Tns.create_app(self.app_name)
Expand Down

0 comments on commit cd32fde

Please sign in to comment.