Ejemplo n.º 1
0
 def install_playground_app(device_info, platform):
     """Installs Playground App on emulator and simulator"""
     package_android = os.path.join(TEST_SUT_HOME, "app-release.apk")
     package_ios = os.path.join(TEST_SUT_HOME, 'nsplay.app')
     if platform is Platform.IOS:
         # Unpack the .tgz file to get the nsplay.app
         File.unpack_tar(os.path.join(TEST_SUT_HOME, 'nsplay.tgz'), TEST_SUT_HOME)
         Simctl.install(device_info, package_ios)
     elif platform is Platform.ANDROID:
         Adb.install(package_android, device_info.id)
Ejemplo n.º 2
0
 def install_preview_app(device_info, platform, timeout=60):
     """Installs Preview App on emulator and simulator"""
     package_android = os.path.join(TEST_SUT_HOME, 'app-universal-release.apk')
     package_ios = os.path.join(TEST_SUT_HOME, 'nsplaydev.app')
     if platform is Platform.IOS:
         # Unpack the .tgz file to get the nsplaydev.app
         File.unpack_tar(os.path.join(TEST_SUT_HOME, 'nsplaydev.tgz'), TEST_SUT_HOME)
         Simctl.install(device_info, package_ios)
     elif platform is Platform.ANDROID:
         Adb.install(package_android, device_info.id, timeout)
Ejemplo n.º 3
0
 def test_06_kill_process(self):
     if not Adb.is_application_installed(self.emu.id, "com.wdiodemoapp"):
         Adb.install(self.apk_path, self.emu.id)
     Adb.start_application(self.emu.id, "com.wdiodemoapp")
     time.sleep(5)
     Adb.kill_process(self.emu.id, "com.wdiodemoapp")
     time.sleep(5)
     service_info = Adb.get_active_services(self.emu.id, "com.wdiodemoapp").replace("\r", "").replace("\n", "")
     pid = Adb.get_process_pid(self.emu.id, "com.wdiodemoapp")
     assert pid == "", "Application not killed! PID " + pid
     error_message = "Service is not killed. Log: " + service_info
     assert service_info == "ACTIVITY MANAGER SERVICES (dumpsys activity services)  (nothing)", error_message
Ejemplo n.º 4
0
 def install_preview_app_no_unpack(device_info, platform, uninstall=True):
     """Installs Preview App on emulator and simulator"""
     package_android = os.path.join(TEST_SUT_HOME, 'app-universal-release.apk')
     package_ios = os.path.join(TEST_SUT_HOME, 'nsplaydev.app')
     if platform is Platform.IOS:
         if uninstall:
             Simctl.uninstall(device_info, Settings.Packages.PREVIEW_APP_ID)
         Simctl.install(device_info, package_ios)
     elif platform is Platform.ANDROID:
         if uninstall:
             Adb.uninstall(Settings.Packages.PREVIEW_APP_ID, device_info.id, False)
         Adb.install(package_android, device_info.id)
Ejemplo n.º 5
0
 def test_201_error_is_shown_when_metadata_folder_in_apk_is_missing(self):
     """
        https://github.com/NativeScript/android-runtime/issues/1471
        https://github.com/NativeScript/android-runtime/issues/1382
     """
     Adb.uninstall("org.nativescript.TestApp", self.emulator.id, True)
     Tns.build_android(os.path.join(TEST_RUN_HOME, APP_NAME), verify=True)
     apk_folder_path = os.path.join(TEST_RUN_HOME, APP_NAME, PLATFORM_ANDROID_APK_DEBUG_PATH)
     apk_path = os.path.join(apk_folder_path, "app-debug.apk")
     unzip_folder = os.path.join(apk_folder_path, "app-debug")
     File.unzip(apk_path, unzip_folder)
     Folder.clean(os.path.join(unzip_folder, "assets", "metadata"))
     File.delete(apk_path)
     File.zip(unzip_folder, apk_path)
     self.sign_apk(apk_path)
     Adb.install(apk_path, self.emulator.id, 60)
     Adb.start_application(self.emulator.id, "org.nativescript.TestApp")
     text_on_screen = "com.tns.NativescriptException: metadata folder couldn\'t be opened!"
     self.emulator.wait_for_text(text_on_screen)
     error_message = "Missing metadata in apk is not causing the correct error! Logs: "
     assert self.emulator.is_text_visible(text_on_screen), error_message + self.emulator.get_text()
Ejemplo n.º 6
0
 def test_05_start_application(self):
     if not Adb.is_application_installed(self.emu.id, "com.wdiodemoapp"):
         Adb.install(self.apk_path, self.emu.id)
     Adb.start_application(self.emu.id, "com.wdiodemoapp")
Ejemplo n.º 7
0
 def test_04_install(self):
     Adb.install(self.apk_path, self.emu.id)
     Adb.uninstall("com.wdiodemoapp", self.emu.id)