1
1
import os
2
+ import time
2
3
import unittest
3
4
4
5
from core .base_test .tns_run_test import TnsRunTest
@@ -31,7 +32,7 @@ def setUpClass(cls):
31
32
cls .emu_API24 = DeviceManager .Emulator .ensure_available (Settings .Emulators .EMU_API_24 )
32
33
33
34
# Download Preview and Playground packages
34
- # Preview.get_app_packages()
35
+ Preview .get_app_packages ()
35
36
36
37
# Install Preview and Playground
37
38
Preview .install_preview_app (cls .emu , Platform .ANDROID )
@@ -96,19 +97,20 @@ def test_210_tns_preview_android_livesync_on_two_emulators(self):
96
97
log = File .read (result .log_file )
97
98
url = Preview .get_url (log )
98
99
Preview .run_url (url = url , device = self .emu )
99
- strings = TnsLogs .preview_initial_messages (device = self .emu )
100
+ strings = TnsLogs .preview_initial_messages (device = self .emu , platform = Platform . ANDROID )
100
101
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings )
101
- self .emu .wait_for_text (text = Changes .JSHelloWord .JS .old_text , timeout = 90 )
102
+ self .emu .wait_for_text (text = Changes .JSHelloWord .JS .old_text , timeout = 120 )
102
103
103
104
# Click on TAP button on emulator
104
105
Adb .click_element_by_text (self .emu .id , 'TAP' , case_sensitive = True )
105
106
107
+ time .sleep (2 )
106
108
# Preview on second emulator
107
109
Preview .run_url (url = url , device = self .emu_API24 )
108
110
# Here use bundle=False because on consecutive preview build is not executed again
109
111
# and no bundle messages are displayed in log
110
- strings = TnsLogs .preview_initial_messages (device = self .emu , bundle = False )
111
- TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings )
112
+ strings = TnsLogs .preview_initial_messages (device = self .emu , platform = Platform . ANDROID )
113
+ TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings , timeout = 120 )
112
114
self .emu_API24 .wait_for_text (text = Changes .JSHelloWord .JS .old_text )
113
115
114
116
# Verify first emulator is not refreshed, state of app is preserved
@@ -136,7 +138,7 @@ def test_210_tns_preview_on_simulator_and_emulator_livesync(self):
136
138
log = File .read (result .log_file )
137
139
url = Preview .get_url (log )
138
140
Preview .run_url (url = url , device = self .emu )
139
- strings = TnsLogs .preview_initial_messages (device = self .emu )
141
+ strings = TnsLogs .preview_initial_messages (device = self .emu , platform = Platform . ANDROID )
140
142
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings )
141
143
self .emu .wait_for_text (text = Changes .JSHelloWord .JS .old_text )
142
144
@@ -145,7 +147,7 @@ def test_210_tns_preview_on_simulator_and_emulator_livesync(self):
145
147
146
148
# Preview on simulator
147
149
Preview .run_url (url = url , device = self .sim )
148
- strings = TnsLogs .preview_initial_messages (device = self .sim )
150
+ strings = TnsLogs .preview_initial_messages (device = self .sim , platform = Platform . IOS )
149
151
TnsLogs .wait_for_log (log_file = result .log_file , string_list = strings )
150
152
self .sim .wait_for_text (text = Changes .JSHelloWord .JS .old_text )
151
153
@@ -162,8 +164,8 @@ def test_210_tns_preview_on_simulator_and_emulator_livesync(self):
162
164
log = File .read (result .log_file )
163
165
log = File .extract_part_of_text (log , '[VERIFIED]' )
164
166
# Verify files are synced once
165
- TnsAssert .file_is_synced_once (log , Platform . ANDROID , 'main-view-model.js' )
166
- TnsAssert .file_is_synced_once (log , Platform . IOS , 'main-view-model.js' )
167
+ TnsAssert .file_is_synced_once (log , device = self . emu , file_name = 'main-view-model.js' )
168
+ TnsAssert .file_is_synced_once (log , device = self . sim , file_name = 'main-view-model.js' )
167
169
# Mark that part of the log as verified before next sync
168
170
File .append (result .log_file , '[VERIFIED]' )
169
171
@@ -177,8 +179,8 @@ def test_210_tns_preview_on_simulator_and_emulator_livesync(self):
177
179
log = File .read (result .log_file )
178
180
log = File .extract_part_of_text (log , '[VERIFIED]' )
179
181
# Verify files are synced once
180
- TnsAssert .file_is_synced_once (log , Platform . ANDROID , 'main-page.xml' )
181
- TnsAssert .file_is_synced_once (log , Platform . IOS , 'main-page.xml' )
182
+ TnsAssert .file_is_synced_once (log , device = self . emu , file_name = 'main-page.xml' )
183
+ TnsAssert .file_is_synced_once (log , device = self . sim , file_name = 'main-page.xml' )
182
184
183
185
def test_240_tns_preview_android_verify_plugin_warnings (self ):
184
186
"""
0 commit comments