2023-11-28 11:02:40 +00:00
|
|
|
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")
|
2024-07-12 16:29:44 +00:00
|
|
|
@marks.nightly
|
2023-11-28 11:02:40 +00:00
|
|
|
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):
|
2023-12-20 17:16:15 +00:00
|
|
|
profile_urls = {
|
|
|
|
"https://status.app/u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj": "zQ3...arJQSj",
|
|
|
|
"https://status.app/u#zQ3shVVxZMwLVEQvuu1KF6h4D2mzVyCC4F4mHLZm5dz5XU1aa": "zQ3...5XU1aa",
|
|
|
|
"https://status.app/u/CweACg0KC1Rlc3RVc2VyRTJFAw==#zQ3shcFXYnGXxJZnsMThziUNMwyA5uGLp58bLGmfb3qaWD1F6": "TestUserE2E"}
|
2023-11-28 11:02:40 +00:00
|
|
|
|
2023-12-20 17:16:15 +00:00
|
|
|
for url, text in profile_urls.items():
|
2024-02-09 12:53:35 +00:00
|
|
|
self.channel.just_fyi("Opening profile '%s' by the url %s" % (text, url))
|
2023-12-20 03:25:09 +00:00
|
|
|
self.channel.chat_message_input.clear()
|
2023-11-28 11:02:40 +00:00
|
|
|
self.channel.send_message(url)
|
|
|
|
self.channel.chat_element_by_text(url).click_on_link_inside_message_body()
|
2024-03-19 17:57:58 +00:00
|
|
|
if self.channel.profile_send_contact_request_button.is_element_displayed(10):
|
|
|
|
# username_text = self.profile_view.default_username_text.text
|
|
|
|
username_text = self.profile_view.contact_name_text.text
|
2023-12-20 17:16:15 +00:00
|
|
|
if not (username_text.endswith(url[-6:]) or username_text == text):
|
|
|
|
self.errors.append("Incorrect username is shown for profile url %s" % url)
|
|
|
|
else:
|
2023-11-28 11:02:40 +00:00
|
|
|
self.errors.append("Profile was not opened by the profile url %s" % url)
|
2024-03-19 17:57:58 +00:00
|
|
|
self.profile_view.close_button.click()
|
2023-11-28 11:02:40 +00:00
|
|
|
|
2024-06-19 16:44:01 +00:00
|
|
|
community_urls = {
|
|
|
|
"https://status.app/c/G0IAAGS9TbI9SrSPbDPplfBUeBBOIWhFRhGIKVlxntAg5CSvsJw4jurb636UKo7Lm2gTUS_M#zQ3shm7cS2MX6K1iinjNhiw88g1WH6fbE8rvnMHBq4RhznkWc":
|
|
|
|
"token-gated community e2e",
|
2024-07-01 14:15:03 +00:00
|
|
|
"https://status.app/c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3shZU9PNP6QHwEmqoh5mQqjCMDsfZYnpY4BEC8hom7KoNEz":
|
|
|
|
"open community",
|
|
|
|
"https://status.app/c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shTK1zXmLq2yZWMij65j1LNtmvuG6x71Nmg2fwtKs32wHj":
|
|
|
|
"closed community"
|
2024-01-25 18:00:39 +00:00
|
|
|
}
|
2024-06-19 16:44:01 +00:00
|
|
|
for url, text in community_urls.items():
|
2024-02-09 12:53:35 +00:00
|
|
|
self.channel.just_fyi("Opening community '%s' by the url %s" % (text, url))
|
2023-12-20 03:25:09 +00:00
|
|
|
self.channel.chat_message_input.clear()
|
2023-11-28 11:02:40 +00:00
|
|
|
self.channel.send_message(url)
|
|
|
|
self.channel.chat_element_by_text(url).click_on_link_inside_message_body()
|
2024-04-23 13:52:14 +00:00
|
|
|
if not (self.community_view.join_button.is_element_displayed(10)
|
|
|
|
or self.community_view.join_community_button.is_element_displayed(5)) \
|
|
|
|
or self.community_view.community_title.text != text:
|
2024-02-05 14:08:01 +00:00
|
|
|
self.errors.append("Community '%s' was not requested to join by the url %s" % (text, url))
|
2024-05-22 16:19:15 +00:00
|
|
|
if text != "Closed community": # the last one
|
|
|
|
self.home.navigate_back_to_home_view()
|
|
|
|
self.home.get_to_community_channel_from_home(self.community_name)
|
2023-11-28 11:02:40 +00:00
|
|
|
|
|
|
|
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,
|
2023-12-20 17:16:15 +00:00
|
|
|
"status-app://u/Ow==#zQ3shsKnV5HJMWJR61c6dssWzHszdbLfBoMF1gcLtSQAYdw2d": "Restored desktop",
|
|
|
|
"status-app://u/CweACg0KC1Rlc3RVc2VyRTJFAw==#zQ3shcFXYnGXxJZnsMThziUNMwyA5uGLp58bLGmfb3qaWD1F6": "TestUserE2E"
|
2023-11-28 11:02:40 +00:00
|
|
|
}
|
|
|
|
for link, text in profile_links.items():
|
2024-02-09 12:53:35 +00:00
|
|
|
self.channel.just_fyi("Opening profile link %s" % link)
|
2023-11-28 11:02:40 +00:00
|
|
|
self.browser_view.open_url(link)
|
2024-03-19 17:57:58 +00:00
|
|
|
# shown_name_text = self.profile_view.default_username_text.text
|
|
|
|
shown_name_text = self.profile_view.contact_name_text.text
|
2023-11-28 11:02:40 +00:00
|
|
|
if text:
|
2023-12-20 17:16:15 +00:00
|
|
|
name_is_shown = shown_name_text == text or shown_name_text.endswith(link[-6:])
|
2023-11-28 11:02:40 +00:00
|
|
|
else:
|
2023-12-20 17:16:15 +00:00
|
|
|
name_is_shown = shown_name_text.endswith(link[-6:])
|
2024-03-19 17:57:58 +00:00
|
|
|
if not self.channel.profile_send_contact_request_button.is_element_displayed(10) or not name_is_shown:
|
2023-11-28 11:02:40 +00:00
|
|
|
self.errors.append("Profile was not opened by the profile deep link %s" % link)
|
|
|
|
self.browser_view.click_system_back_button()
|
|
|
|
|
2024-01-25 18:00:39 +00:00
|
|
|
community_links = {
|
2024-06-19 16:44:01 +00:00
|
|
|
"status.app://c/G0IAAGS9TbI9SrSPbDPplfBUeBBOIWhFRhGIKVlxntAg5CSvsJw4jurb636UKo7Lm2gTUS_M#zQ3shm7cS2MX6K1iinjNhiw88g1WH6fbE8rvnMHBq4RhznkWc":
|
|
|
|
"token-gated community e2e",
|
2024-07-01 14:15:03 +00:00
|
|
|
"status.app://c/G0UAAMTyNsn2QZDEG0EXftOl8pOEfwEBOOSA_YTfIk85xmADDgINGmxpUHAXzK36bN0fK42Xf4YD2yjPk1z2pbFwFw==#zQ3shZU9PNP6QHwEmqoh5mQqjCMDsfZYnpY4BEC8hom7KoNEz":
|
|
|
|
"open community",
|
|
|
|
"status.app://c/G00AAGS9TbI9mSR-ZNmFrhRjNuEeXAAbcAIUaLLJyjMOG3ACJQ12oIHD78QhzO9s_T5bUeU7rnATWJg3mGgTUemrAg==#zQ3shTK1zXmLq2yZWMij65j1LNtmvuG6x71Nmg2fwtKs32wHj":
|
|
|
|
"closed community"
|
2024-01-25 18:00:39 +00:00
|
|
|
}
|
|
|
|
for link, text in community_links.items():
|
2024-02-09 12:53:35 +00:00
|
|
|
self.channel.just_fyi("Opening community '%s' by the link %s" % (text, link))
|
2023-11-28 11:02:40 +00:00
|
|
|
self.browser_view.open_url(link)
|
2024-04-23 13:52:14 +00:00
|
|
|
if not (self.community_view.join_button.is_element_displayed(10)
|
|
|
|
or self.community_view.join_community_button.is_element_displayed(5)) \
|
|
|
|
or self.community_view.community_title.text != text:
|
2024-02-05 14:08:01 +00:00
|
|
|
self.errors.append("Community '%s' was not requested to join by the deep link %s" % (text, link))
|
2023-11-28 11:02:40 +00:00
|
|
|
self.home.navigate_back_to_home_view()
|
|
|
|
self.home.browser_tab.click()
|
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
|
|
@marks.testrail_id(704614)
|
2023-12-08 15:47:54 +00:00
|
|
|
@marks.skip # ToDo: the feature is not ready yet
|
2023-11-28 11:02:40 +00:00
|
|
|
def test_links_open_universal_links_from_other_apps(self):
|
2023-11-29 16:03:07 +00:00
|
|
|
app_package = self.driver.current_package
|
2023-11-28 11:02:40 +00:00
|
|
|
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()
|
2023-11-29 16:03:07 +00:00
|
|
|
self.home.open_link_from_google_search_app(profile_url, app_package)
|
2023-11-28 11:02:40 +00:00
|
|
|
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")
|
|
|
|
self.driver.terminate_app(app_package)
|
|
|
|
community_url = "https://status.app/c/Ow==#zQ3shbmfT3hvh4mKa1v6uAjjyztQEroh8Mfn6Ckegjd7LT3XK"
|
2023-11-29 16:03:07 +00:00
|
|
|
self.home.open_link_from_google_search_app(community_url, app_package)
|
2023-11-28 11:02:40 +00:00
|
|
|
self.sign_in.sign_in()
|
2024-03-26 11:56:39 +00:00
|
|
|
if not self.community_view.join_button.is_element_displayed(10):
|
2023-11-28 11:02:40 +00:00
|
|
|
self.errors.append("Closed community was not requested to join by the url %s" % community_url)
|
|
|
|
|
2023-12-05 16:59:08 +00:00
|
|
|
# ToDo: enable when https://github.com/status-im/status-mobile/issues/18074 is fixed
|
|
|
|
# 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, 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):
|
|
|
|
# self.errors.append("Created user was not redirected to a community channel by the url %s" % channel_url)
|
2023-11-28 11:02:40 +00:00
|
|
|
|
|
|
|
self.errors.verify_no_errors()
|