accept agreement remove + group invite e2e

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-09-09 17:06:07 +02:00
parent 72daf93a75
commit 754b826629
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
20 changed files with 200 additions and 35 deletions

View File

@ -13,14 +13,16 @@
(defn join-chat-button [chat-id]
[quo/button
{:type :secondary
:on-press #(debounce/dispatch-and-chill [:group-chats.ui/join-pressed chat-id] 2000)}
{:type :secondary
:accessibility-label :join-chat-button
:on-press #(debounce/dispatch-and-chill [:group-chats.ui/join-pressed chat-id] 2000)}
(i18n/label :t/join-group-chat)])
(defn decline-chat [chat-id]
[react/touchable-highlight
{:on-press
#(debounce/dispatch-and-chill [:group-chats.ui/leave-chat-confirmed chat-id] 2000)}
#(debounce/dispatch-and-chill [:group-chats.ui/leave-chat-confirmed chat-id] 2000)
:accessibility-label :decline-chat-button}
[react/text {:style style/decline-chat}
(i18n/label :t/group-chat-decline-invitation)]])
@ -49,12 +51,13 @@
:else
[react/view
[react/text (i18n/label :t/introduce-yourself)]
[quo/text-input {:placeholder (i18n/label :t/message)
:on-change-text #(re-frame/dispatch [:group-chats.ui/update-membership-message %])
:max-length 100
:multiline true
:default-value message
:container-style {:margin-top 10 :margin-bottom 16}}]
[quo/text-input {:placeholder (i18n/label :t/message)
:on-change-text #(re-frame/dispatch [:group-chats.ui/update-membership-message %])
:max-length 100
:multiline true
:default-value message
:accessibility-label :introduce-yourself-input
:container-style {:margin-top 10 :margin-bottom 16}}]
[react/text {:style {:align-self :flex-end :margin-bottom 30}}
(str (count message) "/100")]])]))

View File

