new e2e + accessibility

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-08-25 16:37:32 +02:00
parent 8adc32a5c9
commit 716c968a23
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
6 changed files with 183 additions and 14 deletions

View File

@ -294,16 +294,17 @@
(let [pack (get-in content [:sticker :pack])]
[message-content-wrapper message
[react/touchable-highlight (when-not modal
{:on-press (fn [_]
(when pack
(re-frame/dispatch [:stickers/open-sticker-pack pack]))
(react/dismiss-keyboard!))
:on-long-press (fn []
(on-long-press
(when-not outgoing
[{:on-press #(when pack
(re-frame/dispatch [:chat.ui/show-profile from]))
:label (i18n/label :t/view-details)}])))})
{:accessibility-label :sticker-message
:on-press (fn [_]
(when pack
(re-frame/dispatch [:stickers/open-sticker-pack pack]))
(react/dismiss-keyboard!))
:on-long-press (fn []
(on-long-press
(when-not outgoing
[{:on-press #(when pack
(re-frame/dispatch [:chat.ui/show-profile from]))
:label (i18n/label :t/view-details)}])))})
[react/image {:style {:margin 10 :width 140 :height 140}
;;TODO (perf) move to event
:source {:uri (contenthash/url (-> content :sticker :hash))}}]]
@ -332,7 +333,7 @@
[react/touchable-highlight (when-not modal
{:on-long-press
(fn [] (on-long-press []))})
[react/view (style/message-view message)
[react/view {:style (style/message-view message) :accessibility-label :audio-message}
[message.audio/message-content message [message-timestamp message false]]]]
reaction-picker])

View File

@ -1,9 +1,10 @@
import time
from tests import marks, camera_access_error_text, photos_access_error_text
from tests.users import basic_user, dummy_user, ens_user_ropsten
from tests.users import basic_user, dummy_user, ens_user_ropsten, ens_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.chat_view import ChatView
@marks.chat
@ -49,6 +50,91 @@ class TestChatManagement(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6320)
@marks.medium
def test_can_start_chat_from_suggestions_using_search_chat(self):
sign_in = SignInView(self.driver)
home = sign_in.create_user()
profile = home.profile_button.click()
profile.switch_network()
chat_view = ChatView(self.driver)
ens_name_status, ens_name_another_domain, public_chat_name = ens_user_ropsten['ens'], \
ens_user['ens_another_domain'], 'some-pub-chat'
search_list = {
ens_name_status: {
'home': {
'Start a new private chat',
'Join a public chat',
'%s.stateofus.eth' % ens_name_status,
'#%s' % ens_name_status
},
'navigate_to': '%s.stateofus.eth' % ens_name_status,
'chat_view': {
chat_view.add_to_contacts,
chat_view.element_by_text('@%s' % ens_name_status),
chat_view.chat_message_input
}
},
ens_name_another_domain: {
'home': {
'Start a new private chat',
},
'home_not_shown': 'Join a public chat',
'navigate_to': 'Start a new private chat',
'chat_view': {
chat_view.add_to_contacts,
chat_view.element_by_text('@%s' % ens_name_another_domain),
chat_view.chat_message_input
},
},
public_chat_name: {
'home': {
'Join a public chat',
},
'home_not_shown': 'Start a new private chat',
'navigate_to': '#%s' % public_chat_name,
'chat_view': {
chat_view.element_by_text('#%s' % public_chat_name),
chat_view.chat_message_input
},
},
}
home.just_fyi('Join public chat to have search input on home view')
chat_name = home.get_random_chat_name()
public_chat = home.join_public_chat(chat_name)
public_chat.get_back_to_home_view()
home.swipe_down()
for keyword in search_list:
home.just_fyi('Can start chat from searching for %s' % keyword)
home.search_by_keyword(keyword)
if not home.element_by_text_part('No search results. Do you mean').is_element_displayed():
self.errors.append('"No search results" is not shown')
if 'home_not_shown' in search_list[keyword]:
if home.element_by_text(search_list[keyword]['home_not_shown']).is_element_displayed():
self.errors.append('%s is shown on home view while searching for %s' % (search_list[keyword]['home_not_shown'], keyword))
for text in search_list[keyword]['home']:
if not home.element_by_text(text).is_element_displayed():
self.errors.append('%s is not shown on home view while searching for %s' % (text, keyword))
home.element_by_text(search_list[keyword]['navigate_to']).click()
for element in search_list[keyword]['chat_view']:
if not element.is_element_displayed():
self.errors.append('Requested %s element is not shown on chat view after navigating from suggestion '
'for %s' % (element.name, keyword))
home.back_button.click()
home.just_fyi('No suggestion at attempt to search for invalid data')
invalid_data = [' ', 'ab;', '.6', '@ana']
for text in invalid_data:
home.search_by_keyword(text)
if home.element_by_text_part('No search results. Do you mean').is_element_displayed():
self.errors.append('"No search results" is shown when searching for invalid value %s' % text)
home.cancel_button.click()
self.errors.verify_no_errors()
@marks.testrail_id(5319)
@marks.medium
def test_long_press_to_clear_chat_history(self):

