Rely on activity to move back to android app
Browse files- e2e_tests/test_sauce_labs.py +17 -10
e2e_tests/test_sauce_labs.py
CHANGED
|
@@ -89,7 +89,12 @@ def save_server_settings(driver: WebDriver):
|
|
| 89 |
)
|
| 90 |
|
| 91 |
|
| 92 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
element = find_and_click(
|
| 94 |
driver,
|
| 95 |
by_selector=AppiumBy.XPATH,
|
|
@@ -113,16 +118,20 @@ def enable_privacy_settings(driver: WebDriver):
|
|
| 113 |
if not secondary_checkbox.get_attribute("checked") == "true":
|
| 114 |
secondary_checkbox.click()
|
| 115 |
|
| 116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
# driver.activate_app(f"{APP_PACKAGE_NAME}")
|
| 118 |
# These sleeps are harsh, however are now needed till will fix the activity which brings up settings by default
|
| 119 |
# Once thats fixed, we can activate the app back it should resume as is, without the back button
|
| 120 |
|
| 121 |
-
time.sleep(1)
|
| 122 |
-
driver.back()
|
| 123 |
-
time.sleep(1)
|
| 124 |
-
driver.back()
|
| 125 |
-
time.sleep(1)
|
| 126 |
|
| 127 |
|
| 128 |
class TestAppium(unittest.TestCase):
|
|
@@ -130,9 +139,7 @@ class TestAppium(unittest.TestCase):
|
|
| 130 |
# Usage of the context manager ensures the driver session is closed properly
|
| 131 |
# after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
|
| 132 |
with android_driver({}) as driver:
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
driver.wait_activity(APP_ACTIVITY_NAME, 5)
|
| 136 |
|
| 137 |
save_server_settings(driver)
|
| 138 |
|
|
|
|
| 89 |
)
|
| 90 |
|
| 91 |
|
| 92 |
+
def enable_accessibility_settings(driver: WebDriver):
|
| 93 |
+
element = find_and_click(
|
| 94 |
+
driver,
|
| 95 |
+
by_selector=AppiumBy.ID,
|
| 96 |
+
selector_value=f"{APP_PACKAGE_NAME}:id/accessibilitySettings"
|
| 97 |
+
)
|
| 98 |
element = find_and_click(
|
| 99 |
driver,
|
| 100 |
by_selector=AppiumBy.XPATH,
|
|
|
|
| 118 |
if not secondary_checkbox.get_attribute("checked") == "true":
|
| 119 |
secondary_checkbox.click()
|
| 120 |
|
| 121 |
+
driver.back()
|
| 122 |
+
|
| 123 |
+
driver.start_activity(APP_PACKAGE_NAME, ".ChatterAct")
|
| 124 |
+
driver.wait_activity(".ChatterAct", 5)
|
| 125 |
+
|
| 126 |
# driver.activate_app(f"{APP_PACKAGE_NAME}")
|
| 127 |
# These sleeps are harsh, however are now needed till will fix the activity which brings up settings by default
|
| 128 |
# Once thats fixed, we can activate the app back it should resume as is, without the back button
|
| 129 |
|
| 130 |
+
# time.sleep(1)
|
| 131 |
+
# driver.back()
|
| 132 |
+
# time.sleep(1)
|
| 133 |
+
# driver.back()
|
| 134 |
+
# time.sleep(1)
|
| 135 |
|
| 136 |
|
| 137 |
class TestAppium(unittest.TestCase):
|
|
|
|
| 139 |
# Usage of the context manager ensures the driver session is closed properly
|
| 140 |
# after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
|
| 141 |
with android_driver({}) as driver:
|
| 142 |
+
enable_accessibility_settings(driver)
|
|
|
|
|
|
|
| 143 |
|
| 144 |
save_server_settings(driver)
|
| 145 |
|