-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_vue_preview.py
54 lines (44 loc) · 2.19 KB
/
test_vue_preview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import unittest
from flaky import flaky
from core.base_test.tns_run_test import TnsRunTest
from core.enums.os_type import OSType
from core.enums.platform_type import Platform
from core.settings import Settings
from core.utils.file_utils import Folder
from data.sync.blank_vue import preview_blank_vue
from data.templates import Template
from products.nativescript.preview_helpers import Preview
from products.nativescript.tns import Tns
@flaky(max_runs=3)
class VueJSPreviewTests(TnsRunTest):
app_name = Settings.AppName.DEFAULT
source_project_dir = os.path.join(Settings.TEST_RUN_HOME, app_name)
target_project_dir = os.path.join(Settings.TEST_RUN_HOME, 'data', 'temp', app_name)
@classmethod
def setUpClass(cls):
TnsRunTest.setUpClass()
Preview.install_preview_app(cls.emu, Platform.ANDROID)
if Settings.HOST_OS is OSType.OSX:
Preview.install_preview_app(cls.sim, Platform.IOS)
Preview.install_playground_app(cls.sim, Platform.IOS)
# Create app
Tns.create(app_name=cls.app_name, template=Template.VUE_BLANK.local_package, update=True)
Tns.platform_add_android(app_name=cls.app_name, framework_path=Settings.Android.FRAMEWORK_PATH)
if Settings.HOST_OS is OSType.OSX:
Tns.platform_add_ios(app_name=cls.app_name, framework_path=Settings.IOS.FRAMEWORK_PATH)
# Copy TestApp to data folder.
Folder.copy(source=cls.source_project_dir, target=cls.target_project_dir)
def setUp(self):
TnsRunTest.setUp(self)
# "src" folder of TestApp will be restored before each test.
# This will ensure failures in one test do not cause common failures.
source_src = os.path.join(self.target_project_dir, 'app')
target_src = os.path.join(self.source_project_dir, 'app')
Folder.clean(target_src)
Folder.copy(source=source_src, target=target_src)
def test_100_preview_android(self):
preview_blank_vue(self.app_name, Platform.ANDROID, self.emu)
@unittest.skipIf(Settings.HOST_OS != OSType.OSX, 'iOS tests can be executed only on macOS.')
def test_100_preview_ios(self):
preview_blank_vue(self.app_name, Platform.IOS, self.sim)