Updated and added e2e tests

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
yevh-berdnyk 2019-09-05 05:32:33 +03:00 committed by Churikova Tetiana
parent b186676c67
commit e02b7489cc
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
5 changed files with 97 additions and 35 deletions

View File

@ -577,3 +577,50 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.append('Profile picture was not updated after changing when devices are paired') self.errors.append('Profile picture was not updated after changing when devices are paired')
self.verify_no_errors() self.verify_no_errors()
@marks.testrail_id(6226)
@marks.critical
def test_ens_in_public_chat(self):
self.create_drivers(2)
device_1, device_2 = self.drivers[0], self.drivers[1]
sign_in_1, sign_in_2 = SignInView(device_1), SignInView(device_2)
user_1 = ens_user
home_1 = sign_in_1.recover_access(user_1['passphrase'])
home_2 = sign_in_2.create_user()
profile_1 = sign_in_1.profile_button.click()
profile_1.switch_network('Mainnet with upstream RPC')
home_1.profile_button.click()
profile_1.element_by_text('ENS usernames').click()
dapp_view_1 = DappsView(device_1)
dapp_view_1.element_by_text('Get started').click()
dapp_view_1.ens_name.set_value(ens_user['ens'])
dapp_view_1.check_ens_name.click()
dapp_view_1.check_ens_name.click()
dapp_view_1.element_by_text('Ok, got it').click()
dapp_view_1.back_button.click()
profile_1.home_button.click()
chat_name = home_1.get_public_chat_name()
chat_2 = home_2.join_public_chat(chat_name)
chat_1 = home_1.join_public_chat(chat_name)
message_text_1 = 'test message 1'
chat_1.send_message(message_text_1)
if chat_2.chat_element_by_text(message_text_1).username.text != user_1['username']:
self.errors.append('Default username is not shown in public chat')
chat_2.send_message('message from device 2')
chat_1.get_back_to_home_view()
home_1.profile_button.click()
profile_1.element_by_text('Your ENS name').click()
profile_1.show_ens_name_in_chats.click()
profile_1.back_button.click()
profile_1.home_button.click()
home_1.get_chat_with_user('#' + chat_name).click()
message_text_2 = 'message test text 1'
chat_1.send_message(message_text_2)
if chat_2.chat_element_by_text(message_text_2).username.text != user_1['ens'] or chat_2.chat_element_by_text(
message_text_1).username.text != user_1['ens']:
self.errors.append('ENS username is not shown in public chat')
self.verify_no_errors()

View File

@ -663,62 +663,54 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
@marks.testrail_id(5782) @marks.testrail_id(5782)
@marks.high @marks.high
def test_install_pack_and_send_sticker(self): def test_install_pack_and_send_sticker(self):
user = transaction_recipients['J']
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
home = sign_in.recover_access(user['passphrase']) home = sign_in.create_user()
home.join_public_chat(home.get_public_chat_name()) chat_name = home.get_public_chat_name()
home.join_public_chat(chat_name)
chat = sign_in.get_chat_view() chat = sign_in.get_chat_view()
if chat.show_stickers_button.is_element_displayed():
self.errors.append('Sticker button is shown while on Ropsten')
chat.get_back_to_home_view()
profile = home.profile_button.click()
profile.switch_network('Mainnet with upstream RPC')
home.get_chat_with_user('#' + chat_name).click()
chat.show_stickers_button.click() chat.show_stickers_button.click()
chat.get_stickers.click() chat.get_stickers.click()
chat.element_by_text('Install').click() chat.install_sticker_pack_by_name('Status Cat')
transaction_view = chat.get_send_transaction_view() chat.back_button.click()
transaction_view.back_button.click()
time.sleep(2) time.sleep(2)
chat.swipe_left() chat.swipe_left()
chat.sticker_icon.click() chat.sticker_icon.click()
chat.chat_item.is_element_displayed() 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.verify_no_errors()
@marks.testrail_id(5783) @marks.testrail_id(5783)
@marks.high @marks.high
def test_purchase_pack_and_send_sticker(self): def test_purchase_pack_and_send_sticker(self):
sign_in_view = SignInView(self.driver) sign_in_view = SignInView(self.driver)
home_view = sign_in_view.create_user() home_view = sign_in_view.recover_access(ens_user['passphrase'])
wallet_view = home_view.wallet_button.click() # switch to Mainnet
wallet_view.set_up_wallet() profile_view = home_view.profile_button.click()
wallet_address = wallet_view.get_wallet_address() profile_view.switch_network('Mainnet with upstream RPC')
home_view = wallet_view.get_back_to_home_view()
# get test ETH, switch to home and wallet to get updated balance
self.network_api.get_donate(wallet_address[2:])
self.network_api.verify_balance_is_updated(initial_balance=0, recipient_address=wallet_address[2:])
home_view.wallet_button.click()
wallet_view.get_back_to_home_view()
# get STT, switch to home and wallet to get updated balance
status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.assets_button.click()
transaction_view = status_test_dapp.request_stt_button.click()
transaction_view.sign_transaction()
home_view = status_test_dapp.get_back_to_home_view()
wallet_view = home_view.wallet_button.click()
home_view = wallet_view.get_back_to_home_view()
# join to public chat, buy and install stickers # join to public chat, buy and install stickers
home_view.join_public_chat(home_view.get_public_chat_name()) chat = home_view.join_public_chat(home_view.get_public_chat_name())
chat = sign_in_view.get_chat_view()
chat.show_stickers_button.click() chat.show_stickers_button.click()
chat.get_stickers.click() chat.get_stickers.click()
chat.element_by_accessibility_id('sticker-pack-price').find_elements()[0].click() chat.install_sticker_pack_by_name('Tozemoon')
transaction_view.sign_transaction() chat.back_button.click()
chat.element_by_text('Install').wait_for_element(120).click()
# check that can use installed pack # check that can use installed pack
transaction_view.back_button.click()
time.sleep(2) time.sleep(2)
chat.swipe_left() chat.swipe_left()
chat.sticker_icon.click() chat.sticker_icon.click()
chat.chat_item.is_element_displayed() if not chat.chat_item.is_element_displayed():
self.driver.fail('Sticker was not sent')
@marks.testrail_id(5403) @marks.testrail_id(5403)
@marks.critical @marks.critical

