e2e: deep links tests added

This commit is contained in:
Yevheniia Berdnyk 2023-11-28 13:02:40 +02:00
parent e5ce7fed3a
commit 0546a87e9a
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
4 changed files with 136 additions and 2 deletions

View File

@ -1,5 +1,5 @@
Appium-Python-Client==2.11.1 Appium-Python-Client==2.11.1
Pillow==8.1.0 Pillow==10.0.0
PyGithub==1.55 PyGithub==1.55
PyYAML==5.3.1 PyYAML==5.3.1
Cython<3.0 Cython<3.0

View File

@ -123,7 +123,7 @@ class TestrailReport(BaseTestReport):
test_cases['pr']['critical'] = 50955 test_cases['pr']['critical'] = 50955
test_cases['pr']['one_to_one_chat'] = 50956 test_cases['pr']['one_to_one_chat'] = 50956
# test_cases['pr']['deep_links'] = 50967 test_cases['pr']['deep_links'] = 51535
test_cases['pr']['group_chat'] = 50964 test_cases['pr']['group_chat'] = 50964
test_cases['pr']['community_single'] = 50983 test_cases['pr']['community_single'] = 50983
test_cases['pr']['community_multiple'] = 50982 test_cases['pr']['community_multiple'] = 50982

View File

@ -0,0 +1,123 @@
import pytest
from tests import marks
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
from views.sign_in_view import SignInView
@pytest.mark.xdist_group(name="new_one_1")
@marks.new_ui_critical
class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase):
def prepare_devices(self):
self.drivers, self.loop = create_shared_drivers(1)
self.driver = self.drivers[0]
self.sign_in = SignInView(self.driver)
self.username = 'test user'
self.home = self.sign_in.create_user(username=self.username)
self.home.communities_tab.click_until_presence_of_element(self.home.plus_community_button)
self.community_name = "open community"
self.channel_name = "general"
self.community = self.home.create_community(community_type="open")
self.profile_view = self.home.get_profile_view()
self.browser_view = self.home.get_dapp_view()
self.home.get_chat(self.community_name, community=True).click()
self.community_view = self.home.get_community_view()
self.channel = self.community_view.get_channel(self.channel_name).click()
@marks.testrail_id(704613)
def test_links_open_universal_links_from_chat(self):
profile_urls = [
"https://status.app/u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj",
"https://status.app/u#zQ3shVVxZMwLVEQvuu1KF6h4D2mzVyCC4F4mHLZm5dz5XU1aa"]
for url in profile_urls:
self.channel.send_message(url)
self.channel.chat_element_by_text(url).click_on_link_inside_message_body()
if not self.channel.profile_add_to_contacts_button.is_element_displayed(
10) or not self.profile_view.default_username_text.text.endswith(url[-6:]):
self.errors.append("Profile was not opened by the profile url %s" % url)
self.home.navigate_back_to_chat_view()
closed_community_urls = [
"https://status.app/c/G8EAAGTiXKuwNbVVAu0GNLD-XzX4oz_E8oC1-7qSLikaTnCuG9Ag13ZgQKrMd8En9Qcpuaj3Qx3mfZ1atZzH8Zw-x_sFJ_MDv0P_7YfqoV-pNr3V4dsza-jVk41GaCGWasJb92Oer8qggaoNWf0tYCgSH19VonXciKPUz3ITdgke#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK",
"https://status.app/c/Ow==#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK"
"https://status.app/c#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK",
]
for url in closed_community_urls:
self.channel.send_message(url)
self.channel.chat_element_by_text(url).click_on_link_inside_message_body()
if not self.channel.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
self.errors.append("Closed community was not requested to join by the url %s" % url)
self.home.jump_to_card_by_text(self.community_name)
self.errors.verify_no_errors()
@marks.testrail_id(702775)
def test_links_deep_links(self):
self.home.navigate_back_to_home_view()
self.home.browser_tab.click()
profile_links = {
"status-app://u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj": None,
"status-app://u#zQ3shVVxZMwLVEQvuu1KF6h4D2mzVyCC4F4mHLZm5dz5XU1aa": None,
"status-app://u/Ow==#zQ3shsKnV5HJMWJR61c6dssWzHszdbLfBoMF1gcLtSQAYdw2d": "Restored desktop"
}
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
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:
self.errors.append("Profile was not opened by the profile deep link %s" % link)
self.browser_view.click_system_back_button()
community_links = [
"status-app://c/G8EAAGTiXKuwNbVVAu0GNLD-XzX4oz_E8oC1-7qSLikaTnCuG9Ag13ZgQKrMd8En9Qcpuaj3Qx3mfZ1atZzH8Zw-x_sFJ_MDv0P_7YfqoV-pNr3V4dsza-jVk41GaCGWasJb92Oer8qggaoNWf0tYCgSH19VonXciKPUz3ITdgke#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK",
"status-app://c/Ow==#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK",
"status-app://c#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK"
]
for link in community_links:
self.browser_view.open_url(link)
if not self.channel.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
self.errors.append("Closed community was not requested to join by the deep link %s" % link)
self.home.navigate_back_to_home_view()
self.home.browser_tab.click()
self.errors.verify_no_errors()
@marks.testrail_id(704614)
def test_links_open_universal_links_from_other_apps(self):
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)
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.sign_in.sign_in()
if not self.home.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
self.errors.append("Closed community was not requested to join by the url %s" % community_url)
self.home.just_fyi("Opening a community channel URL from google search bar with no account created")
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.sign_in.create_user()
if not self.home.element_by_translation_id(
"community-admins-will-review-your-request").is_element_displayed(10):
self.errors.append("Created user was not redirected to a community channel by the url %s" % channel_url)
self.errors.verify_no_errors()

View File

@ -98,6 +98,10 @@ class BrowserTab(TabButton):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="browser-stack-tab") super().__init__(driver, accessibility_id="browser-stack-tab")
def navigate(self):
from views.dapps_view import DappsView
return DappsView(self.driver)
class DappTabButton(TabButton): class DappTabButton(TabButton):
def __init__(self, driver): def __init__(self, driver):
@ -837,3 +841,10 @@ class BaseView(object):
except TimeoutException: except TimeoutException:
raise TimeoutException( raise TimeoutException(
"Device %s: expected element is not stale after %s seconds" % (self.driver.number, seconds)) from None "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):
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()
Button(self.driver, xpath="//*[@resource-id='android:id/button_once']").click()