Add unblock user test

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2019-10-23 20:17:54 +03:00
parent 39b32707e2
commit 8ac531ed9c
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 51 additions and 14 deletions

View File

@ -191,6 +191,26 @@ class TestChatManagement(SingleDeviceTestCase):
if not home.plus_button.is_element_displayed(): if not home.plus_button.is_element_displayed():
self.driver.fail('Chats view was not opened') self.driver.fail('Chats view was not opened')
@marks.testrail_id(6213)
@marks.medium
def test_unblocked_user_is_not_added_in_contacts(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
chat_view = home.add_contact(basic_user["public_key"], add_in_contacts=False)
chat_view.chat_options.click()
chat_view.view_profile_button.click()
chat_view.block_contact()
profile = sign_in.profile_button.click()
profile.contacts_button.click()
profile.blocked_users_button.click()
profile.element_by_text(basic_user["username"]).click()
chat_view.unblock_contact_button.click()
chat_view.back_button.click()
home.plus_button.click()
home.start_new_chat_button.click()
if home.element_by_text(basic_user["username"]).is_element_displayed():
self.driver.fail("Unblocked user not added previously in contact list added in contacts!")
@marks.chat @marks.chat
class TestChatManagementMultipleDevice(MultipleDeviceTestCase): class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
@ -257,8 +277,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_element = chat_public_1.chat_element_by_text(message_before_block_2) chat_element = chat_public_1.chat_element_by_text(message_before_block_2)
chat_element.find_element() chat_element.find_element()
chat_element.member_photo.click() chat_element.member_photo.click()
chat_public_1.profile_block_contact.click() chat_public_1.block_contact()
chat_public_1.block_button.click()
device_1.just_fyi('messages from blocked user are hidden in public chat and close app') device_1.just_fyi('messages from blocked user are hidden in public chat and close app')
if chat_public_1.chat_element_by_text(message_before_block_2).is_element_displayed(): if chat_public_1.chat_element_by_text(message_before_block_2).is_element_displayed():
@ -323,8 +342,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1.just_fyi('block user') device_1.just_fyi('block user')
chat_1.chat_options.click() chat_1.chat_options.click()
chat_1.view_profile_button.click() chat_1.view_profile_button.click()
chat_1.profile_block_contact.click() chat_1.block_contact()
chat_1.block_button.click()
device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat') device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat')
if home_1.get_chat_with_user(basic_user['username']).is_element_displayed(): if home_1.get_chat_with_user(basic_user['username']).is_element_displayed():

View File

@ -362,7 +362,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.gas_limit_input.clear() send_transaction.gas_limit_input.clear()
send_transaction.gas_limit_input.set_value('1') send_transaction.gas_limit_input.set_value('1')
send_transaction.gas_price_input.clear() send_transaction.gas_price_input.clear()
send_transaction.gas_price_input.set_value('1') send_transaction.gas_price_input.send_keys('1')
send_transaction.update_fee_button.click() send_transaction.update_fee_button.click()
send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input) send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input)
send_transaction.enter_password_input.send_keys(common_password) send_transaction.enter_password_input.send_keys(common_password)
@ -377,7 +377,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.gas_limit_input.set_value(gas_limit) send_transaction.gas_limit_input.set_value(gas_limit)
send_transaction.gas_price_input.clear() send_transaction.gas_price_input.clear()
gas_price = str(round(float(send_transaction.gas_price_input.text)) + 10) gas_price = str(round(float(send_transaction.gas_price_input.text)) + 10)
send_transaction.gas_price_input.set_value(gas_price) send_transaction.gas_price_input.send_keys(gas_price)
send_transaction.update_fee_button.click() send_transaction.update_fee_button.click()
send_transaction.sign_transaction() send_transaction.sign_transaction()
self.network_api.find_transaction_by_unique_amount(sender['address'], amount) self.network_api.find_transaction_by_unique_amount(sender['address'], amount)

View File

