Skip to content

Commit

Permalink
e2e: fix for deep links test
Browse files Browse the repository at this point in the history
  • Loading branch information
yevh-berdnyk committed Nov 29, 2023
1 parent bfa23c1 commit b7f675a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
11 changes: 6 additions & 5 deletions test/appium/tests/critical/test_deep_and_universal_links.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def test_links_deep_links(self):
for link, text in profile_links.items():
self.browser_view.open_url(link)
if text:
name_is_shown = self.profile_view.default_username_text.text == text
name_is_shown = self.profile_view.default_username_text.text == text \
or self.profile_view.default_username_text.text.endswith(link[-6:])
else:
name_is_shown = self.profile_view.default_username_text.text.endswith(link[-6:])
if not self.channel.profile_add_to_contacts_button.is_element_displayed(10) or not name_is_shown:
Expand All @@ -92,19 +93,19 @@ def test_links_deep_links(self):

@marks.testrail_id(704614)
def test_links_open_universal_links_from_other_apps(self):
app_package = self.driver.current_package
self.home.just_fyi("Opening a profile URL from google search bar when user is still logged in")
profile_url = "https://status.app/u#zQ3shVVxZMwLVEQvuu1KF6h4D2mzVyCC4F4mHLZm5dz5XU1aa"
self.home.click_system_home_button()
self.home.open_link_from_google_search_app(profile_url)
self.home.open_link_from_google_search_app(profile_url, app_package)
if not self.channel.profile_add_to_contacts_button.is_element_displayed(
10) or not self.profile_view.default_username_text.text.endswith(profile_url[-6:]):
self.errors.append("Profile was not opened by the url %s when user is logged in" % profile_url)

self.home.just_fyi("Opening a community URL from google search bar when user is logged out")
app_package = self.driver.current_package
self.driver.terminate_app(app_package)
community_url = "https://status.app/c/Ow==#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK"
self.home.open_link_from_google_search_app(community_url)
self.home.open_link_from_google_search_app(community_url, app_package)
self.sign_in.sign_in()
if not self.home.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
Expand All @@ -114,7 +115,7 @@ def test_links_open_universal_links_from_other_apps(self):
self.driver.reset()
self.home.click_system_home_button()
channel_url = "https://status.app/cc/Ow==#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK"
self.home.open_link_from_google_search_app(channel_url)
self.home.open_link_from_google_search_app(channel_url, app_package)
self.sign_in.create_user()
if not self.home.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
Expand Down
6 changes: 4 additions & 2 deletions test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,11 @@ def wait_for_staleness_of_element(self, element_instance: WebElement, seconds=10
raise TimeoutException(
"Device %s: expected element is not stale after %s seconds" % (self.driver.number, seconds)) from None

def open_link_from_google_search_app(self, link_text: str):
def open_link_from_google_search_app(self, link_text: str, app_package: str):
Button(self.driver, xpath="//*[contains(@resource-id,'search_container_all_apps')]").click()
EditBox(self.driver, xpath="//android.widget.EditText").send_keys(link_text)
self.driver.press_keycode(66)
Button(self.driver, xpath="//*[@resource-id='android:id/resolver_list']//*[@text='Status']").click_if_shown()
text_to_click = "Status PR" if app_package.endswith(".pr") else "Status"
Button(self.driver,
xpath="//*[@resource-id='android:id/resolver_list']//*[@text='%s']" % text_to_click).click_if_shown()
Button(self.driver, xpath="//*[@resource-id='android:id/button_once']").click()

0 comments on commit b7f675a

Please sign in to comment.