E2e tests for audio message

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2020-09-04 16:26:14 +03:00
parent fed52fe309
commit 3181a7dc20
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 126 additions and 8 deletions

View File

@ -221,7 +221,8 @@
:outputRange [styles/rec-button-base-size 16]})]
[react/touchable-highlight {:on-press #(if (= (:general @state) :recording)
(pause-recording params)
(start-recording params))}
(start-recording params))
:accessibility-label :start-stop-audio-recording-button}
[react/view {:style styles/rec-button-container}
[react/animated-view {:style (styles/rec-outer-circle outer-scale)}]
[react/animated-view {:style (styles/rec-inner-circle inner-scale inner-border-radius)}]]]))
@ -273,7 +274,8 @@
:ctrl-buttons-anim-value ctrl-buttons-anim-value
:timer timer}]
[react/view {:style styles/container}
[react/text {:style styles/timer} @timer]
[react/text {:style styles/timer
:accessibility-label :audio-message-recorded-time} @timer]
[react/view {:style styles/buttons-container}
[react/animated-view {:style {:opacity ctrl-buttons-anim-value}}
[cancel-button (:cancel-disabled? @state) #(stop-recording base-params)]]

View File

@ -58,6 +58,7 @@ connection_not_secure_text = "Connection is not secure! " \
"Do not sign transactions or send personal data on this site."
connection_is_secure_text = "Connection is secure. Make sure you really trust this site " \
"before signing transactions or entering personal data."
recorded_error = "You have to give permission to send audio messages"
test_dapp_url = 'simpledapp.eth'
test_dapp_name = 'simpledapp.eth'

View File

@ -1,6 +1,6 @@
import time
from tests import marks, camera_access_error_text, photos_access_error_text
from tests import marks, camera_access_error_text, photos_access_error_text, recorded_error
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
@ -308,6 +308,14 @@ class TestChatManagement(SingleDeviceTestCase):
contacts_view.ok_button.click()
home.get_back_to_home_view()
home.just_fyi("Denying access to audio at attempt to record audio")
chat = home.get_chat(basic_user['username']).click()
chat.audio_message_button.click()
chat.deny_button.click()
contacts_view.element_by_text(recorded_error).wait_for_visibility_of_element(3)
contacts_view.ok_button.click()
home.get_back_to_home_view()
home.just_fyi("Denying access to camera in wallet view")
wallet = home.wallet_button.click()
wallet.set_up_wallet()

View File

@ -386,14 +386,14 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
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.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.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)
@ -402,7 +402,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
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')
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)
@ -411,7 +411,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
if not chat.chat_element_by_text(text_message).is_element_displayed():
self.errors.append('Message was sent, but it is not shown')
device_1.just_fyi('send image to group chat and verify it on all devices')
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()
@ -421,7 +421,15 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
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.just_fyi('Send audio message to group chat and verify it on all devices')
device_1_chat.record_audio_message(message_length_in_seconds=3)
device_1.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.play_pause_audio_message_button.is_element_displayed():
self.errors.append('Audio message 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()

View File

@ -341,6 +341,45 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6316)
@marks.critical
def test_send_audio_message_with_push_notification_check(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.create_user(), device_2.create_user(enable_notifications=True)
profile_1 = home_1.profile_button.click()
default_username_1 = profile_1.default_username_text.text
home_1 = profile_1.get_back_to_home_view()
public_key_2 = home_2.get_public_key_and_username()
home_2.just_fyi("Put app on background (to check Push notification received for audio message)")
home_2.click_system_home_button()
home_2.just_fyi("Sending audio message to device who is on background")
chat_1 = home_1.add_contact(public_key_2)
chat_1.record_audio_message(message_length_in_seconds=125)
if not chat_1.element_by_text("Maximum recording time reached").is_element_displayed():
self.drivers[0].fail("Exceeded 2 mins limit of recording time.")
else:
chat_1.ok_button.click()
if chat_1.audio_message_recorded_time.text != "1:59":
self.errors.append("Timer exceed 2 minutes")
chat_1.send_message_button.click()
device_2.open_notification_bar()
chat_2 = home_2.click_upon_push_notification_by_text("audio message")
listen_time = 5
device_2.home_button.click()
home_2.get_chat(default_username_1).click()
chat_2.play_audio_message(listen_time)
if chat_2.audio_message_in_chat_timer.text != '00:05':
self.errors.append("Listened 5 seconds but timer shows different listened time in audio message")
self.errors.verify_no_errors()
@marks.testrail_id(5316)
@marks.critical
def test_add_to_contacts(self):

View File

@ -4,6 +4,7 @@ import dateutil.parser
from selenium.common.exceptions import TimeoutException, NoSuchElementException
from tests import emojis
from time import sleep
from views.base_element import BaseButton, BaseEditBox, BaseText, BaseElement
from views.base_view import BaseView, ProgressBar
from views.profile_view import ProfilePictureElement, ProfileAddressText
@ -598,6 +599,46 @@ class GroupChatInfoView(BaseView):
return UserNameInGroupInfo(self.driver, username)
class AudioMessageButton(BaseButton):
def __init__(self, driver):
super(AudioMessageButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("show-audio-message-icon")
class RecordAudioButton(BaseButton):
def __init__(self, driver):
super(RecordAudioButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("start-stop-audio-recording-button")
class CancelAudioMessageButton(BaseButton):
def __init__(self, driver):
super(CancelAudioMessageButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("cancel-message-button")
class SendAudioMessageButton(BaseButton):
def __init__(self, driver):
super(SendAudioMessageButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("send-message-button")
class PlayPauseAudioMessageButton(BaseButton):
def __init__(self, driver):
super(PlayPauseAudioMessageButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id("play-pause-audio-message-button")
class AudioMessageInChatTimer(BaseText):
def __init__(self, driver):
super(AudioMessageInChatTimer, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//android.view.ViewGroup[@content-desc="play-pause-audio-message-button"]'
'/../..//android.widget.TextView[1]')
class AudioMessageRecordedTime(BaseText):
def __init__(self, driver):
super(AudioMessageRecordedTime, self).__init__(driver)
self.locator = self.Locator.accessibility_id("audio-message-recorded-time")
class ChatView(BaseView):
@ -634,6 +675,14 @@ class ChatView(BaseView):
self.recent_image_in_gallery = ImageInRecentInGalleryElement(self.driver)
self.cancel_send_image_button = CancelSendImage(self.driver)
self.audio_message_button = AudioMessageButton(self.driver)
self.record_audio_button = RecordAudioButton(self.driver)
self.cancel_audio_message_button = CancelAudioMessageButton(self.driver)
self.send_audio_message_button = SendAudioMessageButton(self.driver)
self.play_pause_audio_message_button = PlayPauseAudioMessageButton(self.driver)
self.audio_message_in_chat_timer = AudioMessageInChatTimer(self.driver)
self.audio_message_recorded_time = AudioMessageRecordedTime(self.driver)
self.chat_options = ChatMenuButton(self.driver)
@ -787,6 +836,17 @@ class ChatView(BaseView):
element.click()
element.wait_for_invisibility_of_element()
def record_audio_message(self, message_length_in_seconds=5):
self.audio_message_button.click()
self.allow_button.click()
self.record_audio_button.click()
sleep(message_length_in_seconds)
def play_audio_message(self, listen_time=5):
self.play_pause_audio_message_button.click()
sleep(listen_time)
self.play_pause_audio_message_button.click()
def block_contact(self):
self.profile_block_contact.click()
self.block_contact_button.click()