View File

@ -481,6 +481,10 @@ class BaseView(object):
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.8, size["height"]*0.8, size["width"]*0.2, size["height"]*0.8) self.driver.swipe(size["width"]*0.8, size["height"]*0.8, size["width"]*0.2, size["height"]*0.8)
def swipe_right(self):
size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.2, size["height"]*0.8, size["width"]*0.8, size["height"]*0.8)
def get_status_test_dapp_view(self): def get_status_test_dapp_view(self):
from views.web_views.status_test_dapp import StatusTestDAppView from views.web_views.status_test_dapp import StatusTestDAppView
return StatusTestDAppView(self.driver) return StatusTestDAppView(self.driver)

View File

@ -552,3 +552,10 @@ class ChatView(BaseView):
def move_to_messages_by_time_marker(self, marker='Today'): def move_to_messages_by_time_marker(self, marker='Today'):
self.driver.info("Moving to messages by time marker: '%s'" % marker) self.driver.info("Moving to messages by time marker: '%s'" % marker)
HistoryTimeMarker(self.driver, marker).scroll_to_element(depth=50, direction='up') HistoryTimeMarker(self.driver, marker).scroll_to_element(depth=50, direction='up')
def install_sticker_pack_by_name(self, pack_name: str):
element = BaseButton(self.driver)
element.locator = element.Locator.xpath_selector(
"//*[@content-desc='sticker-pack-name'][@text='%s']/..//*[@text='Install']" % pack_name)
element.click()
element.wait_for_invisibility_of_element()

View File

@ -299,6 +299,7 @@ class RequestFeatureButton(BaseButton):
super(RequestFeatureButton, self).__init__(driver) super(RequestFeatureButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("request-a-feature-button") self.locator = self.Locator.accessibility_id("request-a-feature-button")
class FaqButton(BaseButton): class FaqButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
@ -429,11 +430,13 @@ class ContinueButton(BaseButton):
super(ContinueButton, self).__init__(driver) super(ContinueButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Continue') self.locator = self.Locator.text_selector('Continue')
class SyncSettingsButton(BaseButton): class SyncSettingsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(SyncSettingsButton, self).__init__(driver) super(SyncSettingsButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="sync-settings-button"]') self.locator = self.Locator.xpath_selector('//*[@content-desc="sync-settings-button"]')
class GoToPairingSettingsButton(BaseButton): class GoToPairingSettingsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(GoToPairingSettingsButton, self).__init__(driver) super(GoToPairingSettingsButton, self).__init__(driver)
@ -481,12 +484,20 @@ class RevokeAccessButton(BaseButton):
super(RevokeAccessButton, self).__init__(driver) super(RevokeAccessButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Revoke access') self.locator = self.Locator.text_selector('Revoke access')
class PrivacyAndSecurityButton(BaseButton): class PrivacyAndSecurityButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(PrivacyAndSecurityButton, self).__init__(driver) super(PrivacyAndSecurityButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="privacy-and-security-settings-button"]') self.locator = self.Locator.xpath_selector('//*[@content-desc="privacy-and-security-settings-button"]')
class ShowENSNameInChatsToggle(BaseButton):
def __init__(self, driver):
super(ShowENSNameInChatsToggle, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
"//*[@text='Show my ENS username in chats']/following-sibling::*[1][name()='android.widget.Switch'] ")
class ProfileView(BaseView): class ProfileView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -567,6 +578,8 @@ class ProfileView(BaseView):
self.advertise_device_button = AdvertiseDeviceButton(self.driver) self.advertise_device_button = AdvertiseDeviceButton(self.driver)
self.sync_all_button = SyncAllButton(self.driver) self.sync_all_button = SyncAllButton(self.driver)
self.show_ens_name_in_chats = ShowENSNameInChatsToggle(self.driver)
def switch_network(self, network): def switch_network(self, network):
self.advanced_button.click() self.advanced_button.click()
self.debug_mode_toggle.click() self.debug_mode_toggle.click()
@ -604,7 +617,6 @@ class ProfileView(BaseView):
text = [i.text for i in self.recovery_phrase_table.find_elements()] text = [i.text for i in self.recovery_phrase_table.find_elements()]
return dict(zip(map(int, text[::2]), text[1::2])) return dict(zip(map(int, text[::2]), text[1::2]))
def backup_recovery_phrase(self): def backup_recovery_phrase(self):
self.ok_continue_button.click() self.ok_continue_button.click()
recovery_phrase = self.get_recovery_phrase() recovery_phrase = self.get_recovery_phrase()