Skip to content

feat: add theme parameter on TnsAsserts.created() #23

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
Jan 24, 2019
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions products/nativescript/tns_assert.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
class TnsAssert(object):

@staticmethod
def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME):
def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME, theme=True):
"""
Verify app is created properly.
:param app_name: Name of the app.
:param output: Console output of `tns create` command.
:param app_data: AppInfo object.
:param path: Base path where app is created.
:param theme: If true it will verify default {N} theme is installed.
"""
# Assert app exists
app_path = os.path.join(path, app_name)
Expand All @@ -40,7 +41,8 @@ def created(app_name, output=None, app_data=None, path=Settings.TEST_RUN_HOME):
assert File.exists(os.path.join(node_path, 'tns-core-modules', 'tns-core-modules.d.ts'))

# Verify {N} core theme is installed
assert Folder.exists(os.path.join(node_path, 'nativescript-theme-core')), '{N} theme do not exists in app.'
if theme:
assert Folder.exists(os.path.join(node_path, 'nativescript-theme-core')), '{N} theme do not exists.'

# Verify webpack is installed
before_watch_hooks = os.path.join(app_path, 'hooks', 'before-watch')
Expand Down
7 changes: 6 additions & 1 deletion tests/code_sharing/ng_new_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ def create_and_run(shared=True, sample=False, theme=True, style=None, prefix=Non
# Create shared project with sample data
result = NG.new(collection=NS_SCHEMATICS, project=NGNewTests.app_name, theme=theme, shared=shared,
sample=sample, style=style, prefix=prefix, source_dir=source_dir, webpack=webpack)
TnsAssert.created(app_name=NGNewTests.app_name, app_data=app_data)

# Verify valid {N} app is created
theme = True
if style is None:
theme = False
TnsAssert.created(app_name=NGNewTests.app_name, app_data=app_data, theme=theme)
assert 'Directory is already under version control. Skipping initialization of git.' in result.output, \
'Git init should be skipped because app is created already existing repo (the one with tests).'

Expand Down