@ -122,10 +122,16 @@ class ClearButton(BaseButton):
self.locator = self.Locator.xpath_selector('//*[@text="CLEAR"]') self.locator = self.Locator.xpath_selector('//*[@text="CLEAR"]')
class BlockButton(BaseButton): class BlockContactButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(BlockButton, self).__init__(driver) super(BlockContactButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector('(//*[@text="Block this user"])[2]') self.locator = self.Locator.accessibility_id('block-contact')
class UnblockContactButton(BaseButton):
def __init__(self, driver):
super(UnblockContactButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('unblock-contact')
class LeaveButton(BaseButton): class LeaveButton(BaseButton):
@ -389,7 +395,8 @@ class ChatView(BaseView):
self.delete_chat_button = DeleteChatButton(self.driver) self.delete_chat_button = DeleteChatButton(self.driver)
self.clear_history_button = ClearHistoryButton(self.driver) self.clear_history_button = ClearHistoryButton(self.driver)
self.clear_button = ClearButton(self.driver) self.clear_button = ClearButton(self.driver)
self.block_button = BlockButton(self.driver) self.block_contact_button = BlockContactButton(self.driver)
self.unblock_contact_button = UnblockContactButton(self.driver)
# Group chats # Group chats
self.group_info = GroupInfoButton(self.driver) self.group_info = GroupInfoButton(self.driver)
@ -566,3 +573,7 @@ class ChatView(BaseView):
element.scroll_to_element() element.scroll_to_element()
element.click() element.click()
element.wait_for_invisibility_of_element() element.wait_for_invisibility_of_element()
def block_contact(self):
self.profile_block_contact.click()
self.block_contact_button.click()

View File

@ -155,13 +155,14 @@ class HomeView(BaseView):
def get_chat_with_user(self, username): def get_chat_with_user(self, username):
return ChatElement(self.driver, username[:25]) return ChatElement(self.driver, username[:25])
def add_contact(self, public_key): def add_contact(self, public_key, add_in_contacts=True):
self.plus_button.click_until_presence_of_element(self.start_new_chat_button) self.plus_button.click_until_presence_of_element(self.start_new_chat_button)
contacts_view = self.start_new_chat_button.click() contacts_view = self.start_new_chat_button.click()
contacts_view.public_key_edit_box.click() contacts_view.public_key_edit_box.click()
contacts_view.public_key_edit_box.send_keys(public_key) contacts_view.public_key_edit_box.send_keys(public_key)
one_to_one_chat = self.get_chat_view() one_to_one_chat = self.get_chat_view()
contacts_view.confirm_until_presence_of_element(one_to_one_chat.chat_message_input) contacts_view.confirm_until_presence_of_element(one_to_one_chat.chat_message_input)
if add_in_contacts:
one_to_one_chat.add_to_contacts.click() one_to_one_chat.add_to_contacts.click()
return one_to_one_chat return one_to_one_chat

View File

@ -478,7 +478,13 @@ class SyncAllButton(BaseButton):
class ContactsButton(BaseButton): class ContactsButton(BaseButton):
def __init__(self, driver): def __init__(self, driver):
super(ContactsButton, self).__init__(driver) super(ContactsButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Contacts') self.locator = self.Locator.accessibility_id('contacts-button')
class BlockedUsersButton(BaseButton):
def __init__(self, driver):
super(BlockedUsersButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('blocked-users-list-button')
class DappPermissionsButton(BaseButton): class DappPermissionsButton(BaseButton):
@ -564,6 +570,7 @@ class ProfileView(BaseView):
self.log_level_setting = LogLevelSetting(self.driver) self.log_level_setting = LogLevelSetting(self.driver)
self.debug_mode_toggle = DebugModeToggle(self.driver) self.debug_mode_toggle = DebugModeToggle(self.driver)
self.contacts_button = ContactsButton(self.driver) self.contacts_button = ContactsButton(self.driver)
self.blocked_users_button = BlockedUsersButton(self.driver)
self.dapp_permissions_button = DappPermissionsButton(self.driver) self.dapp_permissions_button = DappPermissionsButton(self.driver)
self.revoke_access_button = RevokeAccessButton(self.driver) self.revoke_access_button = RevokeAccessButton(self.driver)
self.privacy_and_security_button = PrivacyAndSecurityButton(self.driver) self.privacy_and_security_button = PrivacyAndSecurityButton(self.driver)

View File

@ -162,7 +162,7 @@ class UpdateFeeButton(BaseButton):
self.driver.info('Tap on %s' % self.name) self.driver.info('Tap on %s' % self.name)
self.find_element().click() self.find_element().click()
self.driver.info('Wait for no %s' % self.name) self.driver.info('Wait for no %s' % self.name)
if not self.is_element_displayed(1): if not self.is_element_displayed():
return self.navigate() return self.navigate()