View File

@ -2,6 +2,7 @@ from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.users import transaction_recipients
from views.sign_in_view import SignInView
from time import sleep
@marks.chat
@ -365,6 +366,79 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6317)
@marks.medium
def test_pair_devices_group_chat_different_messages(self):
self.create_drivers(3)
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(self.drivers[2])
device_1_home = device_1.create_user()
device_1_home.profile_button.click()
device_1_profile = device_1_home.get_profile_view()
device_1_profile.privacy_and_security_button.click()
device_1_profile.backup_recovery_phrase_button.click()
device_1_profile.ok_continue_button.click()
recovery_phrase = device_1_profile.get_recovery_phrase()
device_1_profile.back_button.click()
device_1_profile.get_back_to_home_view()
device_3_home = device_3.create_user()
device_3_chat_key, device_3_username = device_3_home.get_public_key_and_username(return_username=True)
device_3.home_button.click()
device_1_name, device_2_name, group_chat_name = 'creator', 'paired', 'some group chat'
device_1.just_fyi('add contact, start group chat')
device_1_home.add_contact(device_3_chat_key)
device_1_home.back_button.click()
device_1_chat = device_1_home.create_group_chat([device_3_username], group_chat_name)
device_3_chat = device_3_home.get_chat(group_chat_name).click()
device_3_chat.join_chat_button.click()
device_2.just_fyi('go to profile > Devices, set device name, discover device 2 to device 1')
device_2_home = device_2.recover_access(passphrase=' '.join(recovery_phrase.values()))
device_2_profile = device_2_home.get_profile_view()
device_2_profile.discover_and_advertise_device(device_2_name)
device_1_profile.discover_and_advertise_device(device_1_name)
device_1_profile.get_toggle_device_by_name(device_2_name).click()
device_1_profile.sync_all_button.click()
device_1_profile.sync_all_button.wait_for_visibility_of_element(15)
device_1.just_fyi('send message to group chat and verify it on all devices')
text_message = 'some text'
[device.home_button.click() for device in (device_1_profile, device_2_profile)]
device_1_chat.send_message(text_message)
device_2_chat = device_2_home.get_chat(group_chat_name).click()
for chat in device_1_chat, device_2_chat, device_3_chat:
if not chat.chat_element_by_text(text_message).is_element_displayed():
self.errors.append('Message was sent, but it is not shown')
# TODO: disabled until #11113 fix
# device_1.just_fyi('send image to group chat and verify it on all devices')
# device_1_chat.show_images_button.click()
# device_1_chat.allow_button.click()
# device_1_chat.first_image_from_gallery.click()
# device_1_chat.send_message_button.click()
# device_1_chat.chat_message_input.click()
# for chat in device_1_chat, device_2_chat, device_3_chat:
# if not chat.image_chat_item.is_element_displayed():
# self.errors.append('Image is not shown in chat after sending for sender')
device_1.just_fyi('send sticker to group chat and verify it on all devices')
device_1_chat.profile_button.click()
device_1_profile.click_system_back_button(2)
device_1_profile.switch_network()
device_1_home.get_chat(group_chat_name).click()
device_1_chat.show_stickers_button.click()
device_1_chat.get_stickers.click()
device_1_chat.install_sticker_pack_by_name('Status Cat')
device_1_chat.back_button.click()
sleep(2)
device_1_chat.swipe_left()
device_1_chat.sticker_icon.click()
if not device_1_chat.sticker_message.is_element_displayed():
self.errors.append('Sticker was not sent')
self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase):

View File

@ -203,7 +203,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_2_chat.chat_options.click()
device_2_chat.view_profile_button.click()
# Skip until edit-profile feature returned
# TODO: skip until edit-profile feature returned
# if not device_2_chat.contact_profile_picture.is_element_image_equals_template('sauce_logo.png'):
# self.errors.append("Updated profile picture is not shown in one-to-one chat")
@ -241,7 +241,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
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():
if not device_1_public_chat.sticker_message.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():

View File

@ -522,6 +522,13 @@ class ChatItem(BaseElement):
super().__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="chat-item"]')
class StikerMessageItem(BaseElement):
def __init__(self, driver):
super().__init__(driver)
self.locator = self.Locator.accessibility_id('sticker-message')
class ImageChatItem(BaseElement):
def __init__(self, driver):
super().__init__(driver)
@ -607,6 +614,7 @@ class ChatView(BaseView):
self.no_messages_in_chat = NoMessagesInChatText(self.driver)
self.empty_public_chat_message = EmptyPublicChatMessage(self.driver)
self.chat_item = ChatItem(self.driver)
self.sticker_message = StikerMessageItem(self.driver)
self.commands_button = CommandsButton(self.driver)
self.send_command = SendCommand(self.driver)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 40 KiB