def setup_method(self, method) -> None: # type: ignore desired_caps = desired_capabilities.get_desired_capabilities( 'ApiDemos-debug.apk.zip') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) if is_ci(): self.driver.start_recording_screen()
def teardown_method(self, method) -> None: # type: ignore if is_ci(): payload = self.driver.stop_recording_screen() video_path = os.path.join(os.getcwd(), method.__name__ + '.mp4') with open(video_path, "wb") as fd: fd.write(base64.b64decode(payload)) self.driver.quit()
def setUp(self): desired_caps = desired_capabilities.get_desired_capabilities( 'ApiDemos-debug.apk.zip') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) if is_ci(): self.driver.start_recording_screen()
def setup_method(self) -> None: desired_caps = desired_capabilities.get_desired_capabilities( 'UICatalog.app.zip') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) if is_ci(): self.driver.start_recording_screen()
def tearDown(self): if is_ci(): payload = self.driver.stop_recording_screen() video_path = os.path.join(os.getcwd(), self._testMethodName + '.mp4') with open(video_path, "wb") as fd: fd.write(base64.b64decode(payload)) self.driver.quit()
def test_element_find_single_element(self): if is_ci(): self.skipTest('Need to fix flaky test during running on CI') wait_for_element(self.driver, MobileBy.ANDROID_UIAUTOMATOR, 'new UiSelector().text("Accessibility")').click() wait_for_element( self.driver, MobileBy.ANDROID_UIAUTOMATOR, 'new UiSelector().text("Accessibility Node Querying")').click() el = wait_for_element(self.driver, MobileBy.CLASS_NAME, 'android.widget.ListView') sub_el = el.find_element_by_accessibility_id('Task Take out Trash') self.assertIsNotNone(sub_el)
def tearDown(self): if is_ci(): # Take the screenshot to investigate when tests failed only on CI img_path = os.path.join(os.getcwd(), self._testMethodName + '.png') self.driver.get_screenshot_as_file(img_path) self.driver.quit()