Skip to content

Commit 9c230fb

Browse files
committed
fix: windows tests
1 parent f78ffd4 commit 9c230fb

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

tests/emulator/run_android_tests.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
If emulator is not started and device is not connected `tns run android` should start emulator.
1212
"""
1313

14+
import datetime
1415
import os
16+
import re
1517
import time
1618
import unittest
1719

1820
import nose
21+
import pytz
1922

2023
from core.base_class.BaseClass import BaseClass
2124
from core.device.device import Device
@@ -33,9 +36,6 @@
3336
from core.tns.tns_platform_type import Platform
3437
from core.tns.tns_prepare_type import Prepare
3538
from core.tns.tns_verifications import TnsAsserts
36-
import re
37-
import datetime
38-
import pytz
3939

4040

4141
class RunAndroidEmulatorTests(BaseClass):
@@ -45,12 +45,12 @@ class RunAndroidEmulatorTests(BaseClass):
4545
"1234567890123456789012345678901234567890"
4646
very_long_string = ''
4747
for x in range(0, 30):
48-
very_long_string = very_long_string + one_hundred_symbols_string
48+
very_long_string += one_hundred_symbols_string
4949

5050
max_long_string = ''
5151
for x in range(0, 10):
52-
max_long_string = max_long_string + one_hundred_symbols_string
53-
max_long_string = max_long_string + "123456789012345678901234"
52+
max_long_string += one_hundred_symbols_string
53+
max_long_string += "123456789012345678901234"
5454

5555
@classmethod
5656
def setUpClass(cls):
@@ -59,17 +59,25 @@ def setUpClass(cls):
5959
Emulator.stop()
6060
Emulator.ensure_available()
6161
Device.uninstall_app(app_prefix="org.nativescript.", platform=Platform.ANDROID)
62-
Tns.create_app(cls.app_name,
63-
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
64-
update_modules=True)
65-
Tns.platform_add_android(attributes={'--path': cls.app_name, '--frameworkPath': ANDROID_PACKAGE})
66-
Folder.cleanup(cls.temp_app)
67-
Folder.copy(cls.source_app, cls.temp_app)
62+
if CURRENT_OS != OSType.WINDOWS:
63+
Tns.create_app(cls.app_name,
64+
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
65+
update_modules=True)
66+
Tns.platform_add_android(attributes={'--path': cls.app_name, '--frameworkPath': ANDROID_PACKAGE})
67+
Folder.cleanup(cls.temp_app)
68+
Folder.copy(cls.source_app, cls.temp_app)
6869

6970
def setUp(self):
7071
BaseClass.setUp(self)
7172
Folder.cleanup(self.source_app)
72-
Folder.copy(self.temp_app, self.source_app)
73+
if CURRENT_OS != OSType.WINDOWS:
74+
Folder.copy(self.temp_app, self.source_app)
75+
else:
76+
Tns.create_app(self.app_name,
77+
attributes={'--template': os.path.join('data', 'apps', 'livesync-hello-world.tgz')},
78+
update_modules=True)
79+
Tns.platform_add_android(attributes={'--path': self.app_name, '--frameworkPath': ANDROID_PACKAGE})
80+
Emulator.ensure_available()
7381

7482
def tearDown(self):
7583
Tns.kill()
@@ -590,16 +598,16 @@ def test_310_tns_run_android_clean_builds(self):
590598
Device.wait_for_text(device_id=EMULATOR_ID, text='42 taps left')
591599

592600
def test_315_tns_run_android_change_appResources_check_per_platform(self):
593-
#https://github.com/NativeScript/nativescript-cli/pull/3619
601+
# https://github.com/NativeScript/nativescript-cli/pull/3619
594602
output = Tns.run_android(attributes={'--path': self.app_name}, wait=False, assert_success=False)
595603
strings = ['Successfully installed on device with identifier',
596-
'Successfully synced application', EMULATOR_ID,]
604+
'Successfully synced application', EMULATOR_ID, ]
597605
Tns.wait_for_log(log_file=output, string_list=strings, timeout=120, check_interval=10)
598606

599607
source = os.path.join('data', 'issues', 'nativescript-cli-3619', 'hello.png')
600608
target = os.path.join(self.app_name, 'app', 'App_Resources', 'Android', 'drawable-hdpi')
601609
File.copy(source, target)
602-
strings = ['Gradle build' ]
610+
strings = ['Gradle build']
603611
Tns.wait_for_log(log_file=output, string_list=strings, clean_log=False)
604612
assert "Xcode build" not in output
605613

0 commit comments

Comments
 (0)