@ -227,20 +227,23 @@
:right
[quo/button
{:type :secondary
:accessibility-label :retry-button
:on-press #(re-frame/dispatch [:group-chats.ui/membership-retry])}
(i18n/label :t/mailserver-retry)]
:left
[quo/button
{:type :secondary
:accessibility-label :remove-group-button
:on-press #(re-frame/dispatch [:group-chats.ui/remove-chat-confirmed chat-id])}
(i18n/label :t/remove-group)]}]
:else
[toolbar/toolbar {:show-border? true
:center
[quo/button
{:type :secondary
:disabled (string/blank? message)
:on-press #(re-frame/dispatch [:send-group-chat-membership-request])}
{:type :secondary
:accessibility-label :introduce-yourself-button
:disabled (string/blank? message)
:on-press #(re-frame/dispatch [:send-group-chat-membership-request])}
(i18n/label :t/request-membership)]}])]))
(defn chat []

View File

@ -121,14 +121,14 @@
:disabled (not allow-adding-members?)
:title (i18n/label :t/accept)
:subtitle (when-not allow-adding-members? (i18n/label :t/members-limit-reached))
:accessibility-label :fetch-history-button
:accessibility-label :accept-invitation-button
:icon :main-icons/checkmark-circle
:on-press #(hide-sheet-and-dispatch
[:group-chats.ui/add-members-from-invitation id (:public-key contact)])}]
[quo/list-item
{:theme :negative
:title (i18n/label :t/decline)
:accessibility-label :delete-chat-button
:accessibility-label :decline-invitation-button
:icon :main-icons/cancel
:on-press #(hide-sheet-and-dispatch [:send-group-chat-membership-rejection id])}]]))
@ -160,7 +160,8 @@
[react/text {:style {:color colors/gray}} (i18n/label :t/group-invite-link)]
[copyable-text/copyable-text-view
{:copied-text invite-link}
[react/view {:border-width 1 :border-color colors/gray-lighter
[react/view {:accessibility-label :invitation-link
:border-width 1 :border-color colors/gray-lighter
:justify-content :center :margin-top 10
:border-radius 8 :padding-horizontal 16 :padding-vertical 11}
[react/text invite-link]]]

View File

@ -81,13 +81,15 @@ class NetworkApi(object):
try:
if token:
transactions = self.get_token_transactions(address)
additional_info = 'token transactions'
else:
transactions = self.get_transactions(address)
additional_info = 'ETH transactions'
except JSONDecodeError as e:
self.log(str(e))
continue
self.log('Looking for a transaction with unique amount %s in list of transactions, address is %s' %
(amount, address))
self.log('Looking for a transaction with unique amount %s in list of %s, address is %s' %
(additional_info, amount, address))
try:
for transaction in transactions:
if float(int(transaction['value']) / 10 ** decimals) == float(amount):

View File

@ -22,7 +22,8 @@ RERUN_ERRORS = [
"replacement transaction underpriced",
"StaleElementReferenceException",
"'GetStartedButton' is not found on the screen",
"'AccessKeyButton' is not found on the screen"
"'AccessKeyButton' is not found on the screen",
"'SignInPhraseText' is not found on the screen"
]

View File

@ -65,7 +65,7 @@ class TestCreateAccount(SingleDeviceTestCase):
shown_username = profile_view.default_username_text.text
if shown_username != username:
self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username, username))
profile_view.home_button.click()
profile_view.home_button.click_until_presence_of_element(home_view.element_by_text('#status'))
home_view.cross_icon_iside_welcome_screen_button.click()
for chat in ('#status', '#crypto'):
home_view.delete_chat_long_press(chat)

View File

@ -347,7 +347,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in_view.profile_button.click()
profile_view.logout()
self.driver.reset()
sign_in_view.accept_agreements()
# sign_in_view.accept_agreements()
sign_in_view.recover_access(recovery_phrase)
wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet()

View File

@ -16,7 +16,7 @@ class TestSignIn(SingleDeviceTestCase):
default_username = profile.default_username_text.text
self.driver.close_app()
self.driver.launch_app()
sign_in.accept_agreements()
# sign_in.accept_agreements()
if not sign_in.element_by_text(default_username).is_element_displayed():
self.driver.fail('Username is not shown while login')
sign_in.sign_in()

View File

@ -598,7 +598,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
def test_block_user_from_public_chat(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_before_block_1 = "Before block from %s" % device_1.driver.number
message_before_block_2 = "Before block from %s" % device_2.driver.number
message_after_block_2 = "After block from %s" % device_2.driver.number
home_1, home_2 = device_1.create_user(), device_2.create_user()
@ -631,7 +630,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1.just_fyi('check that new messages from blocked user are not delivered')
self.drivers[0].launch_app()
device_1.accept_agreements()
# device_1.accept_agreements()
device_1.sign_in()
home_1.join_public_chat(chat_name)
for message in message_before_block_2, message_after_block_2:
@ -731,7 +730,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1.just_fyi("reopen app and check that messages from blocked user are not fetched")
device_1.click_system_home_button()
self.drivers[0].launch_app()
device_1.accept_agreements()
# device_1.accept_agreements()
device_1.sign_in()
if home_1.get_chat(basic_user['username']).is_element_displayed():
self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline")

View File

@ -1,7 +1,8 @@
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.users import transaction_recipients
from tests.users import transaction_recipients, basic_user
from views.sign_in_view import SignInView
from views.chat_view import ChatView
from time import sleep
@ -237,6 +238,82 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.append("Message '%s' was received by removed member" % message)
self.errors.verify_no_errors()
@marks.testrail_id(6324)
@marks.medium
def test_invite_to_group_chat_handling(self):
self.create_drivers(3)
devices_sign_in, devices_home, devices_key, devices_username, devices_chat = {}, {}, {}, {}, {}
for key in self.drivers:
devices_sign_in[key] = SignInView(self.drivers[key])
devices_home[key] = devices_sign_in[key].create_user()
devices_key[key], devices_username[key] = devices_sign_in[key].get_public_key_and_username(True)
devices_sign_in[key].home_button.click()
[driver.close_app() for driver in (self.drivers[1], self.drivers[2])]
chat_name = devices_home[0].get_random_chat_name()
devices_home[0].add_contact(basic_user['public_key'])
devices_home[0].get_back_to_home_view()
devices_chat[0] = devices_home[0].create_group_chat([basic_user['username']], chat_name)
link = devices_chat[0].get_group_invite_via_group_info()
devices_chat[0].get_back_to_home_view()
devices_chat[0].just_fyi('Member_1, member_2: both users send requests to join group chat')
[sign_in.open_weblink_and_login(link) for sign_in in (devices_sign_in[1], devices_sign_in[2])]
introduction_messages = ['message for retrying']
for i in range(1,3):
devices_home[i].element_by_text_part(chat_name).click()
devices_chat[i] = ChatView(self.drivers[i])
introduction_messages.append('Please add me, member_%s to your gorgeous group chat' % str(i))
devices_chat[i].request_membership_for_group_chat(introduction_messages[i])
devices_chat[0].just_fyi('Admin: accept request for Member_1 and decline for Member_2')
devices_home[0].get_chat(chat_name).click()
devices_chat[0].group_membership_request_button.click()
devices_chat[0].element_by_text(devices_username[1]).click()
if not devices_chat[0].element_by_text_part(introduction_messages[1]).is_element_displayed():
self.errors.append('Introduction message is not shown!')
devices_chat[0].accept_group_invitation_button.click()
devices_chat[0].accept_membership_for_group_chat_via_chat_view(devices_username[2], accept=False)
devices_chat[0].click_system_back_button()
devices_chat[1].just_fyi('Member_1: join chat')
devices_chat[1].join_chat_button.click()
devices_chat[2].just_fyi('Member_2: retry request')
devices_chat[2].retry_group_invite_button.click()
devices_chat[2].request_membership_for_group_chat(introduction_messages[0])
devices_chat[2].just_fyi('Admin: decline request for Member_2')
devices_chat[0].group_membership_request_button.click()
devices_chat[0].element_by_text(devices_username[2]).click()
if not devices_chat[0].element_by_text_part(introduction_messages[0]).is_element_displayed():
self.errors.append('Introduction message that was set after retrying attempt is not shown for admin!')
devices_chat[0].decline_group_invitation_button.click()
devices_chat[0].click_system_back_button()
devices_chat[2].just_fyi('Member_2: remove chat')
devices_chat[2].remove_group_invite_button.click()
devices_chat[2].just_fyi('Double check after relogin')
if devices_chat[0].group_membership_request_button.is_element_displayed():
self.errors.append('Group membership request is still shown when there are no pending requests anymore')
[devices_home[i].relogin() for i in range(0,3)]
if devices_home[2].element_by_text_part(chat_name).is_element_displayed():
self.errors.append('Group chat was not removed when removing after declining group invite')
[home.get_chat(chat_name).click() for home in (devices_home[0], devices_home[1])]
if devices_chat[0].group_membership_request_button.is_element_displayed():
self.errors.append('Group membership request is shown after relogin when there are no pending requests anymore')
join_system_message = devices_chat[0].join_system_message(devices_username[1])
for chat in (devices_chat[1], devices_chat[0]):
if not chat.chat_element_by_text(join_system_message).is_element_displayed():
self.errors.append('%s is not shown after joining to group chat via invite' % join_system_message)
self.errors.verify_no_errors()
@marks.testrail_id(5694)
@marks.medium
def test_make_admin_member_of_group_chat(self):

View File

@ -1,9 +1,8 @@
import pytest
from tests import marks, connection_not_secure_text, connection_is_secure_text, test_dapp_url
from tests.base_test_case import SingleDeviceTestCase
from views.sign_in_view import SignInView
from views.dapps_view import DappsView
import time
from time import sleep
class TestBrowsing(SingleDeviceTestCase):
@ -211,6 +210,8 @@ class TestBrowsing(SingleDeviceTestCase):
@marks.testrail_id(5456)
@marks.medium
@marks.skip
# Decicded to leave for manual testing, as there is no simple way of comparing images depending on phone brightness
def test_can_access_images_by_link(self):
urls = {
'https://cdn.dribbble.com/users/45534/screenshots/3142450/logo_dribbble.png':

View File

@ -51,7 +51,7 @@ class TestDApps(SingleDeviceTestCase):
dapp_view.enter_url_editbox.click()
dapp_view.paste_text()
dapp_view.confirm()
if not dapp_view.allow_button.is_element_displayed():
if not dapp_view.allow_button.is_element_displayed(30):
self.driver.fail('No permission is asked for dapp, so IPNS name is not resolved')
@marks.testrail_id(6232)

View File

@ -286,7 +286,7 @@ class BaseButton(BaseElement):
try:
self.driver.info('Tap on %s' % self.name)
self.find_element().click()
self.driver.info('Wait for %s' % desired_element.name)
self.driver.info('Wait for %s to be displayed' % desired_element.name)
desired_element.wait_for_element(5)
return self.navigate()
except (NoSuchElementException, TimeoutException):
@ -300,7 +300,7 @@ class BaseButton(BaseElement):
try:
self.driver.info('Tap on %s' % self.name)
self.find_element().click()
self.driver.info('Wait for %s' % desired_element.name)
self.driver.info('Wait for %s to disappear' % desired_element.name)
counter += 1
except (NoSuchElementException, TimeoutException):
return self.navigate()

View File

@ -415,7 +415,7 @@ class BaseView(object):
def accept_agreements(self):
iterations = int()
self.close_native_device_dialog("Messages")
self.close_native_device_dialog("Messages has stopped")
self.close_native_device_dialog("YouTube")
while iterations <= 1 and (self.ok_button.is_element_displayed(2) or
self.continue_button.is_element_displayed(2)):

View File

@ -163,6 +163,57 @@ class GroupInfoButton(BaseButton):
self.wait_for_element().click()
return self.navigate()
class GroupInviteButton(BaseButton):
def __init__(self, driver):
super(GroupInviteButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('invite-chat-button')
class GroupInviteLinkText(BaseText):
def __init__(self, driver):
super(BaseText, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="invitation-link"]/android.widget.TextView')
class IntoduceYourselfEditBox(BaseEditBox):
def __init__(self, driver):
super(IntoduceYourselfEditBox, self).__init__(driver)
self.locator = self.Locator.accessibility_id('introduce-yourself-input')
class RequestMembershipButton(BaseButton):
def __init__(self, driver):
super(RequestMembershipButton, self).__init__(driver)
self.locator = self.Locator.text_selector('Request membership')
class GroupMembershipRequestButton(BaseButton):
def __init__(self, driver):
super(GroupMembershipRequestButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('invitation-requests-button')
class AcceptGroupInvitationButton(BaseButton):
def __init__(self, driver):
super(AcceptGroupInvitationButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('accept-invitation-button')
class DeclineGroupInvitationButton(BaseButton):
def __init__(self, driver):
super(DeclineGroupInvitationButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('decline-invitation-button')
class RetryGroupInvitationButton(BaseButton):
def __init__(self, driver):
super(RetryGroupInvitationButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('retry-button')
class RemoveGroupInvitationButton(BaseButton):
def __init__(self, driver):
super(RemoveGroupInvitationButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('remove-group-button')
class LeaveChatButton(BaseButton):
def __init__(self, driver):
@ -309,7 +360,7 @@ class ProfileAddToContactsButton(BaseButton):
class JoinChatButton(BaseButton):
def __init__(self, driver):
super(JoinChatButton, self).__init__(driver)
self.locator = self.Locator.text_part_selector('Join group')
self.locator = self.Locator.accessibility_id('join-chat-button')
class DeclineChatButton(BaseButton):
@ -551,6 +602,7 @@ class UsernameOptions(BaseButton):
return ChatView(self.driver)
def click(self):
self.scroll_to_element()
self.wait_for_element().click()
return self.navigate()
@ -707,6 +759,17 @@ class ChatView(BaseView):
self.edit_group_chat_name_edit_box = EditGroupChatEditBox(self.driver)
self.done_button = DoneButton(self.driver)
# Group invites
self.group_invite_button = GroupInviteButton(self.driver)
self.group_invite_link_text = GroupInviteLinkText(self.driver)
self.introduce_yourself_edit_box = IntoduceYourselfEditBox(self.driver)
self.request_membership_button = RequestMembershipButton(self.driver)
self.group_membership_request_button = GroupMembershipRequestButton(self.driver)
self.accept_group_invitation_button = AcceptGroupInvitationButton(self.driver)
self.decline_group_invitation_button = DeclineGroupInvitationButton(self.driver)
self.retry_group_invite_button = RetryGroupInvitationButton(self.driver)
self.remove_group_invite_button = RemoveGroupInvitationButton(self.driver)
self.chat_settings = ChatSettings(self.driver)
self.view_profile_button = ViewProfileButton(self.driver)
self.view_profile_by_avatar_button = ViewProfileByAvatarButton(self.driver)
@ -753,6 +816,21 @@ class ChatView(BaseView):
self.edit_group_chat_name_edit_box.set_value(new_chat_name)
self.done_button.click()
def get_group_invite_via_group_info(self):
self.chat_options.click()
self.group_info.click()
self.group_invite_button.click()
return self.group_invite_link_text.text
def request_membership_for_group_chat(self, intro_message):
self.introduce_yourself_edit_box.set_value(intro_message)
self.request_membership_button.click_until_presence_of_element(self.element_by_text('Request pending…'))
def accept_membership_for_group_chat_via_chat_view(self, username, accept=True):
self.group_membership_request_button.click()
self.element_by_text(username).click()
self.accept_group_invitation_button.click() if accept else self.decline_group_invitation_button.click()
def send_transaction_in_group_chat(self, amount, password, recipient):
self.commands_button.click()
self.send_command.click()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

View File

@ -342,7 +342,7 @@ class SendTransactionView(BaseView):
self.network_fee_button.click()
default_gas_price = self.gas_price_input.text
self.gas_price_input.clear()
self.gas_price_input.set_value(str(float(default_gas_price)+30))
self.gas_price_input.set_value(str(int(float(default_gas_price))+30))
self.update_fee_button.click()
if keycard:
keycard_view = self.sign_with_keycard_button.click()

View File

@ -222,8 +222,8 @@ class SignInView(BaseView):
def __init__(self, driver, skip_popups=True):
super(SignInView, self).__init__(driver)
self.driver = driver
if skip_popups:
self.accept_agreements()
# if skip_popups:
# self.accept_agreements()
self.password_input = PasswordInput(self.driver)
self.recover_account_password_input = RecoverAccountPasswordInput(self.driver)