Skip to content

Commit

Permalink
new e2e: stickers, share links, search
Browse files Browse the repository at this point in the history
Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
  • Loading branch information
churik committed May 20, 2020
1 parent 0ff6579 commit c3d14f1
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,57 @@ def test_ens_username_recipient(self):
self.errors.append('ENS address "stateofus.eth" without domain is not resolved as recipient')

self.errors.verify_no_errors()

@marks.testrail_id(6269)
@marks.medium
def test_search_asset_and_currency(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
profile = home.profile_button.click()
profile.switch_network('Mainnet with upstream RPC')
search_list_assets = {
'ad': ['AdEx', 'Open Trading Network', 'TrueCAD'],
'zs': ['ZSC']
}
wallet = home.wallet_button.click()

home.just_fyi('Searching for asset by name and symbol')
wallet.set_up_wallet()
wallet.multiaccount_more_options.click()
wallet.manage_assets_button.click()
for keyword in search_list_assets:
home.search_by_keyword(keyword)
if keyword == 'ad':
search_elements = wallet.all_assets_full_names.find_elements()
else:
search_elements = wallet.all_assets_symbols.find_elements()
if not search_elements:
self.errors.append('No search results after searching by %s keyword' % keyword)
search_results = [element.text for element in search_elements]
if search_results != search_list_assets[keyword]:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(', '.join(search_list_assets[keyword]), keyword))
home.cancel_button.click()
wallet.back_button.click()

home.just_fyi('Searching for currency')
search_list_currencies = {
'aF': ['Afghanistan Afghan (AFN)', 'South Africa Rand (ZAR)'],
'bolívi': ['Bolivia Bolíviano (BOB)']
}
wallet.multiaccount_more_options.click_until_presence_of_element(wallet.set_currency_button)
wallet.set_currency_button.click()
for keyword in search_list_currencies:
home.search_by_keyword(keyword)
search_elements = wallet.currency_item_text.find_elements()
if not search_elements:
self.errors.append('No search results after searching by %s keyword' % keyword)
search_results = [element.text for element in search_elements]
from pprint import pprint
pprint(search_results)
if search_results != search_list_assets[keyword]:
self.errors.append("'%s' is shown on the home screen after searching by '%s' keyword" %
(', '.join(search_list_assets[keyword]), keyword))
home.cancel_button.click()

self.errors.verify_no_errors()
45 changes: 42 additions & 3 deletions test/appium/tests/atomic/chats/test_chats_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ def test_search_chat_on_home(self):
home.just_fyi('Can search for public chat name, ens name, username')
home.swipe_down()
for keyword in search_list:
home.just_fyi('Search for %s' %keyword)
home.search_chat_input.click()
home.search_chat_input.send_keys(keyword)
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)
Expand Down Expand Up @@ -321,6 +319,47 @@ def test_can_remove_quote_snippet_from_inputs(self):

self.errors.verify_no_errors()

@marks.testrail_id(5498)
@marks.medium
def test_share_user_profile_url_public_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()

sign_in.just_fyi('Join to one-to-one chat and share link to other user profile via messenger')
chat_view = home.add_contact(dummy_user["public_key"])
chat_view.chat_options.click()
chat_view.view_profile_button.click_until_presence_of_element(chat_view.remove_from_contacts)
chat_view.profile_details.click()
chat_view.share_button.click()
chat_view.share_via_messenger()
if not chat_view.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_view.click_system_back_button()

sign_in.just_fyi('Join to public chat and share link to it via messenger')
chat_view.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_view.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_view.click_system_back_button()
chat_view.get_back_to_home_view()

sign_in.just_fyi('Open URL and share link to it via messenger')
daap_view = home.dapp_tab_button.click()
browsing_view = daap_view.open_url('dap.ps')
browsing_view.share_url_button.click()
browsing_view.share_via_messenger()
if not chat_view.element_by_text_part('https://join.status.im/b/https://dap.ps').is_element_present():
self.errors.append("Can't share link to URL")

self.errors.verify_no_errors()


@marks.chat
class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
Expand Down
104 changes: 64 additions & 40 deletions test/appium/tests/atomic/chats/test_one_to_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_messaging_in_different_networks(self):

@marks.testrail_id(5315)
@marks.high
def test_send_message_to_newly_added_contact(self):
def test_send_non_english_message_to_newly_added_contact(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])

Expand All @@ -129,15 +129,16 @@ def test_send_message_to_newly_added_contact(self):
device_2_home.home_button.click()

device_1_chat = device_1_home.add_contact(device_2_public_key)
message = 'hello'
device_1_chat.chat_message_input.send_keys(message)
device_1_chat.send_message_button.click()
messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥']
for message in messages:
device_1_chat.send_message(message)

chat_element = device_2_home.get_chat(default_username_1)
chat_element.wait_for_visibility_of_element()
device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with test '%s' was not received" % message)
for message in messages:
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with test '%s' was not received" % message)
if not device_2_chat.add_to_contacts.is_element_displayed():
self.errors.append('Add to contacts button is not shown')
if device_2_chat.user_name_text.text != default_username_1:
Expand All @@ -151,6 +152,63 @@ def test_send_message_to_newly_added_contact(self):
# self.errors.append("Updated profile picture is not shown in one-to-one chat")
self.errors.verify_no_errors()

