Skip to content

Test for console log ios 11 on simulator. #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions tests/simulator/run_ios_tests_ng.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""
Test for `tns run ios` command with Angular apps (on simulator).
"""

import os
from flaky import flaky

from core.base_class.BaseClass import BaseClass
from core.device.device import Device
from core.device.emulator import Emulator
from core.device.simulator import Simulator
from core.osutils.folder import Folder
from core.settings.settings import IOS_RUNTIME_PATH, SIMULATOR_NAME
from core.tns.tns import Tns


class RunIOSSimulatorTestsNG(BaseClass):
SIMULATOR_ID = ''

@classmethod
def setUpClass(cls):
logfile = os.path.join('out', cls.__name__ + '.txt')
BaseClass.setUpClass(logfile)
Emulator.stop()
Simulator.stop()
cls.SIMULATOR_ID = Simulator.ensure_available(simulator_name=SIMULATOR_NAME)
Folder.cleanup(cls.app_name)

# Create default NG app (to get right dependencies from package.json)
Tns.create_app_ng(cls.app_name)
Tns.platform_add_ios(attributes={'--path': cls.app_name, '--frameworkPath': IOS_RUNTIME_PATH})

# Copy the app folder (app is modified in order to get some console logs on loaded)
source = os.path.join('data', 'apps', 'livesync-hello-world-ng', 'app')
target = os.path.join(cls.app_name, 'app')
Folder.cleanup(target)
Folder.copy(src=source, dst=target)

def setUp(self):
BaseClass.setUp(self)
Tns.kill()

def tearDown(self):
Tns.kill()
BaseClass.tearDown(self)

@classmethod
def tearDownClass(cls):
BaseClass.tearDownClass()
Emulator.stop()

@flaky(max_runs=2)
def test_001_tns_run_ios(self):

# `tns run ios` and wait until app is deployed
log = Tns.run_ios(attributes={'--path': self.app_name, '--emulator': ''}, wait=False,
assert_success=False)
strings = ['Project successfully built',
'Successfully installed on device with identifier', self.SIMULATOR_ID,
'Successfully synced application']
Tns.wait_for_log(log_file=log, string_list=strings, timeout=180, check_interval=10, clean_log=False)

# Verify initial state of the app
assert Device.wait_for_text(device_id=self.SIMULATOR_ID, text="Ter Stegen",
timeout=20), 'Hello-world NG App failed to start or it does not look correct!'

# Verify console.log works - issue #3141
console_log_strings = ['Home page loaded!',
'Application loaded!']
Tns.wait_for_log(log_file=log, string_list=console_log_strings, clean_log=False)