Skip to content

Commit 106c246

Browse files
author
Natalia Hristova
authored
Test for console log ios 11 on simulator. (#76)
test for NativeScript/nativescript-cli#3141
1 parent faa0331 commit 106c246

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

tests/simulator/run_ios_tests_ng.py

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"""
2+
Test for `tns run ios` command with Angular apps (on simulator).
3+
"""
4+
5+
import os
6+
from flaky import flaky
7+
8+
from core.base_class.BaseClass import BaseClass
9+
from core.device.device import Device
10+
from core.device.emulator import Emulator
11+
from core.device.simulator import Simulator
12+
from core.osutils.folder import Folder
13+
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME
14+
from core.tns.tns import Tns
15+
16+
17+
class RunIOSSimulatorTestsNG(BaseClass):
18+
SIMULATOR_ID = ''
19+
20+
@classmethod
21+
def setUpClass(cls):
22+
logfile = os.path.join('out', cls.__name__ + '.txt')
23+
BaseClass.setUpClass(logfile)
24+
Emulator.stop()
25+
Simulator.stop()
26+
cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
27+
Folder.cleanup(cls.app_name)
28+
29+
# Create default NG app (to get right dependencies from package.json)
30+
Tns.create_app_ng(cls.app_name)
31+
Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_RUNTIME_PATH})
32+
33+
# Copy the app folder (app is modified in order to get some console logs on loaded)
34+
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'app')
35+
target = os.path.join(cls.app_name, 'app')
36+
Folder.cleanup(target)
37+
Folder.copy(src=source, dst=target)
38+
39+
def setUp(self):
40+
BaseClass.setUp(self)
41+
Tns.kill()
42+
43+
def tearDown(self):
44+
Tns.kill()
45+
BaseClass.tearDown(self)
46+
47+
@classmethod
48+
def tearDownClass(cls):
49+
BaseClass.tearDownClass()
50+
Emulator.stop()
51+
52+
@flaky(max_runs=2)
53+
def test_001_tns_run_ios(self):
54+
55+
# `tns run ios` and wait until app is deployed
56+
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': ''}, wait=False,
57+
assert_success=False)
58+
strings = ['Project successfully built',
59+
'Successfully installed on device with identifier', self.SIMULATOR_ID,
60+
'Successfully synced application']
61+
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False)
62+
63+
# Verify initial state of the app
64+
assert Device.wait_for_text(device_id=self.SIMULATOR_ID, text="Ter Stegen",
65+
timeout=20), 'Hello-world NG App failed to start or it does not look correct!'
66+
67+
# Verify console.log works - issue #3141
68+
console_log_strings = ['Home page loaded!',
69+
'Application loaded!']
70+
Tns.wait_for_log(log_file=log, string_list=console_log_strings, clean_log=False)
71+

0 commit comments

Comments
 (0)