e2e fixes + e2e reaction

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-08-14 18:05:41 +02:00
parent 4e44bed8d6
commit d22a87b77c
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
11 changed files with 123 additions and 27 deletions

View File

@ -25,7 +25,8 @@
(for [[id resource] constants/reactions (for [[id resource] constants/reactions
:let [active (own-reactions id)]] :let [active (own-reactions id)]]
^{:key id} ^{:key id}
[rn/touchable-opacity {:on-press #(send-emoji id)} [rn/touchable-opacity {:accessibility-label (str "pick-emoji-" id)
:on-press #(send-emoji id)}
[rn/view {:style (styles/reaction-button active)} [rn/view {:style (styles/reaction-button active)}
[rn/image {:source resource [rn/image {:source resource
:style {:height 32 :style {:height 32

View File

@ -11,7 +11,8 @@
:style {:width 16 :style {:width 16
:height 16 :height 16
:margin-right 4}}] :margin-right 4}}]
[quo/text {:style (styles/reaction-quantity-style {:own own})} [quo/text {:accessibility-label (str "emoji-" emoji-id "-is-own-" own)
:style (styles/reaction-quantity-style {:own own})}
quantity]]) quantity]])
(defn message-reactions [message reactions] (defn message-reactions [message reactions]

View File

@ -61,3 +61,5 @@ connection_is_secure_text = "Connection is secure. Make sure you really trust th
test_dapp_url = 'simpledapp.eth' test_dapp_url = 'simpledapp.eth'
test_dapp_name = 'simpledapp.eth' test_dapp_name = 'simpledapp.eth'
emojis = {'thumbs-up': 2, 'thumbs-down': 3, 'love': 1, 'laugh': 4, 'angry': 6, 'sad': 5}

View File

@ -299,7 +299,7 @@ class TestWalletManagement(SingleDeviceTestCase):
self.errors.append('Send button is shown on watch-only wallet') self.errors.append('Send button is shown on watch-only wallet')
if not wallet_view.element_by_text('Watch-only').is_element_displayed(): if not wallet_view.element_by_text('Watch-only').is_element_displayed():
self.errors.append('No "Watch-only" label is shown on watch-only wallet') self.errors.append('No "Watch-only" label is shown on watch-only wallet')
wallet_view.receive_transaction_button.click() wallet_view.receive_transaction_button.click_until_presence_of_element(wallet_view.address_text.text)
if wallet_view.address_text.text[2:] != basic_user['address']: if wallet_view.address_text.text[2:] != basic_user['address']:
self.errors.append('Wrong address %s is shown in "Receive" popup for watch-only account ' % wallet_view.address_text.text) self.errors.append('Wrong address %s is shown in "Receive" popup for watch-only account ' % wallet_view.address_text.text)
wallet_view.close_share_popup() wallet_view.close_share_popup()

View File

@ -710,6 +710,79 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6315)
@marks.critical
def test_reactions_to_message_in_chats(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Both devices join to 1-1 chat')
device_2_public_key = home_2.get_public_key_and_username()
device_1_profile = home_1.profile_button.click()
device_1_username = device_1_profile.default_username_text.text
home_1.home_button.click()
device_1.just_fyi("Sender start 1-1 chat, set emoji and check counter")
device_1_chat = home_1.add_contact(device_2_public_key)
device_1_chat.send_message(message_from_sender)
device_1_chat.set_reaction(message_from_sender)
message_sender = device_1_chat.chat_element_by_text(message_from_sender)
if message_sender.emojis_below_message() != 1:
self.errors.append("Counter of reaction is not updated on your own message!")
device_2.just_fyi("Receiver set own emoji and verifies counter on received message in 1-1 chat")
home_2.home_button.click()
device_2_chat_item = home_2.get_chat(device_1_username)
device_2_chat_item.wait_for_visibility_of_element(20)
device_2_chat = device_2_chat_item.click()
message_receiver = device_2_chat.chat_element_by_text(message_from_sender)
if message_receiver.emojis_below_message(own=False) != 1:
self.errors.append("Counter of reaction is not updated on received message!")
device_2_chat.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message():
if counter != 2:
self.errors.append('Counter is not updated after setting emoji from receiver!')
device_2.just_fyi("Receiver pick the same emoji and verify that counter will decrease for both users")
device_2_chat.set_reaction(message_from_sender)
for counter in message_sender.emojis_below_message(), message_receiver.emojis_below_message(own=False):
if counter != 1:
self.errors.append('Counter is not decreased after re-tapping emoji from receiver!')
[chat.get_back_to_home_view() for chat in (device_2_chat, device_1_chat)]
device_1.just_fyi('Both devices joining the same public chat, send messages and check counters')
chat_name = device_1.get_random_chat_name()
[home.join_public_chat(chat_name) for home in (home_1, home_2)]
chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view()
chat_public_1.send_message(message_from_sender)
device_1_chat.just_fyi('Set several emojis as sender and receiver and check counters in public chat')
message_sender = chat_public_1.chat_element_by_text(message_from_sender)
emojis_from_sender = ['thumbs-down', 'love', 'laugh']
[chat_public_1.set_reaction(message_from_sender, emoji) for emoji in emojis_from_sender]
emojis_from_receiver = ['angry', 'sad']
[chat_public_2.set_reaction(message_from_sender, emoji) for emoji in emojis_from_receiver]
message_receiver=chat_public_2.chat_element_by_text(message_from_sender)
for emoji in emojis_from_sender:
if message_sender.emojis_below_message(emoji) != 1:
self.errors.append('Counter is not updated on own message after tapping %s for sender in pub chat' % emoji)
if message_receiver.emojis_below_message(emoji, own=False) != 1:
self.errors.append('Counter is not updated on received message after tapping %s for receiver in pub chat' % emoji)
for emoji in emojis_from_receiver:
if message_sender.emojis_below_message(emoji, own=False) != 1:
self.errors.append('Counter is not updated on own message after tapping %s for receiver in pub chat' % emoji)
if message_receiver.emojis_below_message(emoji) != 1:
self.errors.append('Counter is not updated on received message after tapping %s for sender in pub chat' % emoji)
device_1_chat.just_fyi('Unset emoji and check that it is not shown anymore')
chat_public_1.set_reaction(message_from_sender, 'love')
if message_sender.emojis_below_message('love') != 0:
self.errors.append('Emoji is still shown on message after re-tapping last reaction')
self.errors.verify_no_errors()
@marks.testrail_id(6267) @marks.testrail_id(6267)
@marks.medium @marks.medium
def test_open_user_profile_long_press_on_message(self): def test_open_user_profile_long_press_on_message(self):

View File

@ -29,7 +29,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
amount = chat_1.get_unique_amount() amount = chat_1.get_unique_amount()
home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount) home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
chat_1.commands_button.click() chat_1.commands_button.click_until_presence_of_element(chat_1.send_command)
send_transaction = chat_1.send_command.click() send_transaction = chat_1.send_command.click()
if not send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).is_element_displayed(): if not send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).is_element_displayed():
self.driver.fail('%s is not shown in "Send Transaction" bottom sheet' % recipient_username) self.driver.fail('%s is not shown in "Send Transaction" bottom sheet' % recipient_username)

View File

@ -300,8 +300,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
for message in device_1_chat.image_chat_item, device_1_chat.chat_element_by_text(image_description): for message in device_1_chat.image_chat_item, device_1_chat.chat_element_by_text(image_description):
if not message.is_element_displayed(): if not message.is_element_displayed():
self.errors.append('Image or description is not shown in chat after sending for sender') self.errors.append('Image or description is not shown in chat after sending for sender')
if not device_1_chat.image_chat_item.is_element_image_equals_template('message_image_sender.png'):
self.errors.append("Image doesn't match expected template for sender")
device_1_chat.show_images_button.click() device_1_chat.show_images_button.click()
device_1_chat.image_from_gallery_button.click() device_1_chat.image_from_gallery_button.click()
device_1_chat.click_system_back_button() device_1_chat.click_system_back_button()
@ -317,8 +315,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
for message in device_2_chat.image_chat_item, device_2_chat.chat_element_by_text(image_description): for message in device_2_chat.image_chat_item, device_2_chat.chat_element_by_text(image_description):
if not message.is_element_displayed(): if not message.is_element_displayed():
self.errors.append('Image or description is not shown in chat after sending for receiver') self.errors.append('Image or description is not shown in chat after sending for receiver')
if not device_2_chat.image_chat_item.is_element_image_equals_template('message_image_receiver.png'):
self.errors.append("Image doesn't match expected template for receiver")
device_2_chat.image_chat_item.long_press_element() device_2_chat.image_chat_item.long_press_element()
for element in device_2_chat.reply_message_button, device_2_chat.save_image_button: for element in device_2_chat.reply_message_button, device_2_chat.save_image_button:
if not element.is_element_displayed(): if not element.is_element_displayed():
@ -763,18 +759,19 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'], 'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'],
'error': 'Please enter or scan a valid chat key' 'error': 'Please enter or scan a valid chat key'
}, },
'ens_another_domain':{ # TODO: comment until clarification case with scanning QR with ENS names only
'url': ens_user['ens_another_domain'], # 'ens_another_domain':{
'username': ens_user['username'] # 'url': ens_user['ens_another_domain'],
}, # 'username': ens_user['username']
# },
'own_profile_key': { 'own_profile_key': {
'url': basic_user['public_key'], 'url': basic_user['public_key'],
'error': "That's you" 'error': "That's you"
}, },
'ens_without_stateofus_domain': { # 'ens_without_stateofus_domain': {
'url': ens_user['ens'], # 'url': ens_user['ens'],
'username': ens_user['username'] # 'username': ens_user['username']
}, # },
'other_user_profile_key': { 'other_user_profile_key': {
'url': ens_user['public_key'], 'url': ens_user['public_key'],
'username': ens_user['username'] 'username': ens_user['username']

View File

@ -34,14 +34,15 @@ class TestBrowsing(SingleDeviceTestCase):
browsing_view.element_by_text_part('свободную энциклопедию').click() browsing_view.element_by_text_part('свободную энциклопедию').click()
browsing_view.element_by_text_part('Свободный контент') browsing_view.element_by_text_part('Свободный контент')
browsing_view.browser_previous_page_button.click() browsing_view.browser_previous_page_button.click()
browsing_view.wait_for_element_starts_with_text('свободную энциклопедию')
browsing_view.just_fyi('Relogin and check that tap on "Next" navigates to next page') browsing_view.just_fyi('Relogin and check that tap on "Next" navigates to next page')
browsing_view.relogin() browsing_view.relogin()
home_view.dapp_tab_button.click() home_view.dapp_tab_button.click()
dapp_view.element_by_text_part(ru_url).click() dapp_view.element_by_text_part(ru_url).click()
browsing_view.wait_for_element_starts_with_text('свободную энциклопедию')
browsing_view.browser_next_page_button.click() browsing_view.browser_next_page_button.click()
if not browsing_view.element_by_text_part('Свободный контент').is_element_displayed(20): browsing_view.element_by_text_part('Свободный контент').wait_for_element(30)
self.driver.fail("Browser history is not kept after relogin")
@marks.testrail_id(5438) @marks.testrail_id(5438)
@marks.medium @marks.medium

View File

@ -3,7 +3,7 @@ import dateutil.parser
from selenium.common.exceptions import TimeoutException, NoSuchElementException from selenium.common.exceptions import TimeoutException, NoSuchElementException
from tests import common_password from tests import emojis
from views.base_element import BaseButton, BaseEditBox, BaseText, BaseElement from views.base_element import BaseButton, BaseEditBox, BaseText, BaseElement
from views.base_view import BaseView, ProgressBar from views.base_view import BaseView, ProgressBar
from views.profile_view import ProfilePictureElement, ProfileAddressText from views.profile_view import ProfilePictureElement, ProfileAddressText
@ -345,15 +345,7 @@ class ChatElementByText(BaseText):
except NoSuchElementException: except NoSuchElementException:
ChatView(self.driver).reconnect() ChatView(self.driver).reconnect()
@property
def status(self):
class StatusText(BaseText):
def __init__(self, driver, parent_locator: str):
super(StatusText, self).__init__(driver)
text = "//android.widget.TextView[@text='Not sent. Tap for options']"
self.locator = self.Locator.xpath_selector(parent_locator + text)
return StatusText(self.driver, self.locator.value).wait_for_element(10)
@property @property
def image_in_reply(self): def image_in_reply(self):
@ -497,6 +489,27 @@ class ChatElementByText(BaseText):
except NoSuchElementException: except NoSuchElementException:
return '' return ''
def emojis_below_message(self, emoji: str = 'thumbs-up', own=True):
class EmojisNumber(BaseText):
def __init__(self, driver, parent_locator: str):
self.own = own
self.emoji = emoji
self.emojis_id = 'emoji-' + str(emojis[self.emoji]) + '-is-own-' + str(self.own).lower()
super(EmojisNumber, self).__init__(driver)
self.locator = self.Locator.xpath_selector(
parent_locator + '/../..//*[@content-desc="%s"]' % self.emojis_id)
@property
def text(self):
try:
text = self.find_element().text
self.driver.info('%s is %s for %s where my reaction is set on message is %s' % (self.name, text, self.emoji, str(self.own)))
return text
except NoSuchElementException:
return 0
return int(EmojisNumber(self.driver, self.locator.value).text)
class EmptyPublicChatMessage(BaseText): class EmptyPublicChatMessage(BaseText):
def __init__(self, driver): def __init__(self, driver):
@ -741,6 +754,14 @@ class ChatView(BaseView):
self.element_by_text_part(message).long_press_element() self.element_by_text_part(message).long_press_element()
self.reply_message_button.click() self.reply_message_button.click()
def set_reaction(self, message: str, emoji: str = 'thumbs-up'):
key = emojis[emoji]
self.element_by_text_part(message).long_press_element()
element = BaseButton(self.driver)
element.locator = element.Locator.accessibility_id('pick-emoji-%s' % key)
element.click()
element.wait_for_invisibility_of_element()
def view_profile_long_press(self, message = str): def view_profile_long_press(self, message = str):
self.chat_element_by_text(message).long_press_element() self.chat_element_by_text(message).long_press_element()
self.view_profile_by_avatar_button.click() self.view_profile_by_avatar_button.click()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 157 KiB