def test_002_build_android_release_uglify_snapshot_sourcemap(self): # https://github.com/NativeScript/nativescript-dev-webpack/issues/920 result = Tns.build_android(self.app_name, release=True, uglify=True, snapshot=True, source_map=True) assert "ERROR in NativeScriptSnapshot. Snapshot generation failed!" not in result.output assert "Target architecture: arm64-v8a" not in result.output # Verify snapshot files in the built .apk apk_path = TnsPaths.get_apk_path(app_name=self.app_name, release=True) if Settings.HOST_OS != OSType.WINDOWS: TnsAssert.snapshot_build(apk_path, self.temp_folder) # Verify app is built with android sdk 29 by default TnsAssert.string_in_android_manifest(apk_path, 'compileSdkVersion="29"') # Configs are respected assert File.exists(TnsPaths.get_apk_path(self.app_name, release=True)) # Create zip command = "tar -czf " + self.app_name + "/app/app.tar.gz " + self.app_name + "/app/app.js" run(cmd=command, cwd=Settings.TEST_RUN_HOME, wait=True) assert File.exists(os.path.join(self.app_path, 'app', 'app.tar.gz'))
def run_hello_world_js_ts(app_name, platform, device, bundle=True, hmr=True, uglify=False, release=False, aot=False, snapshot=False, instrumented=False, sync_all_files=False, just_launch=False, default_andr_sdk='29', timeout=240): # Execute `tns run` and wait until logs are OK result = Tns.run(app_name=app_name, platform=platform, emulator=True, wait=False, bundle=bundle, hmr=hmr, release=release, uglify=uglify, aot=aot, snapshot=snapshot, sync_all_files=sync_all_files, just_launch=just_launch) strings = TnsLogs.run_messages(app_name=app_name, platform=platform, run_type=RunType.UNKNOWN, bundle=bundle, hmr=hmr, instrumented=instrumented, device=device, release=release, snapshot=snapshot) TnsLogs.wait_for_log(log_file=result.log_file, string_list=strings, timeout=timeout) # Verify it looks properly device.wait_for_text(text=Changes.JSHelloWord.JS.old_text) device.wait_for_text(text=Changes.JSHelloWord.XML.old_text) blue_count = device.get_pixels_by_color(color=Colors.LIGHT_BLUE) assert blue_count > 100, 'Failed to find blue color on {0}'.format(device.name) initial_state = os.path.join(Settings.TEST_OUT_IMAGES, device.name, 'initial_state.png') device.get_screen(path=initial_state) if platform == Platform.ANDROID: # Verify android sdk the app is built with if release: apk_path = TnsPaths.get_apk_path(app_name=app_name, release=True) else: apk_path = TnsPaths.get_apk_path(app_name=app_name, release=False) TnsAssert.string_in_android_manifest(apk_path, 'compileSdkVersion="{0}"'.format(default_andr_sdk)) if snapshot and Settings.HOST_OS != OSType.WINDOWS: TnsAssert.snapshot_build(TnsPaths.get_apk_path(app_name=app_name, release=True), Settings.TEST_OUT_TEMP) return result