e2e refactoring: added test_deeplink_chat_profile medium group
This commit is contained in:
parent
39e3a82228
commit
5e9738bb7d
|
@ -120,6 +120,9 @@ class TestrailReport(BaseTestReport):
|
||||||
test_cases['nightly']['chat'] = 50811
|
test_cases['nightly']['chat'] = 50811
|
||||||
test_cases['nightly']['browser'] = 50826
|
test_cases['nightly']['browser'] = 50826
|
||||||
test_cases['nightly']['profile'] = 50828
|
test_cases['nightly']['profile'] = 50828
|
||||||
|
test_cases['nightly']['deep_link'] = 50836
|
||||||
|
test_cases['nightly']['share_profile'] = 50837
|
||||||
|
test_cases['nightly']['chat_2'] = 50838
|
||||||
## Upgrade e2e
|
## Upgrade e2e
|
||||||
test_cases['upgrade']['general'] = 881
|
test_cases['upgrade']['general'] = 881
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,346 @@
|
||||||
|
import re
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from tests import marks, mailserver_ams, mailserver_gc, mailserver_hk, used_fleet, common_password, test_dapp_name,\
|
||||||
|
test_dapp_url, pair_code, unique_password
|
||||||
|
from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase
|
||||||
|
from tests.users import user_mainnet, chat_users, dummy_user, recovery_users, transaction_senders, basic_user,\
|
||||||
|
wallet_users, ens_user_ropsten, ens_user
|
||||||
|
from selenium.common.exceptions import NoSuchElementException
|
||||||
|
|
||||||
|
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||||
|
from views.send_transaction_view import SendTransactionView
|
||||||
|
from views.chat_view import ChatView
|
||||||
|
from views.sign_in_view import SignInView
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.xdist_group(name="deeplink_chat_profile_medium_1")
|
||||||
|
@marks.medium
|
||||||
|
class TestDeeplinkChatProfileOneDevice(MultipleSharedDeviceTestCase):
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setup_class(cls):
|
||||||
|
cls.drivers, cls.loop = create_shared_drivers(1)
|
||||||
|
cls.sign_in = SignInView(cls.drivers[0])
|
||||||
|
cls.home = cls.sign_in.create_user()
|
||||||
|
cls.public_key, cls.default_username = cls.home.get_public_key_and_username(return_username=True)
|
||||||
|
cls.home.home_button.click()
|
||||||
|
cls.public_chat_name = 'pubchat'
|
||||||
|
cls.nickname = 'dummy_user'
|
||||||
|
cls.search_list_1 = {
|
||||||
|
basic_user['username']: basic_user['username'],
|
||||||
|
ens_user_ropsten['username']: ens_user_ropsten['ens'],
|
||||||
|
cls.public_chat_name: cls.public_chat_name,
|
||||||
|
cls.nickname: cls.nickname,
|
||||||
|
dummy_user['username']: cls.nickname,
|
||||||
|
ens_user_ropsten['ens']: ens_user_ropsten['ens']
|
||||||
|
}
|
||||||
|
cls.public_chat = cls.home.join_public_chat(cls.public_chat_name)
|
||||||
|
cls.public_chat.get_back_to_home_view()
|
||||||
|
|
||||||
|
@marks.testrail_id(702244)
|
||||||
|
def test_deep_link_with_invalid_user_public_key_own_profile_key(self):
|
||||||
|
self.drivers[0].close_app()
|
||||||
|
|
||||||
|
self.sign_in.just_fyi('Check that no error when opening invalid deep link')
|
||||||
|
deep_link = 'status-im://u/%s' % self.public_key[:-10]
|
||||||
|
self.sign_in.open_weblink_and_login(deep_link)
|
||||||
|
self.home = self.sign_in.get_home_view()
|
||||||
|
self.home.plus_button.click_until_presence_of_element(self.home.start_new_chat_button)
|
||||||
|
if not self.home.start_new_chat_button.is_element_present():
|
||||||
|
self.errors.append(
|
||||||
|
"Can't navigate to start new chat after app opened from deep link with invalid public key")
|
||||||
|
self.drivers[0].close_app()
|
||||||
|
|
||||||
|
self.sign_in.just_fyi('Check that no error when opening own valid deep link')
|
||||||
|
deep_link = 'status-im://u/%s' % self.public_key
|
||||||
|
self.sign_in.open_weblink_and_login(deep_link)
|
||||||
|
from views.profile_view import ProfileView
|
||||||
|
profile = ProfileView(self.drivers)
|
||||||
|
if not profile.default_username_text != self.default_username:
|
||||||
|
self.errors.append("Can't navigate to profile from deep link with own public key")
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702245)
|
||||||
|
def test_deep_link_open_user_profile(self):
|
||||||
|
for user_ident in ens_user['ens'], ens_user['ens_another'], ens_user['public_key']:
|
||||||
|
self.drivers[0].close_app()
|
||||||
|
deep_link = 'status-im://u/%s' % user_ident
|
||||||
|
self.sign_in.open_weblink_and_login(deep_link)
|
||||||
|
chat = self.sign_in.get_chat_view()
|
||||||
|
for text in ens_user['username'], self.sign_in.get_translation_by_key("add-to-contacts"):
|
||||||
|
if not chat.element_by_text(text).scroll_to_element(10):
|
||||||
|
self.driver.fail("User profile screen is not opened")
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702246)
|
||||||
|
def test_deep_link_open_dapp(self):
|
||||||
|
self.drivers[0].close_app()
|
||||||
|
dapp_name = test_dapp_url
|
||||||
|
dapp_deep_link = 'status-im://b/%s' % dapp_name
|
||||||
|
self.sign_in.open_weblink_and_login(dapp_deep_link)
|
||||||
|
web_view = self.sign_in.get_chat_view()
|
||||||
|
try:
|
||||||
|
test_dapp_view = web_view.open_in_status_button.click()
|
||||||
|
test_dapp_view.allow_button.is_element_present()
|
||||||
|
except NoSuchElementException:
|
||||||
|
self.drivers[0].fail("DApp '%s' is not opened!" % dapp_name)
|
||||||
|
self.home.reopen_app()
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702247)
|
||||||
|
def test_share_user_profile_url_one_to_one_chat(self):
|
||||||
|
self.home.home_button.click()
|
||||||
|
|
||||||
|
self.home.just_fyi('Join to one-to-one chat and share link to other user profile via messenger')
|
||||||
|
chat = self.home.add_contact(dummy_user["public_key"])
|
||||||
|
chat.chat_options.click()
|
||||||
|
chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts)
|
||||||
|
chat.profile_details.click()
|
||||||
|
chat.share_button.click()
|
||||||
|
chat.share_via_messenger()
|
||||||
|
if not chat.element_by_text_part(
|
||||||
|
'https://join.status.im/u/%s' % dummy_user["public_key"]).is_element_present():
|
||||||
|
self.errors.append("Can't share public key of contact")
|
||||||
|
for _ in range(2):
|
||||||
|
chat.click_system_back_button()
|
||||||
|
|
||||||
|
@marks.testrail_id(702252)
|
||||||
|
def test_share_user_profile_url_public_chat(self):
|
||||||
|
|
||||||
|
self.home.just_fyi('Join to public chat and share link to it via messenger')
|
||||||
|
self.home.home_button.click()
|
||||||
|
|
||||||
|
self.home.get_chat('#' + self.public_chat_name).click()
|
||||||
|
self.public_chat.chat_options.click()
|
||||||
|
self.public_chat.share_chat_button.click()
|
||||||
|
self.public_chat.share_via_messenger()
|
||||||
|
if not self.public_chat.element_by_text_part('https://join.status.im/%s' % self.public_chat_name).is_element_present():
|
||||||
|
self.errors.append("Can't share link to public chat")
|
||||||
|
for _ in range(2):
|
||||||
|
self.public_chat.click_system_back_button()
|
||||||
|
self.public_chat.get_back_to_home_view()
|
||||||
|
|
||||||
|
@marks.testrail_id(702251)
|
||||||
|
def test_share_user_profile_url_browser(self):
|
||||||
|
|
||||||
|
self.home.just_fyi('Open URL and share link to it via messenger')
|
||||||
|
daap = self.home.dapp_tab_button.click()
|
||||||
|
browser = daap.open_url('dap.ps')
|
||||||
|
browser.options_button.click()
|
||||||
|
browser.share_url_button.click()
|
||||||
|
browser.share_via_messenger()
|
||||||
|
expeceted_text_1 = 'https://join.status.im/b/https://dap.ps'
|
||||||
|
expeceted_text_2 = 'https://join.status.im/b/http://dap.ps'
|
||||||
|
|
||||||
|
if not (browser.element_by_text_part(expeceted_text_1).is_element_present() or
|
||||||
|
browser.element_by_text_part(expeceted_text_2).is_element_present()):
|
||||||
|
self.errors.append("Can't share link to URL")
|
||||||
|
|
||||||
|
browser.click_system_back_button(1)
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702248)
|
||||||
|
def test_chat_can_start_and_find_from_suggestions_using_search(self):
|
||||||
|
|
||||||
|
self.home.home_button.click()
|
||||||
|
self.home.just_fyi('Start 1-1 with username and with ENS')
|
||||||
|
|
||||||
|
for public_key in (basic_user['public_key'], dummy_user['public_key']):
|
||||||
|
chat = self.home.add_contact(public_key)
|
||||||
|
chat.get_back_to_home_view()
|
||||||
|
profile = self.home.profile_button.click()
|
||||||
|
profile.open_contact_from_profile(dummy_user['username'])
|
||||||
|
self.public_chat.set_nickname(self.nickname)
|
||||||
|
self.public_chat.home_button.click()
|
||||||
|
|
||||||
|
ens_name_status, ens_name_another_domain, public_chat_name = ens_user_ropsten['ens'], \
|
||||||
|
ens_user['ens_another'], 'some-pub-chat'
|
||||||
|
search_list_2 = {
|
||||||
|
ens_name_status: {
|
||||||
|
'home': {
|
||||||
|
'Start a new private chat',
|
||||||
|
'Join a public chat',
|
||||||
|
'%s.stateofus.eth' % ens_name_status,
|
||||||
|
'#%s' % ens_name_status
|
||||||
|
},
|
||||||
|
'navigate_to': '%s.stateofus.eth' % ens_name_status,
|
||||||
|
'chat': {
|
||||||
|
chat.add_to_contacts,
|
||||||
|
chat.element_by_text('@%s' % ens_name_status),
|
||||||
|
chat.chat_message_input
|
||||||
|
}
|
||||||
|
},
|
||||||
|
ens_name_another_domain: {
|
||||||
|
'home': {
|
||||||
|
'Start a new private chat',
|
||||||
|
},
|
||||||
|
'home_not_shown': 'Join a public chat',
|
||||||
|
'navigate_to': 'Start a new private chat',
|
||||||
|
'chat': {
|
||||||
|
chat.add_to_contacts,
|
||||||
|
chat.element_by_text('@%s' % ens_name_another_domain),
|
||||||
|
chat.chat_message_input
|
||||||
|
},
|
||||||
|
},
|
||||||
|
public_chat_name: {
|
||||||
|
'home': {
|
||||||
|
'Join a public chat',
|
||||||
|
},
|
||||||
|
'home_not_shown': 'Start a new private chat',
|
||||||
|
'navigate_to': '#%s' % public_chat_name,
|
||||||
|
'chat': {
|
||||||
|
chat.element_by_text('#%s' % public_chat_name),
|
||||||
|
chat.chat_message_input
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
self.home.swipe_down()
|
||||||
|
|
||||||
|
for keyword in search_list_2:
|
||||||
|
self.home.just_fyi('Can start chat from searching for %s' % keyword)
|
||||||
|
self.home.search_by_keyword(keyword)
|
||||||
|
if not self.home.element_by_text_part('No search results. Do you mean').is_element_displayed():
|
||||||
|
self.errors.append('"No search results" is not shown')
|
||||||
|
if 'home_not_shown' in search_list_2[keyword]:
|
||||||
|
if self.home.element_by_text(search_list_2[keyword]['home_not_shown']).is_element_displayed():
|
||||||
|
self.errors.append('%s is shown on home view while searching for %s' % (
|
||||||
|
search_list_2[keyword]['home_not_shown'], keyword))
|
||||||
|
for text in search_list_2[keyword]['home']:
|
||||||
|
if not self.home.element_by_text(text).is_element_displayed():
|
||||||
|
self.errors.append('%s is not shown on home view while searching for %s' % (text, keyword))
|
||||||
|
self.home.element_by_text(search_list_2[keyword]['navigate_to']).click()
|
||||||
|
for element in search_list_2[keyword]['chat']:
|
||||||
|
if not element.is_element_displayed():
|
||||||
|
self.errors.append(
|
||||||
|
'Requested %s element is not shown on chat view after navigating from suggestion '
|
||||||
|
'for %s' % (element.name, keyword))
|
||||||
|
self.home.back_button.click()
|
||||||
|
|
||||||
|
self.home.just_fyi('Can search for public chat name, ens name, username')
|
||||||
|
self.home.swipe_down()
|
||||||
|
for keyword in self.search_list_1:
|
||||||
|
self.home.search_by_keyword(keyword)
|
||||||
|
search_results = self.home.chat_name_text.find_elements()
|
||||||
|
if not search_results:
|
||||||
|
self.errors.append('No search results after searching by %s keyword' % keyword)
|
||||||
|
for element in search_results:
|
||||||
|
if self.search_list_1[keyword] not in element.text:
|
||||||
|
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
|
||||||
|
(element.text, keyword))
|
||||||
|
self.home.cancel_button.click()
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702253)
|
||||||
|
def test_chat_no_suggestions_invalid_data_search(self):
|
||||||
|
self.home.just_fyi('No suggestion at attempt to search for invalid data')
|
||||||
|
invalid_data = [' ', 'ab;', '.6', '@ana']
|
||||||
|
for text in invalid_data:
|
||||||
|
self.home.search_by_keyword(text)
|
||||||
|
if self.home.element_by_text_part('No search results. Do you mean').is_element_displayed():
|
||||||
|
self.errors.append('"No search results" is shown when searching for invalid value %s' % text)
|
||||||
|
self.home.cancel_button.click()
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702249)
|
||||||
|
def test_chat_input_delete_cut_and_paste_messages(self):
|
||||||
|
|
||||||
|
chat = self.home.add_contact(transaction_senders['N']['public_key'])
|
||||||
|
|
||||||
|
message_text = 'test'
|
||||||
|
message_input = chat.chat_message_input
|
||||||
|
message_input.send_keys(message_text)
|
||||||
|
|
||||||
|
self.home.just_fyi('Deleting last 2 symbols in initial message')
|
||||||
|
message_input.delete_last_symbols(2)
|
||||||
|
current_text = message_input.text
|
||||||
|
if current_text != message_text[:-2]:
|
||||||
|
self.errors.append("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-2]))
|
||||||
|
|
||||||
|
"""self.home.just_fyi('Cutting message text from input field')
|
||||||
|
message_input.cut_text()
|
||||||
|
message_input.click()
|
||||||
|
if current_text != message_text[:-4]:
|
||||||
|
self.errors.append("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-4]))"""
|
||||||
|
|
||||||
|
message_input.cut_text()
|
||||||
|
|
||||||
|
self.home.just_fyi('Pasting the cut message back to the input field')
|
||||||
|
message_input.paste_text_from_clipboard()
|
||||||
|
if current_text != message_text[:-2]:
|
||||||
|
self.errors.append("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-2]))
|
||||||
|
|
||||||
|
chat.send_message_button.click()
|
||||||
|
|
||||||
|
chat.chat_element_by_text(message_text[:-2]).wait_for_visibility_of_element(2)
|
||||||
|
chat.get_back_to_home_view()
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702250)
|
||||||
|
def test_chat_public_clear_history_via_options_and_long_press(self):
|
||||||
|
|
||||||
|
public_long_press = '#public-clear-options'
|
||||||
|
options_chat_name = '#' + self.public_chat_name
|
||||||
|
message = 'test message'
|
||||||
|
|
||||||
|
long_press_chat = self.home.join_public_chat(public_long_press[1:])
|
||||||
|
[long_press_chat.send_message(message) for _ in range(2)]
|
||||||
|
self.home.home_button.double_click()
|
||||||
|
|
||||||
|
self.home.element_by_text(options_chat_name).scroll_to_element()
|
||||||
|
options_chat = self.home.get_chat(options_chat_name)
|
||||||
|
chat_view = options_chat.click()
|
||||||
|
[chat_view.send_message(message) for _ in range(2)]
|
||||||
|
self.home.home_button.double_click()
|
||||||
|
|
||||||
|
self.home.element_by_text(public_long_press).scroll_to_element(direction='up')
|
||||||
|
self.home.just_fyi('Clearing history via long press')
|
||||||
|
self.home.clear_chat_long_press(public_long_press)
|
||||||
|
|
||||||
|
self.home.just_fyi('Clearing history via options')
|
||||||
|
options_chat.click()
|
||||||
|
chat_view.clear_history()
|
||||||
|
if chat_view.element_by_text(message).is_element_displayed():
|
||||||
|
self.errors.append(
|
||||||
|
'Messages in %s chat are still shown after clearing history via options' % options_chat_name)
|
||||||
|
|
||||||
|
self.home.just_fyi("Recheck that history won't reappear after relogin")
|
||||||
|
self.home.relogin()
|
||||||
|
for chat_name in options_chat_name, public_long_press:
|
||||||
|
chat = self.home.get_chat(chat_name).click()
|
||||||
|
if chat.chat_element_by_text(message).is_element_displayed():
|
||||||
|
self.errors.append('Messages in %s chat are shown after clearing history and relaunch' % chat_name)
|
||||||
|
chat.home_button.click()
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
@marks.testrail_id(702254)
|
||||||
|
# Should be the last in group as it disables network connection
|
||||||
|
def test_chat_can_search_while_offline(self):
|
||||||
|
self.home.just_fyi('Can search for public chat while offline')
|
||||||
|
self.home.toggle_airplane_mode()
|
||||||
|
self.home.search_input.click()
|
||||||
|
self.home.search_input.send_keys(self.public_chat_name)
|
||||||
|
search_results = self.home.chat_name_text.find_elements()
|
||||||
|
if not search_results:
|
||||||
|
self.errors.append('No search results after searching by %s keyword' % self.public_chat_name)
|
||||||
|
for element in search_results:
|
||||||
|
if self.search_list_1[self.public_chat_name] not in element.text:
|
||||||
|
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
|
||||||
|
(element.text, self.public_chat_name))
|
||||||
|
|
||||||
|
self.errors.verify_no_errors()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,200 +16,6 @@ from views.sign_in_view import SignInView
|
||||||
|
|
||||||
@marks.medium
|
@marks.medium
|
||||||
class TestChatManagement(SingleDeviceTestCase):
|
class TestChatManagement(SingleDeviceTestCase):
|
||||||
@marks.testrail_id(5426)
|
|
||||||
# TODO: add to any group with history in public chat
|
|
||||||
def test_chat_public_clear_history_via_options_and_long_press(self):
|
|
||||||
home = SignInView(self.driver).create_user()
|
|
||||||
|
|
||||||
public_options, public_long_press = '#public-clear-options', '#public-long-options'
|
|
||||||
message = 'test message'
|
|
||||||
for pub_chat in [public_options[1:], public_long_press[1:]]:
|
|
||||||
chat = home.join_public_chat(pub_chat)
|
|
||||||
[chat.send_message(message) for _ in range(2)]
|
|
||||||
home.home_button.double_click()
|
|
||||||
|
|
||||||
home.just_fyi('Clearing history via long press')
|
|
||||||
home.clear_chat_long_press(public_long_press)
|
|
||||||
|
|
||||||
home.just_fyi('Clearing history via options')
|
|
||||||
chat = home.get_chat(public_options).click()
|
|
||||||
chat.clear_history()
|
|
||||||
if chat.element_by_text(message).is_element_displayed():
|
|
||||||
self.errors.append(
|
|
||||||
'Messages in %s chat are still shown after clearing history via options' % public_options)
|
|
||||||
|
|
||||||
home.just_fyi("Recheck that history won't reappear after relogin")
|
|
||||||
home.relogin()
|
|
||||||
for chat_name in public_options, public_long_press:
|
|
||||||
chat = home.get_chat(chat_name).click()
|
|
||||||
if chat.chat_element_by_text(message).is_element_displayed():
|
|
||||||
self.errors.append('Messages in %s chat are shown after clearing history and relaunch' % chat_name)
|
|
||||||
chat.home_button.click()
|
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
|
||||||
|
|
||||||
@marks.testrail_id(6320)
|
|
||||||
# TODO: to unite it with 5757
|
|
||||||
def test_chat_can_start_from_suggestions_using_search(self):
|
|
||||||
sign_in = SignInView(self.driver)
|
|
||||||
home = sign_in.create_user()
|
|
||||||
chat = ChatView(self.driver)
|
|
||||||
ens_name_status, ens_name_another_domain, public_chat_name = ens_user_ropsten['ens'], \
|
|
||||||
ens_user['ens_another'], 'some-pub-chat'
|
|
||||||
search_list = {
|
|
||||||
ens_name_status: {
|
|
||||||
'home': {
|
|
||||||
'Start a new private chat',
|
|
||||||
'Join a public chat',
|
|
||||||
'%s.stateofus.eth' % ens_name_status,
|
|
||||||
'#%s' % ens_name_status
|
|
||||||
},
|
|
||||||
'navigate_to': '%s.stateofus.eth' % ens_name_status,
|
|
||||||
'chat': {
|
|
||||||
chat.add_to_contacts,
|
|
||||||
chat.element_by_text('@%s' % ens_name_status),
|
|
||||||
chat.chat_message_input
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ens_name_another_domain: {
|
|
||||||
'home': {
|
|
||||||
'Start a new private chat',
|
|
||||||
},
|
|
||||||
'home_not_shown': 'Join a public chat',
|
|
||||||
'navigate_to': 'Start a new private chat',
|
|
||||||
'chat': {
|
|
||||||
chat.add_to_contacts,
|
|
||||||
chat.element_by_text('@%s' % ens_name_another_domain),
|
|
||||||
chat.chat_message_input
|
|
||||||
},
|
|
||||||
},
|
|
||||||
public_chat_name: {
|
|
||||||
'home': {
|
|
||||||
'Join a public chat',
|
|
||||||
},
|
|
||||||
'home_not_shown': 'Start a new private chat',
|
|
||||||
'navigate_to': '#%s' % public_chat_name,
|
|
||||||
'chat': {
|
|
||||||
chat.element_by_text('#%s' % public_chat_name),
|
|
||||||
chat.chat_message_input
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
home.just_fyi('Join public chat to have search input on home view')
|
|
||||||
chat_name = home.get_random_chat_name()
|
|
||||||
public_chat = home.join_public_chat(chat_name)
|
|
||||||
public_chat.get_back_to_home_view()
|
|
||||||
home.swipe_down()
|
|
||||||
|
|
||||||
for keyword in search_list:
|
|
||||||
home.just_fyi('Can start chat from searching for %s' % keyword)
|
|
||||||
home.search_by_keyword(keyword)
|
|
||||||
if not home.element_by_text_part('No search results. Do you mean').is_element_displayed():
|
|
||||||
self.errors.append('"No search results" is not shown')
|
|
||||||
if 'home_not_shown' in search_list[keyword]:
|
|
||||||
if home.element_by_text(search_list[keyword]['home_not_shown']).is_element_displayed():
|
|
||||||
self.errors.append('%s is shown on home view while searching for %s' % (
|
|
||||||
search_list[keyword]['home_not_shown'], keyword))
|
|
||||||
for text in search_list[keyword]['home']:
|
|
||||||
if not home.element_by_text(text).is_element_displayed():
|
|
||||||
self.errors.append('%s is not shown on home view while searching for %s' % (text, keyword))
|
|
||||||
home.element_by_text(search_list[keyword]['navigate_to']).click()
|
|
||||||
for element in search_list[keyword]['chat']:
|
|
||||||
if not element.is_element_displayed():
|
|
||||||
self.errors.append(
|
|
||||||
'Requested %s element is not shown on chat view after navigating from suggestion '
|
|
||||||
'for %s' % (element.name, keyword))
|
|
||||||
home.back_button.click()
|
|
||||||
|
|
||||||
home.just_fyi('No suggestion at attempt to search for invalid data')
|
|
||||||
invalid_data = [' ', 'ab;', '.6', '@ana']
|
|
||||||
for text in invalid_data:
|
|
||||||
home.search_by_keyword(text)
|
|
||||||
if home.element_by_text_part('No search results. Do you mean').is_element_displayed():
|
|
||||||
self.errors.append('"No search results" is shown when searching for invalid value %s' % text)
|
|
||||||
home.cancel_button.click()
|
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
|
||||||
|
|
||||||
@marks.testrail_id(5757)
|
|
||||||
# TODO: to unite it with 6320 and cut the part about offline - to add it to the end of group for instance
|
|
||||||
def test_chat_search_on_home(self):
|
|
||||||
sign_in = SignInView(self.driver)
|
|
||||||
home = sign_in.create_user()
|
|
||||||
|
|
||||||
home.just_fyi('Join public chat, start 1-1 with username and with ENS')
|
|
||||||
chat_name = home.get_random_chat_name()
|
|
||||||
public_chat = home.join_public_chat(chat_name)
|
|
||||||
public_chat.get_back_to_home_view()
|
|
||||||
for public_key in (basic_user['public_key'], ens_user_ropsten['ens'], dummy_user['public_key']):
|
|
||||||
chat = home.add_contact(public_key)
|
|
||||||
chat.get_back_to_home_view()
|
|
||||||
profile = home.profile_button.click()
|
|
||||||
profile.open_contact_from_profile(dummy_user['username'])
|
|
||||||
nickname = 'dummy_user'
|
|
||||||
public_chat.set_nickname(nickname)
|
|
||||||
public_chat.home_button.click()
|
|
||||||
|
|
||||||
search_list = {
|
|
||||||
basic_user['username']: basic_user['username'],
|
|
||||||
ens_user_ropsten['username']: ens_user_ropsten['ens'],
|
|
||||||
chat_name: chat_name,
|
|
||||||
nickname: nickname,
|
|
||||||
dummy_user['username']: nickname,
|
|
||||||
ens_user_ropsten['ens']: ens_user_ropsten['ens']
|
|
||||||
}
|
|
||||||
|
|
||||||
home.just_fyi('Can search for public chat name, ens name, username')
|
|
||||||
home.swipe_down()
|
|
||||||
for keyword in search_list:
|
|
||||||
home.search_by_keyword(keyword)
|
|
||||||
search_results = home.chat_name_text.find_elements()
|
|
||||||
if not search_results:
|
|
||||||
self.errors.append('No search results after searching by %s keyword' % keyword)
|
|
||||||
for element in search_results:
|
|
||||||
if search_list[keyword] not in element.text:
|
|
||||||
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
|
|
||||||
(element.text, keyword))
|
|
||||||
home.cancel_button.click()
|
|
||||||
|
|
||||||
home.just_fyi('Can search for public chat while offline')
|
|
||||||
home.toggle_airplane_mode()
|
|
||||||
home.search_input.click()
|
|
||||||
home.search_input.send_keys(chat_name)
|
|
||||||
search_results = home.chat_name_text.find_elements()
|
|
||||||
if not search_results:
|
|
||||||
self.errors.append('No search results after searching by %s keyword' % chat_name)
|
|
||||||
for element in search_results:
|
|
||||||
if search_list[chat_name] not in element.text:
|
|
||||||
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
|
|
||||||
(element.text, chat_name))
|
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
|
||||||
|
|
||||||
@marks.testrail_id(5322)
|
|
||||||
# TODO: merge with other 1-driver medium e2e
|
|
||||||
def test_chat_input_delete_cut_and_paste_messages(self):
|
|
||||||
sign_in = SignInView(self.driver)
|
|
||||||
home = sign_in.create_user()
|
|
||||||
chat = home.add_contact(transaction_senders['N']['public_key'])
|
|
||||||
|
|
||||||
message_text = 'test'
|
|
||||||
message_input = chat.chat_message_input
|
|
||||||
message_input.send_keys(message_text)
|
|
||||||
|
|
||||||
message_input.delete_last_symbols(2)
|
|
||||||
current_text = message_input.text
|
|
||||||
if current_text != message_text[:-2]:
|
|
||||||
self.driver.fail("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-2]))
|
|
||||||
|
|
||||||
message_input.cut_text()
|
|
||||||
|
|
||||||
message_input.paste_text_from_clipboard()
|
|
||||||
chat.send_message_button.click()
|
|
||||||
|
|
||||||
chat.chat_element_by_text(message_text[:-2]).wait_for_visibility_of_element(2)
|
|
||||||
|
|
||||||
@marks.testrail_id(6221)
|
@marks.testrail_id(6221)
|
||||||
# TODO: delete? a lot of tests are already using this
|
# TODO: delete? a lot of tests are already using this
|
||||||
|
@ -249,108 +55,6 @@ class TestChatManagement(SingleDeviceTestCase):
|
||||||
if profile.element_by_text(basic_user["username"]).is_element_displayed():
|
if profile.element_by_text(basic_user["username"]).is_element_displayed():
|
||||||
self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
|
self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
|
||||||
|
|
||||||
@marks.testrail_id(5498)
|
|
||||||
# TODO: split into separate parts and include to group
|
|
||||||
def test_share_user_profile_url_public_chat(self):
|
|
||||||
home = SignInView(self.driver).create_user()
|
|
||||||
|
|
||||||
home.just_fyi('Join to one-to-one chat and share link to other user profile via messenger')
|
|
||||||
chat = home.add_contact(dummy_user["public_key"])
|
|
||||||
chat.chat_options.click()
|
|
||||||
chat.view_profile_button.click_until_presence_of_element(chat.remove_from_contacts)
|
|
||||||
chat.profile_details.click()
|
|
||||||
chat.share_button.click()
|
|
||||||
chat.share_via_messenger()
|
|
||||||
if not chat.element_by_text_part(
|
|
||||||
'https://join.status.im/u/%s' % dummy_user["public_key"]).is_element_present():
|
|
||||||
self.errors.append("Can't share public key of contact")
|
|
||||||
for _ in range(2):
|
|
||||||
chat.click_system_back_button()
|
|
||||||
|
|
||||||
home.just_fyi('Join to public chat and share link to it via messenger')
|
|
||||||
chat.get_back_to_home_view()
|
|
||||||
public_chat_name = 'pubchat'
|
|
||||||
public_chat = home.join_public_chat(public_chat_name)
|
|
||||||
public_chat.chat_options.click()
|
|
||||||
public_chat.share_chat_button.click()
|
|
||||||
public_chat.share_via_messenger()
|
|
||||||
if not chat.element_by_text_part('https://join.status.im/%s' % public_chat_name).is_element_present():
|
|
||||||
self.errors.append("Can't share link to public chat")
|
|
||||||
for _ in range(2):
|
|
||||||
chat.click_system_back_button()
|
|
||||||
chat.get_back_to_home_view()
|
|
||||||
|
|
||||||
home.just_fyi('Open URL and share link to it via messenger')
|
|
||||||
daap = home.dapp_tab_button.click()
|
|
||||||
browser = daap.open_url('dap.ps')
|
|
||||||
browser.options_button.click()
|
|
||||||
browser.share_url_button.click()
|
|
||||||
browser.share_via_messenger()
|
|
||||||
expeceted_text_1 = 'https://join.status.im/b/https://dap.ps'
|
|
||||||
expeceted_text_2 = 'https://join.status.im/b/http://dap.ps'
|
|
||||||
|
|
||||||
if not (chat.element_by_text_part(expeceted_text_1).is_element_present() or
|
|
||||||
chat.element_by_text_part(expeceted_text_2).is_element_present()):
|
|
||||||
self.errors.append("Can't share link to URL")
|
|
||||||
|
|
||||||
self.errors.verify_no_errors()
|
|
||||||
|
|
||||||
@marks.testrail_id(5441)
|
|
||||||
# TODO: merge with other 1-driver medium e2e
|
|
||||||
def test_deep_link_open_user_profile(self):
|
|
||||||
sign_in = SignInView(self.driver)
|
|
||||||
sign_in.create_user()
|
|
||||||
for user_ident in ens_user['ens'], ens_user['ens_another'], ens_user['public_key']:
|
|
||||||
self.driver.close_app()
|
|
||||||
deep_link = 'status-im://u/%s' % user_ident
|
|
||||||
sign_in.open_weblink_and_login(deep_link)
|
|
||||||
chat = sign_in.get_chat_view()
|
|
||||||
for text in ens_user['username'], sign_in.get_translation_by_key("add-to-contacts"):
|
|
||||||
if not chat.element_by_text(text).scroll_to_element(10):
|
|
||||||
self.driver.fail("User profile screen is not opened")
|
|
||||||
|
|
||||||
@marks.testrail_id(5442)
|
|
||||||
# TODO: merge with other 1-driver medium e2e
|
|
||||||
def test_deep_link_open_dapp(self):
|
|
||||||
sign_in_view = SignInView(self.driver)
|
|
||||||
sign_in_view.create_user()
|
|
||||||
self.driver.close_app()
|
|
||||||
dapp_name = test_dapp_url
|
|
||||||
dapp_deep_link = 'status-im://b/%s' % dapp_name
|
|
||||||
sign_in_view.open_weblink_and_login(dapp_deep_link)
|
|
||||||
web_view = sign_in_view.get_chat_view()
|
|
||||||
try:
|
|
||||||
test_dapp_view = web_view.open_in_status_button.click()
|
|
||||||
test_dapp_view.allow_button.is_element_present()
|
|
||||||
except NoSuchElementException:
|
|
||||||
self.driver.fail("DApp '%s' is not opened!" % dapp_name)
|
|
||||||
|
|
||||||
@marks.testrail_id(5781)
|
|
||||||
# TODO: merge with other 1-driver medium e2e
|
|
||||||
def test_deep_link_with_invalid_user_public_key_own_profile_key(self):
|
|
||||||
sign_in = SignInView(self.driver)
|
|
||||||
sign_in.recover_access(passphrase=basic_user['passphrase'])
|
|
||||||
self.driver.close_app()
|
|
||||||
|
|
||||||
sign_in.just_fyi('Check that no error when opening invalid deep link')
|
|
||||||
deep_link = 'status-im://u/%s' % basic_user['public_key'][:-10]
|
|
||||||
sign_in.open_weblink_and_login(deep_link)
|
|
||||||
home = sign_in.get_home_view()
|
|
||||||
home.plus_button.click_until_presence_of_element(home.start_new_chat_button)
|
|
||||||
if not home.start_new_chat_button.is_element_present():
|
|
||||||
self.errors.append(
|
|
||||||
"Can't navigate to start new chat after app opened from deep link with invalid public key")
|
|
||||||
self.driver.close_app()
|
|
||||||
|
|
||||||
sign_in.just_fyi('Check that no error when opening invalid deep link')
|
|
||||||
deep_link = 'status-im://u/%s' % basic_user['public_key']
|
|
||||||
sign_in.open_weblink_and_login(deep_link)
|
|
||||||
from views.profile_view import ProfileView
|
|
||||||
profile = ProfileView(self.driver)
|
|
||||||
if not profile.default_username_text != basic_user['username']:
|
|
||||||
self.errors.append("Can't navigate to profile from deep link with own public key")
|
|
||||||
self.errors.verify_no_errors()
|
|
||||||
|
|
||||||
@marks.testrail_id(6319)
|
@marks.testrail_id(6319)
|
||||||
# TODO: merge with other 1-driver medium e2e
|
# TODO: merge with other 1-driver medium e2e
|
||||||
def test_permissions_deny_access_camera_and_gallery(self):
|
def test_permissions_deny_access_camera_and_gallery(self):
|
||||||
|
|
Loading…
Reference in New Issue