@marks.testrail_id(5782)
@marks.critical
def test_install_pack_and_send_sticker(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home, device_2_home = device_1.create_user(), device_2.create_user()

device_1_home.just_fyi('join public chat and check that stickers are not available on Ropsten')
chat_name = device_1_home.get_random_chat_name()
device_1_home.join_public_chat(chat_name)
device_1_public_chat = device_1_home.get_chat_view()
if device_1_public_chat.show_stickers_button.is_element_displayed():
self.errors.append('Sticker button is shown while on Ropsten')

device_1_home.just_fyi('switch to mainnet')
device_1_public_chat.get_back_to_home_view()
device_1_profile, device_2_profile = device_1_home.profile_button.click(), device_2_home.profile_button.click()
device_2_public_key = device_2_profile.get_public_key_and_username()
device_1_public_key, device_1_username = device_1_profile.get_public_key_and_username(return_username=True)

for device in device_2_profile, device_1_profile:
device.switch_network('Mainnet with upstream RPC')
device_1_home.get_chat('#' + chat_name).click()

device_1_home.just_fyi('install free sticker pack and use it in public chat')
device_1_public_chat.show_stickers_button.click()
device_1_public_chat.get_stickers.click()
device_1_public_chat.install_sticker_pack_by_name('Status Cat')
device_1_public_chat.back_button.click()
time.sleep(2)
device_1_public_chat.swipe_left()
device_1_public_chat.sticker_icon.click()
if not device_1_public_chat.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent')
device_1_public_chat.swipe_right()
if not device_1_public_chat.sticker_icon.is_element_displayed():
self.errors.append('Sticker is not shown in recently used list')
device_1_public_chat.get_back_to_home_view()

device_1_home.just_fyi('send stickers in 1-1 chat from Recent')
device_1_one_to_one_chat = device_1_home.add_contact(device_2_public_key)
device_1_one_to_one_chat.show_stickers_button.click()
device_1_one_to_one_chat.sticker_icon.click()
if not device_1_one_to_one_chat.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent from Recent')

device_2_home.just_fyi('check that can install stickers by tapping on sticker message')
device2_one_to_one_chat = device_2_home.get_chat(device_1_username).click()
device2_one_to_one_chat.chat_item.click()
if not device2_one_to_one_chat.element_by_text_part('Status Cat').is_element_displayed():
self.errors.append('Stickerpack is not available for installation after tapping on sticker message')
device2_one_to_one_chat.element_by_text_part('Free').click()
if device2_one_to_one_chat.element_by_text_part('Free').is_element_displayed():
self.errors.append('Stickerpack was not installed')

self.errors.verify_no_errors()

@marks.testrail_id(5316)
@marks.critical
def test_add_to_contacts(self):
Expand Down Expand Up @@ -493,40 +551,6 @@ def test_send_emoji(self):
self.errors.verify_no_errors()


@marks.testrail_id(5782)
@marks.critical
def test_install_pack_and_send_sticker(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()

sign_in.just_fyi('join public chat and check that stickers are not available on Ropsten')
chat_name = home.get_random_chat_name()
home.join_public_chat(chat_name)
chat = sign_in.get_chat_view()
if chat.show_stickers_button.is_element_displayed():
self.errors.append('Sticker button is shown while on Ropsten')

sign_in.just_fyi('switch to mainnet')
chat.get_back_to_home_view()
profile = home.profile_button.click()
profile.switch_network('Mainnet with upstream RPC')
home.get_chat('#' + chat_name).click()

sign_in.just_fyi('install free sticker pack and use it in public chat')
chat.show_stickers_button.click()
chat.get_stickers.click()
chat.install_sticker_pack_by_name('Status Cat')
chat.back_button.click()
time.sleep(2)
chat.swipe_left()
chat.sticker_icon.click()
if not chat.chat_item.is_element_displayed():
self.errors.append('Sticker was not sent')
chat.swipe_right()
if not chat.sticker_icon.is_element_displayed():
self.errors.append('Sticker is not shown in recently used list')
self.errors.verify_no_errors()

@marks.testrail_id(5783)
@marks.critical
def test_can_use_purchased_stickers_on_recovered_account(self):
Expand Down
20 changes: 19 additions & 1 deletion test/appium/views/base_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def click(self):
self.click_until_presence_of_element(PlusButton(self.driver))
return self.navigate()

class ShareButton(BaseButton):

def __init__(self, driver):
super(ShareButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('share-my-contact-code-button')


class DappTabButton(TabButton):
def __init__(self, driver):
Expand Down Expand Up @@ -342,6 +348,12 @@ def click(self):
self.driver.press_keycode(4)


class SearchChatInput(BaseEditBox):
def __init__(self, driver):
super().__init__(driver)
self.locator = self.Locator.text_selector('Search')


class BaseView(object):
def __init__(self, driver):
self.driver = driver
Expand Down Expand Up @@ -376,7 +388,8 @@ def __init__(self, driver):
self.cross_icon_iside_welcome_screen_button = CrossIconInWelcomeScreen(self.driver)
self.status_in_background_button = StatusInBackgroundButton(self.driver)
self.cancel_button = CancelButton(self.driver)

self.search_chat_input = SearchChatInput(self.driver)
self.share_button = ShareButton(self.driver)

# external browser
self.search_in_google_edit_box = SearchEditBox(self.driver)
Expand Down Expand Up @@ -697,6 +710,11 @@ def upgrade_app(self):
self.driver.install_app(pytest_config_global['apk_upgrade'], replace=True)
self.driver.info('Upgrading apk to apk_upgrade')

def search_by_keyword(self, keyword):
self.driver.info('Search for %s' % keyword)
self.search_chat_input.click()
self.search_chat_input.send_keys(keyword)

# Method-helper
def write_page_source_to_file(self, full_path_to_file):
string_source = self.driver.page_source
Expand Down
14 changes: 14 additions & 0 deletions test/appium/views/chat_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ def __init__(self, driver):
self.locator = self.Locator.text_selector("Reply")


class ProfileDetailsOtherUser(BaseButton):
def __init__(self, driver):
super(ProfileDetailsOtherUser, self).__init__(driver)
self.locator = self.Locator.accessibility_id('profile-public-key')


class ShareChatButton(BaseButton):
def __init__(self, driver):
super(ShareChatButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('share-chat-button')


class GroupInfoButton(BaseButton):

def __init__(self, driver):
Expand Down Expand Up @@ -541,6 +553,7 @@ def __init__(self, driver):
self.delete_chat_button = DeleteChatButton(self.driver)
self.clear_history_button = ClearHistoryButton(self.driver)
self.reply_message_button = ReplyMessageButton(self.driver)
self.share_chat_button = ShareChatButton(self.driver)
self.clear_button = ClearButton(self.driver)
self.block_contact_button = BlockContactButton(self.driver)
self.unblock_contact_button = UnblockContactButton(self.driver)
Expand Down Expand Up @@ -571,6 +584,7 @@ def __init__(self, driver):
self.profile_address_text = ProfileAddressText(self.driver)
self.profile_block_contact = ProfileBlockContactButton(self.driver)
self.profile_add_to_contacts = ProfileAddToContactsButton(self.driver)
self.profile_details = ProfileDetailsOtherUser(self.driver)

def delete_chat(self):
self.chat_options.click()
Expand Down
7 changes: 0 additions & 7 deletions test/appium/views/home_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,13 @@ def __init__(self, driver):
self.locator = self.Locator.accessibility_id('chat-url-text')


class SearchChatInput(BaseEditBox):
def __init__(self, driver):
super().__init__(driver)
self.locator = self.Locator.text_selector('Search')


class HomeView(BaseView):
def __init__(self, driver):
super(HomeView, self).__init__(driver)
self.welcome_image = WelcomeImageElement(self.driver)
self.plus_button = PlusButton(self.driver)
self.chat_name_text = ChatNameText(self.driver)
self.chat_url_text = ChatUrlText(self.driver)
self.search_chat_input = SearchChatInput(self.driver)

self.start_new_chat_button = StartNewChatButton(self.driver)
self.new_group_chat_button = NewGroupChatButton(self.driver)
Expand Down
14 changes: 7 additions & 7 deletions test/appium/views/profile_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def __init__(self, driver):
self.locator = self.Locator.accessibility_id('chat-icon')


class ProfileDetailsOtherUser(BaseElement):
def __init__(self, driver):
super(ProfileDetailsOtherUser, self).__init__(driver)
self.locator = self.Locator.accessibility_id('profile-public-key')


class EditPictureButton(BaseButton):

def __init__(self, driver):
Expand All @@ -155,12 +161,6 @@ def __init__(self, driver):
self.locator = self.Locator.accessibility_id('done-button')


class ShareButton(BaseButton):

def __init__(self, driver):
super(ShareButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('share-my-contact-code-button')


class ENSUsernameInShareChatKeyPopup(BaseText):

Expand All @@ -187,6 +187,7 @@ def __init__(self, driver):
super(LogLevelSetting, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="log-level-settings-button"]/android.widget.TextView[2]')


class BackupRecoveryPhraseButton(BaseButton):

def __init__(self, driver):
Expand Down Expand Up @@ -588,7 +589,6 @@ def __init__(self, driver):
self.remove_picture_button = RemovePictureButton(self.driver)
self.confirm_edit_button = ConfirmEditButton(self.driver)
self.cross_icon = CrossIcon(self.driver)
self.share_button = ShareButton(self.driver)
self.advanced_button = AdvancedButton(self.driver)
self.log_level_setting = LogLevelSetting(self.driver)
self.debug_mode_toggle = DebugModeToggle(self.driver)
Expand Down
Loading

0 comments on commit c3d14f1

Please sign in to comment.